X-Git-Url: https://jasonwoof.com/gitweb/?p=ckeditor.git;a=blobdiff_plain;f=_source%2Fplugins%2Fwysiwygarea%2Fplugin.js;h=c2a8b152f9e364f13676ca85bdfd1a14b450b3e6;hp=d3b9e629d459699a04f79e90c68a9112df0d4ce3;hb=941b0a9ba4e673e292510d80a5a86806994b8ea6;hpb=7cd80714081a8ffdf4a1a8d2c72f120ed5ef3d6d
diff --git a/_source/plugins/wysiwygarea/plugin.js b/_source/plugins/wysiwygarea/plugin.js
index d3b9e62..c2a8b15 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 );
}
}
@@ -250,7 +255,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
var isCustomDomain = CKEDITOR.env.isCustomDomain();
// Creates the iframe that holds the editable document.
- var createIFrame = function()
+ var createIFrame = function( data )
{
if ( iframe )
iframe.remove();
@@ -258,46 +263,41 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
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( '' );
+ ' style="width:100%;height:100%"' +
+ ' frameBorder="0"' +
+ // Support for custom document.domain in IE.
+ ( isCustomDomain ?
+ ' src="javascript:void((function(){' +
+ 'document.open();' +
+ 'document.domain=\'' + document.domain + '\';' +
+ 'document.close();' +
+ '})())"' : '' ) +
+ ' tabIndex="-1"' +
+ ' allowTransparency="true"' +
+ '>' );
+
+ // Register onLoad event for iframe element, which
+ // will fill it with content and set custom domain.
+ iframe.on( 'load', function( e )
+ {
+ e.removeListener();
+ var doc = iframe.getFrameDocument().$;
+
+ // Custom domain handling is needed after each document.open().
+ doc.open();
+ if ( isCustomDomain )
+ doc.domain = document.domain;
+ doc.write( data );
+ doc.close();
+
+ } );
var accTitle = editor.lang.editorTitle.replace( '%1', editor.name );
if ( CKEDITOR.env.gecko )
{
- // Double checking the iframe will be loaded properly(#4058).
- iframe.on( 'load', function( ev )
- {
- ev.removeListener();
- contentDomReady( iframe.$.contentWindow );
- } );
-
// Accessibility attributes for Firefox.
mainElement.setAttributes(
{
@@ -586,54 +586,107 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
{
isLoadingData = true;
- // Get the HTML version of the data.
- if ( editor.dataProcessor )
+ var config = editor.config,
+ fullPage = config.fullPage,
+ docType = config.docType;
+
+ // Build the additional stuff to be included into