Ticket #8345: 8345_2.patch

File 8345_2.patch, 3.0 KB (added by Garry Yao, 12 years ago)
  • _source/plugins/selection/plugin.js

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    291291                                                                if ( evt.data.$.srcElement.nodeName != 'BODY' )
    292292                                                                        return;
    293293
    294                                                                 // If we have saved a range, restore it at this
    295                                                                 // point.
    296                                                                 if ( savedRange )
    297                                                                 {
    298                                                                         if ( restoreEnabled )
    299                                                                         {
    300                                                                                 // Well not break because of this.
    301                                                                                 try
    302                                                                                 {
    303                                                                                         savedRange.select();
    304                                                                                 }
    305                                                                                 catch (e)
    306                                                                                 {}
    307 
    308                                                                                 // Update locked selection because of the normalized text nodes. (#6083, #6987)
    309                                                                                 var lockedSelection = doc.getCustomData( 'cke_locked_selection' );
    310                                                                                 if ( lockedSelection )
    311                                                                                 {
    312                                                                                         lockedSelection.unlock();
    313                                                                                         lockedSelection.lock();
    314                                                                                 }
    315                                                                         }
    316 
     294                                                                // Give the priority to locked selection since it probably
     295                                                                // reflects the actual situation. (#6083, #6987)
     296                                                                var lockedSelection = doc.getCustomData( 'cke_locked_selection' );
     297                                                                if ( lockedSelection )
     298                                                                {
     299                                                                        lockedSelection.unlock( 1 );
     300                                                                        lockedSelection.lock();
     301                                                                }
     302                                                                // Then check ff we have saved a range, restore it at this
     303                                                                // point.
     304                                                                else if ( savedRange && restoreEnabled )
     305                                                                {
     306                                                                        // Well not break because of this.
     307                                                                        try { savedRange.select(); } catch (e) {}
    317308                                                                        savedRange = null;
    318309                                                                }
    319310                                                        });
  • _source/plugins/wysiwygarea/plugin.js

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    3030                        {
    3131                                this.focus();
    3232
     33                                // Since the insertion might happen from within dialog or menu
     34                                // where the editor selection might be locked at the moment,
     35                                // update the locked selection.
     36                                var selection = this.getSelection(),
     37                                selIsLocked = selection.isLocked;
     38
     39                                selIsLocked && selection.unlock();
     40
    3341                                this.fire( 'saveSnapshot' );
    3442
    3543                                insertFunc.call( this, evt.data );
    3644
     45                                selIsLocked && this.getSelection().lock();
     46
    3747                                // Save snaps after the whole execution completed.
    3848                                // This's a workaround for make DOM modification's happened after
    3949                                // 'insertElement' to be included either, e.g. Form-based dialogs' 'commitContents'
     
    8393
    8494                if ( CKEDITOR.env.ie )
    8595                {
    86                         var selIsLocked = selection.isLocked;
    87 
    88                         if ( selIsLocked )
    89                                 selection.unlock();
    90 
    9196                        var $sel = selection.getNative();
    9297
    9398                        // Delete control selections to avoid IE bugs on pasteHTML.
     
    113118                        }
    114119
    115120                        $sel.createRange().pasteHTML( data );
    116 
    117                         if ( selIsLocked )
    118                                 this.getSelection().lock();
    119121                }
    120122                else
    121123                        this.document.$.execCommand( 'inserthtml', false, data );
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy