Introduce command#disable()
and command#enable()
#2903
Labels
Milestone
command#disable()
and command#enable()
#2903
Current status on March 6, 2023
At the time of writing,
Command#disable()
andCommand#enable()
got replaced byCommand#forceDisabled()
andCommand#clearForceDisabled()
and those are the correct way to disable or enable the command in the CKEditor 5.Usage example:
More details and examples are available in API docs:
Original issue
More and more features are using "disable all/most commands" functionality (mostly in collaboration features though). It leads to duplicating a lot of code. Additionally, it is not really intuitive to disable a command through listening to
isEnabled
.Hence, I propose to add this functionality to
Command
API. Of course, it will need to handle multiple disabling, so one algorithm will not re-enable lock set in another algorithm. This can be simply handled through passing identifiers.I think this is a better solution that returning enabling callback:
Because of how we use disabling:
If callback would be returned we would have to store all of them which doesn't make sense.
The text was updated successfully, but these errors were encountered: