X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fhtmldataprocessor%2Fplugin.js;h=24e4830bec000a6d625c2a5ff5345ed3ca025fa9;hb=055b6b0792ce7dc53d47af606b367c04b927c2ab;hp=264f5044265fef2ae8cddfe6e18dfe6e6d0dc3a3;hpb=e7789c1ad838194d45eeee6ac2eb6e55f5cf35a1;p=ckeditor.git diff --git a/_source/plugins/htmldataprocessor/plugin.js b/_source/plugins/htmldataprocessor/plugin.js index 264f504..24e4830 100644 --- a/_source/plugins/htmldataprocessor/plugin.js +++ b/_source/plugins/htmldataprocessor/plugin.js @@ -84,6 +84,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license delete blockLikeTags.pre; var defaultDataFilterRules = { + elements : {}, attributeNames : [ // Event attributes (onXYZ) must not be directly set. They can become @@ -177,6 +178,12 @@ For licensing, see LICENSE.html or http://ckeditor.com/license } }, + html : function( element ) + { + delete element.attributes.contenteditable; + delete element.attributes[ 'class' ]; + }, + body : function( element ) { delete element.attributes.spellcheck; @@ -194,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' ] || '' ); } }, @@ -240,6 +248,21 @@ For licensing, see LICENSE.html or http://ckeditor.com/license }; } + function protectReadOnly( element ) + { + element.attributes.contenteditable = "false"; + } + function unprotectReadyOnly( element ) + { + delete element.attributes.contenteditable; + } + // Disable form elements editing mode provided by some browers. (#5746) + for ( i in { input : 1, textarea : 1 } ) + { + defaultDataFilterRules.elements[ i ] = protectReadOnly; + defaultHtmlFilterRules.elements[ i ] = unprotectReadyOnly; + } + var protectAttributeRegex = /<(?:a|area|img|input)[\s\S]*?\s((?:href|src|name)\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|(?:[^ "'>]+)))/gi; var protectElementsRegex = /(?:])[^>]*>[\s\S]*<\/style>)|(?:<(:?link|meta|base)[^>]*>)/gi,