Ticket #4472: 4472.patch

File 4472.patch, 1.2 KB (added by Tobiasz Cudnik, 14 years ago)
  • _source/plugins/wysiwygarea/plugin.js

     
    248248                {
    249249                        restoreDirty( editor );
    250250
     251                        // Memorize scroll position to restore it later (#4472).
     252                        var hostDocument = editor.element.getDocument();
     253                        var hostDocumentElement = hostDocument.getDocumentElement();
     254                        var scrollTop = hostDocumentElement.$.scrollTop;
     255                        var scrollLeft = hostDocumentElement.$.scrollLeft;
     256
    251257                        // Simulating keyboard character input by dispatching a keydown of white-space text.
    252258                        var keyEventSimulate = doc.$.createEvent( "KeyEvents" );
    253259                        keyEventSimulate.initKeyEvent( 'keypress', true, true, win.$, false,
    254260                                false, false, false, 0, 32 );
    255261                        doc.$.dispatchEvent( keyEventSimulate );
    256262
     263                        if ( scrollTop != hostDocumentElement.$.scrollTop || scrollLeft != hostDocumentElement.$.scrollLeft )
     264                                hostDocument.getWindow().$.scrollTo( scrollLeft, scrollTop );
     265
    257266                        // Restore the original document status by placing the cursor before a bogus br created (#5021).
    258267                        bodyChildsNum && body.getFirst().remove();
    259268                        doc.getBody().appendBogus();
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy