core/modules/ckeditor/js/plugins/drupalimage/plugin.js | 13 +++++++++++-- core/modules/ckeditor/js/plugins/drupallink/plugin.js | 13 +++++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/core/modules/ckeditor/js/plugins/drupalimage/plugin.js b/core/modules/ckeditor/js/plugins/drupalimage/plugin.js index 8225776..879ba5a 100644 --- a/core/modules/ckeditor/js/plugins/drupalimage/plugin.js +++ b/core/modules/ckeditor/js/plugins/drupalimage/plugin.js @@ -26,10 +26,19 @@ CKEDITOR.plugins.add('drupalimage', { existingValues.width = imageDOMElement ? imageDOMElement.width : ''; existingValues.height = imageDOMElement ? imageDOMElement.height : ''; // Populate all other attributes by their specified attribute values. - var attribute = null; + var attribute = null, attributeName; for (var key = 0; key < imageDOMElement.attributes.length; key++) { attribute = imageDOMElement.attributes.item(key); - existingValues[attribute.nodeName.toLowerCase()] = attribute.nodeValue; + attributeName = attribute.nodeName.toLowerCase(); + // Don't consider data-cke-saved- attributes; they're just there to + // work around browser quirks. + if (attributeName.substring(0, 15) === 'data-cke-saved-') { + continue; + } + // Store the value for this attribute, unless there's a + // data-cke-saved- alternative for it, which will contain the quirk- + // free, original value. + existingValues[attributeName] = imageElement.data('cke-saved-' + attributeName) || attribute.nodeValue; } } diff --git a/core/modules/ckeditor/js/plugins/drupallink/plugin.js b/core/modules/ckeditor/js/plugins/drupallink/plugin.js index c01eff6..fd48230 100644 --- a/core/modules/ckeditor/js/plugins/drupallink/plugin.js +++ b/core/modules/ckeditor/js/plugins/drupallink/plugin.js @@ -25,10 +25,19 @@ CKEDITOR.plugins.add('drupallink', { linkDOMElement = linkElement.$; // Populate an array with the link's current attributes. - var attribute = null; + var attribute = null, attributeName; for (var key = 0; key < linkDOMElement.attributes.length; key++) { attribute = linkDOMElement.attributes.item(key); - existingValues[attribute.nodeName.toLowerCase()] = attribute.nodeValue; + attributeName = attribute.nodeName.toLowerCase(); + // Don't consider data-cke-saved- attributes; they're just there to + // work around browser quirks. + if (attributeName.substring(0, 15) === 'data-cke-saved-') { + continue; + } + // Store the value for this attribute, unless there's a + // data-cke-saved- alternative for it, which will contain the quirk- + // free, original value. + existingValues[attributeName] = linkElement.data('cke-saved-' + attributeName) || attribute.nodeValue; } }