Ticket #5746: 5746_2.patch

File 5746_2.patch, 1.9 KB (added by Garry Yao, 14 years ago)
  • _source/plugins/htmldataprocessor/plugin.js

     
    8484        delete blockLikeTags.pre;
    8585        var defaultDataFilterRules =
    8686        {
     87                elements : {},
    8788                attributeNames :
    8889                [
    8990                        // Event attributes (onXYZ) must not be directly set. They can become
     
    240241                };
    241242        }
    242243
     244        function protectReadOnly( element )
     245        {
     246                element.attributes.contenteditable = "false";
     247        }
     248        function unprotectReadyOnly( element )
     249        {
     250                delete element.attributes.contenteditable;
     251        }
     252        // Disable form elements editing mode provided by some browers. (#5746)
     253        for ( i in { input : 1, textarea : 1 } )
     254        {
     255                defaultDataFilterRules.elements[ i ] = protectReadOnly;
     256                defaultHtmlFilterRules.elements[ i ] = unprotectReadyOnly;
     257        }
     258
    243259        var protectAttributeRegex = /<(?:a|area|img|input)[\s\S]*?\s((?:href|src|name)\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|(?:[^ "'>]+)))/gi;
    244260
    245261        var protectElementsRegex = /(?:<style(?=[ >])[^>]*>[\s\S]*<\/style>)|(?:<(:?link|meta|base)[^>]*>)/gi,
  • _source/plugins/wysiwygarea/plugin.js

     
    849849                                        focusGrabber.clearCustomData();
    850850                                } );
    851851                        }
    852                 }
     852
     853                        // Disable form elements editing mode provided by some browers. (#5746)
     854                        editor.on( 'insertElement', function ( evt )
     855                        {
     856                                var element = evt.data;
     857                                if ( element.type = CKEDITOR.NODE_ELEMENT
     858                                                && ( element.is( 'input' ) || element.is( 'textarea' ) ) )
     859                                {
     860                                        element.setAttribute( 'contentEditable', false );
     861                                }
     862                        }, 10 );
     863
     864                }
    853865        });
    854866
    855867        // Fixing Firefox 'Back-Forward Cache' break design mode. (#4514)
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy