Ticket #6735: 6735.patch

File 6735.patch, 3.0 KB (added by Dinu, 13 years ago)
  • _source/core/dom/node.js

     
    684684                        {
    685685                                if ( current.type == CKEDITOR.NODE_ELEMENT )
    686686                                {
    687                                         if ( current.is( 'body' ) || current.getCustomData( '_cke_notReadOnly' ) )
    688                                                 break;
    689 
    690                                         if ( current.getAttribute( 'contentEditable' ) == 'false' )
     687                                        if ( current.getAttribute( 'contentEditable' ) == 'false' && !current.getCustomData( '_cke_notReadOnly' ) )
    691688                                                return current;
    692                                         else if ( current.getAttribute( 'contentEditable' ) == 'true' )
     689                                        else if ( current.is( 'body' ) || current.getAttribute( 'contentEditable' ) == 'true' )
    693690                                                break;
    694691                                }
    695692                                current = current.getParent();
  • _source/plugins/selection/plugin.js

     
    12221222                        // range position and scroll relatively to it.
    12231223                        var start = this.getStartElement();
    12241224                        start.scrollIntoView();
     1225                },
     1226
     1227                /**
     1228                 * Check if current selection is read only with respect to contenteditable="false" blocks
     1229                 */
     1230                checkIsReadOnly : function()
     1231                {
     1232                        var ranges = this.getRanges(),
     1233                                startNode = ranges[0].startContainer,
     1234                                endNode = ranges[ ranges.length - 1 ].endContainer,
     1235                                commonAncestor = startNode.getCommonAncestor( endNode ),
     1236                                currentNode = startNode;
     1237                        if ( endNode === startNode )
     1238                                endNode = 0;
     1239                        do {
     1240                                if ( currentNode.isReadOnly() )
     1241                                        return true;
     1242                        } while ( currentNode!==commonAncestor && ( currentNode = currentNode.getParent() ) || ( currentNode = endNode ) && !( endNode = 0 ) );
     1243                        return false;
    12251244                }
    12261245        };
    12271246})();
  • _source/plugins/wysiwygarea/plugin.js

     
    1 /*
     1/*
    22Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
    33For licensing, see LICENSE.html or http://ckeditor.com/license
    44*/
     
    2525                                || element.isBlockBoundary() && CKEDITOR.dtd.$empty[ element.getName() ];
    2626        }
    2727
    28         function checkReadOnly( selection )
    29         {
    30                 if ( selection.getType() == CKEDITOR.SELECTION_ELEMENT )
    31                         return selection.getSelectedElement().isReadOnly();
    32                 else
    33                         return selection.getCommonAncestor().isReadOnly();
    34         }
    35 
    3628        function onInsertHtml( evt )
    3729        {
    3830                if ( this.mode == 'wysiwyg' )
     
    4032                        this.focus();
    4133
    4234                        var selection = this.getSelection();
    43                         if ( checkReadOnly( selection ) )
     35                        if ( selection.checkIsReadOnly() )
    4436                                return;
    4537
    4638                        var data = evt.data;
     
    116108                        this.focus();
    117109
    118110                        var selection = this.getSelection();
    119                         if ( checkReadOnly( selection ) )
     111                        if ( selection.checkIsReadOnly() )
    120112                                return;
    121113
    122114                        this.fire( 'saveSnapshot' );
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy