Skip to content
Snippets Groups Projects
Commit f4605338 authored by Angie Byron's avatar Angie Byron
Browse files

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
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
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment