X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fwysiwygarea%2Fplugin.js;h=e626aada71776c345d8966eebe1b60ef62a627c9;hb=c9fdde67e6384bd5a66adc2b3bba5c4ce9db56c7;hp=0a35305c43db3a2da88523c8c3c1f46d8b752fcf;hpb=9873d66421922c7aef8be0f5d2ab51e547b19e66;p=ckeditor.git
diff --git a/_source/plugins/wysiwygarea/plugin.js b/_source/plugins/wysiwygarea/plugin.js
index 0a35305..e626aad 100644
--- a/_source/plugins/wysiwygarea/plugin.js
+++ b/_source/plugins/wysiwygarea/plugin.js
@@ -14,7 +14,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
var nonExitableElementNames = { table:1,pre:1 };
// Matching an empty paragraph at the end of document.
- var emptyParagraphRegexp = /\s*<(p|div|address|h\d|center|li)[^>]*>\s*(?:
]*>| |\u00A0| )?\s*(:?<\/\1>)?\s*(?=$|<\/body>)/gi;
+ var emptyParagraphRegexp = /\s*<(p|div|address|h\d|center)[^>]*>\s*(?:
]*>| |\u00A0| )?\s*(:?<\/\1>)?(?=\s*$|<\/body>)/gi;
var notWhitespaceEval = CKEDITOR.dom.walker.whitespaces( true );
@@ -73,7 +73,11 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
}
}
- $sel.createRange().pasteHTML( data );
+ try
+ {
+ $sel.createRange().pasteHTML( data );
+ }
+ catch (e) {}
if ( selIsLocked )
this.getSelection().lock();
@@ -198,7 +202,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
function restoreDirty( editor )
{
if ( !editor.checkDirty() )
- setTimeout( function(){ editor.resetDirty(); } );
+ setTimeout( function(){ editor.resetDirty(); }, 0 );
}
var isNotWhitespace = CKEDITOR.dom.walker.whitespaces( true ),
@@ -244,12 +248,21 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
{
restoreDirty( editor );
+ // Memorize scroll position to restore it later (#4472).
+ var hostDocument = editor.element.getDocument();
+ var hostDocumentElement = hostDocument.getDocumentElement();
+ var scrollTop = hostDocumentElement.$.scrollTop;
+ var scrollLeft = hostDocumentElement.$.scrollLeft;
+
// Simulating keyboard character input by dispatching a keydown of white-space text.
var keyEventSimulate = doc.$.createEvent( "KeyEvents" );
keyEventSimulate.initKeyEvent( 'keypress', true, true, win.$, false,
false, false, false, 0, 32 );
doc.$.dispatchEvent( keyEventSimulate );
+ if ( scrollTop != hostDocumentElement.$.scrollTop || scrollLeft != hostDocumentElement.$.scrollLeft )
+ hostDocument.getWindow().$.scrollTo( scrollLeft, scrollTop );
+
// Restore the original document status by placing the cursor before a bogus br created (#5021).
bodyChildsNum && body.getFirst().remove();
doc.getBody().appendBogus();
@@ -412,8 +425,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
' allowTransparency="true"' +
'>' );
- // #5689 Running inside of Firefox chrome the load event doesn't bubble like in a normal page
- if (document.location.protocol == 'chrome:')
+ // Running inside of Firefox chrome the load event doesn't bubble like in a normal page (#5689)
+ if ( document.location.protocol == 'chrome:' )
CKEDITOR.event.useCapture = true;
// With FF, it's better to load the data on iframe.load. (#3894,#4058)
@@ -430,11 +443,34 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
doc.close();
});
- // #5689 Reset adjustment back to default
- if (document.location.protocol == 'chrome:')
+ // Reset adjustment back to default (#5689)
+ if ( document.location.protocol == 'chrome:' )
CKEDITOR.event.useCapture = false;
+ // The container must be visible when creating the iframe in FF (#5956)
+ var element = editor.element,
+ isHidden = CKEDITOR.env.gecko && !element.isVisible(),
+ previousStyles = {};
+ if ( isHidden )
+ {
+ element.show();
+ previousStyles = {
+ position : element.getStyle( 'position' ),
+ top : element.getStyle( 'top' )
+ };
+ element.setStyles( { position : 'absolute', top : '-3000px' } );
+ }
+
mainElement.append( iframe );
+
+ if ( isHidden )
+ {
+ setTimeout( function()
+ {
+ element.hide();
+ element.setStyles( previousStyles );
+ }, 1000 );
+ }
};
// The script that launches the bootstrap logic on 'domReady', so the document