Ticket #4472: 4472.patch
File 4472.patch, 1.2 KB (added by , 13 years ago) |
---|
-
_source/plugins/wysiwygarea/plugin.js
248 248 { 249 249 restoreDirty( editor ); 250 250 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 251 257 // Simulating keyboard character input by dispatching a keydown of white-space text. 252 258 var keyEventSimulate = doc.$.createEvent( "KeyEvents" ); 253 259 keyEventSimulate.initKeyEvent( 'keypress', true, true, win.$, false, 254 260 false, false, false, 0, 32 ); 255 261 doc.$.dispatchEvent( keyEventSimulate ); 256 262 263 if ( scrollTop != hostDocumentElement.$.scrollTop || scrollLeft != hostDocumentElement.$.scrollLeft ) 264 hostDocument.getWindow().$.scrollTo( scrollLeft, scrollTop ); 265 257 266 // Restore the original document status by placing the cursor before a bogus br created (#5021). 258 267 bodyChildsNum && body.getFirst().remove(); 259 268 doc.getBody().appendBogus();