Ticket #8386: Fix_working_copy_Updated.patch

File Fix_working_copy_Updated.patch, 2.5 KB (added by Yaswanth, 12 years ago)

Workaround 3_Working copy of Fix_Updated.

  • plugins/wysiwygarea/plugin.js

     
    2626                        return selection.getCommonAncestor().isReadOnly();
    2727        }
    2828
    2929        function onInsertHtml( evt )
    3030        {
    3131                if ( this.mode == 'wysiwyg' )
    3232                {
    3333
     34                        var data = evt.data;
     35                       
     36                        if ( this.dataProcessor )
     37                                data = this.dataProcessor.toHtml( data );
     38                       
     39                        this.fire( 'insertElement', CKEDITOR.dom.element.createFromHtml(data) );
    3440
    3541
    36 
    37                         this.focus();
    38 
    39                         var selection = this.getSelection();
    40                         if ( checkReadOnly( selection ) )
    41                                 return;
    42 
    43                         var data = evt.data;
    44                         this.fire( 'saveSnapshot' );
    45 
    46                         if ( this.dataProcessor )
    47                                 data = this.dataProcessor.toHtml( data );
    48 
    49                         if ( CKEDITOR.env.ie )
    50                         {
    51                                 var selIsLocked = selection.isLocked;
    52 
    53                                 if ( selIsLocked )
    54                                         selection.unlock();
    55 
    56                                 var $sel = selection.getNative();
    57 
    58                                 // Delete control selections to avoid IE bugs on pasteHTML.
    59                                 if ( $sel.type == 'Control' )
    60                                         $sel.clear();
    61                                 else if  ( selection.getType() == CKEDITOR.SELECTION_TEXT )
    62                                 {
    63                                         // Due to IE bugs on handling contenteditable=false blocks
    64                                         // (#6005), we need to make some checks and eventually
    65                                         // delete the selection first.
    66 
    67                                         var range = selection.getRanges()[0],
    68                                                 endContainer = range && range.endContainer;
    69 
    70                                         if ( endContainer &&
    71                                                  endContainer.type == CKEDITOR.NODE_ELEMENT &&
    72                                                  endContainer.getAttribute( 'contenteditable' ) == 'false' &&
    73                                                  range.checkBoundaryOfElement( endContainer, CKEDITOR.END ) )
    74                                         {
    75                                                 range.setEndAfter( range.endContainer );
    76                                                 range.deleteContents();
    77                                         }
    78                                 }
    79 
    80                                 try
    81                                 {
    82                                         $sel.createRange().pasteHTML( data );
    83                                 }
    84                                 catch (e) {}
    85 
    86                                 if ( selIsLocked )
    87                                         this.getSelection().lock();
    88                         }
    89                         else
    90                                 this.document.$.execCommand( 'inserthtml', false, data );
    91 
    92                         // Webkit does not scroll to the cursor position after pasting (#5558)
    93                         if ( CKEDITOR.env.webkit )
    94                         {
    95                                 this.document.$.execCommand( 'inserthtml', false, '<span id="cke_paste_marker" cke_temp="1"></span>' );
    96                                 var marker = this.document.getById( 'cke_paste_marker' );
    97                                 marker.scrollIntoView();
    98                                 marker.remove();
    99                                 marker = null;
    100                         }
    101 
    102                         CKEDITOR.tools.setTimeout( function()
    103                                 {
    104                                         this.fire( 'saveSnapshot' );
    105                                 }, 0, this );
    10642                }
    10743        }
    10844
    10945        function onInsertElement( evt )
    11046        {
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy