X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fhtmldataprocessor%2Fplugin.js;h=f8cf91d637b4efb90b40e29ac1def101c87f1b33;hb=039a051ccf3901311661022a30afd60fc38130c9;hp=ad3852d7aed0b67b97b697b7e22eda635dce85ce;hpb=66f4ae0bf0280ed56bf7c0f4ab175424dd1d47a0;p=ckeditor.git diff --git a/_source/plugins/htmldataprocessor/plugin.js b/_source/plugins/htmldataprocessor/plugin.js index ad3852d..f8cf91d 100644 --- a/_source/plugins/htmldataprocessor/plugin.js +++ b/_source/plugins/htmldataprocessor/plugin.js @@ -201,7 +201,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license title : function( element ) { - element.children[ 0 ].value = element.attributes[ '_cke_title' ]; + var titleText = element.children[ 0 ]; + titleText && ( titleText.value = element.attributes[ '_cke_title' ] || '' ); } }, @@ -262,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; @@ -274,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 ) @@ -308,6 +317,11 @@ For licensing, see LICENSE.html or http://ckeditor.com/license return html.replace( protectSelfClosingRegex, '' ); } + function protectPreFormatted( html ) + { + return html.replace( /(]*>)(\r\n|\n)/g, '$1$2$2' ); + } + function protectRealComments( html ) { return html.replace( //g, function( match ) @@ -428,6 +442,10 @@ For licensing, see LICENSE.html or http://ckeditor.com/license // protecting them into open-close. (#3591) data = protectSelfClosingElements( data ); + // Compensate one leading line break after
 open as browsers
+			// eat it up. (#5789)
+			data = protectPreFormatted( data );
+
 			// Call the browser to help us fixing a possibly invalid HTML
 			// structure.
 			var div = new CKEDITOR.dom.element( 'div' );
@@ -482,4 +500,3 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
  * @example
  * config.forceSimpleAmpersand = false;
  */
-CKEDITOR.config.forceSimpleAmpersand = false;