“Remove highlight” button is not following the highlight command disabled state #9174
Closed
Description
📝 Provide detailed reproduction steps (if any)
- Open highlight feature guide and scroll to "Inline buttons" sample.
- Disable the highlight command. You can do this by executing the following code
document.querySelectorAll( '.ck-editor__editable' )[ 2 ].ckeditorInstance.commands.get( 'highlight' ).forceDisabled( 'someId' )
.
✔️ Expected result
On disable Highlight plugin buttons in toolbar should become inactive.
❌ Actual result
“Remove highlight” button is still active.
📃 Other details
- First affected CKEditor version: 24
- Installed CKEditor plugins: default highlight
Possible solution:
_addRemoveHighlightButton() {
const t = this.editor.t;
const command = this.editor.commands.get( 'highlight' );
function decorateHighlightButton( button ) {
button.bind( 'isEnabled' ).to( command, 'isEnabled' );
}
this._addButton( 'removeHighlight', t( 'Remove highlight' ), eraserIcon, null, decorateHighlightButton );
}
Activity