diff --git a/core/modules/ckeditor/js/plugins/drupalimage/plugin.js b/core/modules/ckeditor/js/plugins/drupalimage/plugin.js index 3e45eff..51b6466 100644 --- a/core/modules/ckeditor/js/plugins/drupalimage/plugin.js +++ b/core/modules/ckeditor/js/plugins/drupalimage/plugin.js @@ -41,12 +41,27 @@ 'data-entity-uuid': '' } }); - widgetDefinition.allowedContent.img.attributes += ',!data-entity-type,!data-entity-uuid'; - // We don't allow
,
,
or

in our downcast. - delete widgetDefinition.allowedContent.figure; - delete widgetDefinition.allowedContent.figcaption; - delete widgetDefinition.allowedContent.div; - delete widgetDefinition.allowedContent.p; + var allowedContentDefinition = { + element: 'img', + attributes: { + '!data-entity-type': '', + '!data-entity-uuid': '' + } + }; + var imgAttributes = widgetDefinition.allowedContent.img.attributes.split(/\s*,\s*/); + for (var i = 0; i < imgAttributes.length; i++) { + allowedContentDefinition.attributes[imgAttributes[i]] = ''; + } + if (widgetDefinition.allowedContent.img.classes) { + allowedContentDefinition.attributes['class'] = widgetDefinition.allowedContent.img.classes.split(/\s*,\s*/).join(' '); + } + if (widgetDefinition.allowedContent.img.styles) { + var imgStyles = widgetDefinition.allowedContent.img.styles.split(/\s*,\s*/); + for (var i = 0; i < imgStyles.length; i++) { + allowedContentDefinition.styles[imgStyles[i].trim()] = ''; + } + } + widgetDefinition.allowedContent = new CKEDITOR.style(allowedContentDefinition); // Override the 'link' part, to completely disable image2's link // support: http://dev.ckeditor.com/ticket/11341. diff --git a/core/modules/ckeditor/js/plugins/drupalimagecaption/plugin.js b/core/modules/ckeditor/js/plugins/drupalimagecaption/plugin.js index 94c5353..0963c04 100644 --- a/core/modules/ckeditor/js/plugins/drupalimagecaption/plugin.js +++ b/core/modules/ckeditor/js/plugins/drupalimagecaption/plugin.js @@ -55,7 +55,10 @@ requiredContent.attributes['data-align'] = ''; requiredContent.attributes['data-caption'] = ''; widgetDefinition.requiredContent = new CKEDITOR.style(requiredContent); - widgetDefinition.allowedContent.img.attributes += ',!data-align,!data-caption'; + var allowedContent = widgetDefinition.allowedContent.getDefinition(); + allowedContent.attributes['!data-align'] = ''; + allowedContent.attributes['!data-caption'] = ''; + widgetDefinition.allowedContent = new CKEDITOR.style(allowedContent); // Override allowedContent setting for the 'caption' nested editable. // This must match what caption_filter enforces. diff --git a/core/modules/ckeditor/js/plugins/drupallink/plugin.js b/core/modules/ckeditor/js/plugins/drupallink/plugin.js index f4db09e..379848e 100644 --- a/core/modules/ckeditor/js/plugins/drupallink/plugin.js +++ b/core/modules/ckeditor/js/plugins/drupallink/plugin.js @@ -13,11 +13,13 @@ init: function (editor) { // Add the commands for link and unlink. editor.addCommand('drupallink', { - allowedContent: { - a: { - attributes: '!href,target' + allowedContent: new CKEDITOR.style({ + element: 'a', + attributes: { + '!href': '', + 'target': '' } - }, + }), requiredContent: new CKEDITOR.style({ element: 'a', attributes: {