summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Pott2016-01-04 18:39:42 (GMT)
committerAlex Pott2016-01-04 18:39:42 (GMT)
commit523e4567797473fcc8ae993c2f8533cbb29224be (patch)
treeea6eaea268398aacd37e20a659e27f20d086dd51
parent0fd8acdf0d54a815658a3d682de2218b87d28ff6 (diff)
Issue #2569893 by quicksketch, Wim Leers, DuaelFr: CKEditor alignment buttons can be used even when the align filter is disabled
-rw-r--r--core/modules/ckeditor/js/plugins/drupalimagecaption/plugin.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/core/modules/ckeditor/js/plugins/drupalimagecaption/plugin.js b/core/modules/ckeditor/js/plugins/drupalimagecaption/plugin.js
index 44e89df..d1d666c 100644
--- a/core/modules/ckeditor/js/plugins/drupalimagecaption/plugin.js
+++ b/core/modules/ckeditor/js/plugins/drupalimagecaption/plugin.js
@@ -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);
+ }
+ }
}
});