X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fwysiwygarea%2Fplugin.js;h=c2566468138f0b3a44ca297bff12b4c7f1b0cfc4;hb=059b4c2fef02528bf1af189f7996e80652faddfb;hp=d3b9e629d459699a04f79e90c68a9112df0d4ce3;hpb=7cd80714081a8ffdf4a1a8d2c72f120ed5ef3d6d;p=ckeditor.git
diff --git a/_source/plugins/wysiwygarea/plugin.js b/_source/plugins/wysiwygarea/plugin.js
index d3b9e62..c256646 100644
--- a/_source/plugins/wysiwygarea/plugin.js
+++ b/_source/plugins/wysiwygarea/plugin.js
@@ -1,5 +1,5 @@
/*
-Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
+Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
@@ -10,18 +10,18 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
(function()
{
- /**
- * List of elements in which has no way to move editing focus outside.
- */
+ // List of elements in which has no way to move editing focus outside.
var nonExitableElementNames = { table:1,pre:1 };
+
// Matching an empty paragraph at the end of document.
- var emptyParagraphRegexp = /\s*<(p|div|address|h\d|center)[^>]*>\s*(?:
]*>| |\u00A0| )?\s*(:?<\/\1>)?\s*$/gi;
+ var emptyParagraphRegexp = /\s*<(p|div|address|h\d|center)[^>]*>\s*(?:
]*>| |\u00A0| )?\s*(:?<\/\1>)?\s*(?=$|<\/body>)/gi;
function onInsertHtml( evt )
{
if ( this.mode == 'wysiwyg' )
{
this.focus();
+ this.fire( 'saveSnapshot' );
var selection = this.getSelection(),
data = evt.data;
@@ -46,6 +46,11 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
}
else
this.document.$.execCommand( 'inserthtml', false, data );
+
+ CKEDITOR.tools.setTimeout( function()
+ {
+ this.fire( 'saveSnapshot' );
+ }, 0, this );
}
}
@@ -84,7 +89,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
var current, dtd;
if ( isBlock )
{
- while( ( current = range.getCommonAncestor( false, true ) )
+ while ( ( current = range.getCommonAncestor( false, true ) )
&& ( dtd = CKEDITOR.dtd[ current.getName() ] )
&& !( dtd && dtd [ elementName ] ) )
{
@@ -138,7 +143,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
// DOM modification here should not bother dirty flag.(#4385)
function restoreDirty( editor )
{
- if( !editor.checkDirty() )
+ if ( !editor.checkDirty() )
setTimeout( function(){ editor.resetDirty(); } );
}
@@ -190,7 +195,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
// If the fixed block is blank and already followed by a exitable
// block, we should revert the fix. (#3684)
- if( fixedBlock.getOuterHtml().match( emptyParagraphRegexp ) )
+ if ( fixedBlock.getOuterHtml().match( emptyParagraphRegexp ) )
{
var previousElement = fixedBlock.getPrevious( isNotWhitespace ),
nextElement = fixedBlock.getNext( isNotWhitespace );
@@ -209,7 +214,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
range.select();
// Notify non-IE that selection has changed.
- if( !CKEDITOR.env.ie )
+ if ( !CKEDITOR.env.ie )
editor.selectionChange();
}
@@ -220,7 +225,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
if ( lastNode && lastNode.getName && ( lastNode.getName() in nonExitableElementNames ) )
{
restoreDirty( editor );
- if( !CKEDITOR.env.ie )
+ if ( !CKEDITOR.env.ie )
body.appendBogus();
else
body.append( editor.document.createText( '\xa0' ) );
@@ -236,112 +241,79 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
var fixForBody = ( editor.config.enterMode != CKEDITOR.ENTER_BR )
? editor.config.enterMode == CKEDITOR.ENTER_DIV ? 'div' : 'p' : false;
+ var frameLabel = editor.lang.editorTitle.replace( '%1', editor.name );
+
editor.on( 'editingBlockReady', function()
{
var mainElement,
- fieldset,
iframe,
isLoadingData,
isPendingFocus,
frameLoaded,
fireMode;
+
// Support for custom document.domain in IE.
var isCustomDomain = CKEDITOR.env.isCustomDomain();
// Creates the iframe that holds the editable document.
- var createIFrame = function()
+ var createIFrame = function( data )
{
if ( iframe )
iframe.remove();
- if ( fieldset )
- fieldset.remove();
frameLoaded = 0;
- // The document domain must be set within the src
- // attribute;
- // Defer the script execution until iframe
- // has been added to main window, this is needed for some
- // browsers which will begin to load the frame content
- // prior to it's presentation in DOM.(#3894)
- var src = 'void( '
- + ( CKEDITOR.env.gecko ? 'setTimeout' : '' ) + '( function(){' +
- 'document.open();' +
- ( CKEDITOR.env.ie && isCustomDomain ? 'document.domain="' + document.domain + '";' : '' ) +
- 'document.write( window.parent[ "_cke_htmlToLoad_' + editor.name + '" ] );' +
- 'document.close();' +
- 'window.parent[ "_cke_htmlToLoad_' + editor.name + '" ] = null;' +
- '}'
- + ( CKEDITOR.env.gecko ? ', 0 )' : ')()' )
- + ' )';
-
- // Loading via src attribute does not work in Opera.
- if ( CKEDITOR.env.opera )
- src = 'void(0);';
- iframe = CKEDITOR.dom.element.createFromHtml( '' );
+ var setDataFn = !CKEDITOR.env.gecko && CKEDITOR.tools.addFunction( function( doc )
+ {
+ CKEDITOR.tools.removeFunction( setDataFn );
+ doc.write( data );
+ });
- var accTitle = editor.lang.editorTitle.replace( '%1', editor.name );
+ var srcScript =
+ 'document.open();' +
- if ( CKEDITOR.env.gecko )
- {
- // Double checking the iframe will be loaded properly(#4058).
- iframe.on( 'load', function( ev )
+ // The document domain must be set any time we
+ // call document.open().
+ ( isCustomDomain ? ( 'document.domain="' + document.domain + '";' ) : '' ) +
+
+ // With FF, it's better to load the data on
+ // iframe.load. (#3894,#4058)
+ // But in FF, we still need the open()-close() call
+ // to avoid HTTPS warnings.
+ ( CKEDITOR.env.gecko ? '' : ( 'parent.CKEDITOR.tools.callFunction(' + setDataFn + ',document);' ) ) +
+
+ 'document.close();';
+
+ iframe = CKEDITOR.dom.element.createFromHtml( '' );
+
+ // With FF, it's better to load the data on iframe.load. (#3894,#4058)
+ CKEDITOR.env.gecko && iframe.on( 'load', function( ev )
{
ev.removeListener();
- contentDomReady( iframe.$.contentWindow );
- } );
- // Accessibility attributes for Firefox.
- mainElement.setAttributes(
- {
- role : 'region',
- title : accTitle
- } );
- iframe.setAttributes(
- {
- role : 'region',
- title : ' '
- } );
- }
- else if ( CKEDITOR.env.webkit )
- {
- iframe.setAttribute( 'title', accTitle ); // Safari 4
- iframe.setAttribute( 'name', accTitle ); // Safari 3
- }
- else if ( CKEDITOR.env.ie )
- {
- // Accessibility label for IE.
- fieldset = CKEDITOR.dom.element.createFromHtml(
- '