Commit f4605338 authored by webchick's avatar webchick

Issue #1964316 by Wim Leers: Automatically use 'sourcedialog' plugin/button...

Issue #1964316 by Wim Leers: Automatically use 'sourcedialog' plugin/button instead of 'sourcearea' plugin/button when using CKEditor for in-place editing.
parent 53d8c24d
......@@ -55,6 +55,24 @@ Drupal.editors.ckeditor = {
top: mainToolbarId
}
};
// Find the "Source" button, if any, and replace it with "Sourcedialog".
// (The 'sourcearea' plugin only works in CKEditor's iframe mode.)
var sourceButtonFound = false;
for (var i = 0; !sourceButtonFound && i < settings.toolbar.length; i++) {
if (settings.toolbar[i] !== '/') {
for (var j = 0; !sourceButtonFound && j < settings.toolbar[i].items.length; j++) {
if (settings.toolbar[i].items[j] === 'Source') {
sourceButtonFound = true;
// Swap sourcearea's "Source" button for sourcedialog's.
settings.toolbar[i].items[j] = 'Sourcedialog';
settingsOverride.extraPlugins += ',sourcedialog';
settingsOverride.removePlugins += ',sourcearea';
}
}
}
}
settings.extraPlugins += ',' + settingsOverride.extraPlugins;
settings.removePlugins += ',' + settingsOverride.removePlugins;
settings.sharedSpaces = settingsOverride.sharedSpaces;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment