X-Git-Url: https://jasonwoof.com/gitweb/?p=ckeditor.git;a=blobdiff_plain;f=_source%2Fplugins%2Fhtmldataprocessor%2Fplugin.js;h=c431c03a5259fd9a9e9c77b6cb304cae05cc1ef5;hp=24e4830bec000a6d625c2a5ff5345ed3ca025fa9;hb=c9fdde67e6384bd5a66adc2b3bba5c4ce9db56c7;hpb=9873d66421922c7aef8be0f5d2ab51e547b19e66 diff --git a/_source/plugins/htmldataprocessor/plugin.js b/_source/plugins/htmldataprocessor/plugin.js index 24e4830..c431c03 100644 --- a/_source/plugins/htmldataprocessor/plugin.js +++ b/_source/plugins/htmldataprocessor/plugin.js @@ -263,7 +263,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license defaultHtmlFilterRules.elements[ i ] = unprotectReadyOnly; } - var protectAttributeRegex = /<(?:a|area|img|input)[\s\S]*?\s((?:href|src|name)\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|(?:[^ "'>]+)))/gi; + var protectAttributeRegex = /<((?:a|area|img|input)[\s\S]*?\s)((href|src|name)\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|(?:[^ "'>]+)))([^>]*)>/gi, + findSavedSrcRegex = /\s_cke_saved_src\s*=/; var protectElementsRegex = /(?:])[^>]*>[\s\S]*<\/style>)|(?:<(:?link|meta|base)[^>]*>)/gi, encodedElementsRegex = /([^<]*)<\/cke:encoded>/gi; @@ -275,7 +276,14 @@ For licensing, see LICENSE.html or http://ckeditor.com/license function protectAttributes( html ) { - return html.replace( protectAttributeRegex, '$& _cke_saved_$1' ); + return html.replace( protectAttributeRegex, function( tag, beginning, fullAttr, attrName, end ) + { + // We should not rewrite the _cke_saved_src attribute (#5218) + if ( attrName == 'src' && findSavedSrcRegex.test( tag ) ) + return tag; + else + return '<' + beginning + fullAttr + ' _cke_saved_' + fullAttr + end + '>'; + }); } function protectElements( html )