Skip to content
Snippets Groups Projects
Commit 523e4567 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2569893 by quicksketch, Wim Leers, DuaelFr: CKEditor alignment buttons...

Issue #2569893 by quicksketch, Wim Leers, DuaelFr: CKEditor alignment buttons can be used even when the align filter is disabled
parent 0fd8acdf
Branches
Tags
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -244,6 +244,27 @@
};
// Low priority to ensure drupalimage's event handler runs first.
}, null, null, 20);
},
afterInit: function (editor) {
var disableButtonIfOnWidget = function (evt) {
var widget = editor.widgets.focused;
if (widget && widget.name === 'image') {
this.setState(CKEDITOR.TRISTATE_DISABLED);
evt.cancel();
}
};
// Disable alignment buttons if the align filter is not enabled.
if (editor.plugins.justify && !editor.config.drupalImageCaption_alignFilterEnabled) {
var cmd;
var commands = ['justifyleft', 'justifycenter', 'justifyright', 'justifyblock'];
for (var n = 0; n < commands.length; n++) {
cmd = editor.getCommand(commands[n]);
cmd.contextSensitive = 1;
cmd.on('refresh', disableButtonIfOnWidget, null, null, 4);
}
}
}
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment