X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fhtmldataprocessor%2Fplugin.js;h=ad3852d7aed0b67b97b697b7e22eda635dce85ce;hb=66f4ae0bf0280ed56bf7c0f4ab175424dd1d47a0;hp=7c48c2e3b3614971a156b6bf576ca4d3b1831bef;hpb=c6e377a02b54abc07129d72b632763c727476a15;p=ckeditor.git diff --git a/_source/plugins/htmldataprocessor/plugin.js b/_source/plugins/htmldataprocessor/plugin.js index 7c48c2e..ad3852d 100644 --- a/_source/plugins/htmldataprocessor/plugin.js +++ b/_source/plugins/htmldataprocessor/plugin.js @@ -41,7 +41,12 @@ For licensing, see LICENSE.html or http://ckeditor.com/license function blockNeedsExtension( block ) { var lastChild = lastNoneSpaceChild( block ); - return !lastChild || lastChild.type == CKEDITOR.NODE_ELEMENT && lastChild.name == 'br'; + + return !lastChild + || lastChild.type == CKEDITOR.NODE_ELEMENT && lastChild.name == 'br' + // Some of the controls in form needs extension too, + // to move cursor at the end of the form. (#4791) + || block.name == 'form' && lastChild.name == 'input'; } function extendBlockForDisplay( block ) @@ -79,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 @@ -172,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; @@ -185,6 +197,11 @@ For licensing, see LICENSE.html or http://ckeditor.com/license if ( !element.attributes.type ) element.attributes.type = 'text/css'; + }, + + title : function( element ) + { + element.children[ 0 ].value = element.attributes[ '_cke_title' ]; } }, @@ -230,6 +247,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,