The new "FCKeditor.ReplaceAllTextareas" function is being introduced,
@@ -52,7 +54,8 @@
Fixed Bugs:
- - [#339] [#681] The SpellerPages
+
- [#339] [#681] The SpellerPages
spell checker will now completely ignore the presence of HTML tags in the text.
Index: editor/_source/classes/fckeditingarea.js
===================================================================
--- editor/_source/classes/fckeditingarea.js (revision 1190)
+++ editor/_source/classes/fckeditingarea.js (working copy)
@@ -57,20 +57,11 @@
if ( this.Mode == FCK_EDITMODE_WYSIWYG )
{
- // Create the editing area IFRAME.
- var oIFrame = this.IFrame = oTargetDocument.createElement( 'iframe' ) ;
-
- // Firefox will render the tables inside the body in Quirks mode if the
- // source of the iframe is set to javascript. see #515
- if ( !FCKBrowserInfo.IsGecko )
- oIFrame.src = 'javascript:void(0)' ;
-
- oIFrame.frameBorder = 0 ;
- oIFrame.width = oIFrame.height = '100%' ;
+ // For FF, document.domain must be set only when different, otherwhise
+ // we'll strangely have "Permission denied" issues.
+ if ( FCK_IS_CUSTOM_DOMAIN )
+ html = '' + html ;
- // Append the new IFRAME to the target.
- eTargetElement.appendChild( oIFrame ) ;
-
// IE has a bug with the tag... it must have a closer,
// otherwise the all successive tags will be set as children nodes of the .
if ( FCKBrowserInfo.IsIE )
@@ -105,6 +96,34 @@
this._BodyHTML = html ; // Invalid HTML input.
}
+ // Create the editing area IFRAME.
+ var oIFrame = this.IFrame = oTargetDocument.createElement( 'iframe' ) ;
+
+ oIFrame.frameBorder = 0 ;
+ oIFrame.width = oIFrame.height = '100%' ;
+
+ if ( FCK_IS_CUSTOM_DOMAIN && FCKBrowserInfo.IsIE )
+ {
+ window._FCKHtmlToLoad = html ;
+ oIFrame.src = 'javascript:void( (function(){' +
+ 'document.open() ;' +
+ 'document.domain="' + document.domain + '" ;' +
+ 'document.write( window.parent._FCKHtmlToLoad );' +
+ 'document.close() ;' +
+ 'window.parent._FCKHtmlToLoad = null ;' +
+ '})() )' ;
+ }
+ else if ( !FCKBrowserInfo.IsGecko )
+ {
+ // Firefox will render the tables inside the body in Quirks mode if the
+ // source of the iframe is set to javascript. see #515
+ oIFrame.src = 'javascript:void(0)' ;
+ }
+
+ // Append the new IFRAME to the target. For IE, it must be done after
+ // setting the "src", to avoid the "secure/unsecure" message under HTTPS.
+ eTargetElement.appendChild( oIFrame ) ;
+
// Get the window and document objects used to interact with the newly created IFRAME.
this.Window = oIFrame.contentWindow ;
@@ -112,11 +131,14 @@
// TODO: This error handler is not being fired.
// this.Window.onerror = function() { alert( 'Error!' ) ; return true ; }
- var oDoc = this.Document = this.Window.document ;
+ if ( !FCK_IS_CUSTOM_DOMAIN || !FCKBrowserInfo.IsIE )
+ {
+ var oDoc = this.Window.document ;
- oDoc.open() ;
- oDoc.write( html ) ;
- oDoc.close() ;
+ oDoc.open() ;
+ oDoc.write( html ) ;
+ oDoc.close() ;
+ }
// Firefox 1.0.x is buggy... ohh yes... so let's do it two times and it
// will magically work.
@@ -126,27 +148,46 @@
return ;
}
- this.Window._FCKEditingArea = this ;
+ if ( oIFrame.readyState && oIFrame.readyState != 'completed' )
+ {
+ var editArea = this ;
+ ( oIFrame.onreadystatechange = function()
+ {
+ if ( oIFrame.readyState == 'complete' )
+ {
+ oIFrame.onreadystatechange = null ;
+ editArea.Window._FCKEditingArea = editArea ;
+ FCKEditingArea_CompleteStart.call( editArea.Window ) ;
+ }
+ // It happened that IE changed the state to "complete" after the
+ // "if" and before the "onreadystatechange" assignement, making we
+ // lost the event call, so we do a manual call just to be sure.
+ } )() ;
+ }
+ else
+ {
+ this.Window._FCKEditingArea = this ;
- // FF 1.0.x is buggy... we must wait a lot to enable editing because
- // sometimes the content simply disappears, for example when pasting
- // "bla1!!bla2" in the source and then switching
- // back to design.
- if ( FCKBrowserInfo.IsGecko10 )
- this.Window.setTimeout( FCKEditingArea_CompleteStart, 500 ) ;
- else
- FCKEditingArea_CompleteStart.call( this.Window ) ;
+ // FF 1.0.x is buggy... we must wait a lot to enable editing because
+ // sometimes the content simply disappears, for example when pasting
+ // "bla1!!bla2" in the source and then switching
+ // back to design.
+ if ( FCKBrowserInfo.IsGecko10 )
+ this.Window.setTimeout( FCKEditingArea_CompleteStart, 500 ) ;
+ else
+ FCKEditingArea_CompleteStart.call( this.Window ) ;
+ }
}
else
{
var eTextarea = this.Textarea = oTargetDocument.createElement( 'textarea' ) ;
eTextarea.className = 'SourceField' ;
eTextarea.dir = 'ltr' ;
- FCKDomTools.SetElementStyles( eTextarea,
- {
- width : '100%',
- height : '100%',
- border : 'none',
+ FCKDomTools.SetElementStyles( eTextarea,
+ {
+ width : '100%',
+ height : '100%',
+ border : 'none',
resize : 'none',
outline : 'none'
} ) ;
@@ -170,7 +211,10 @@
}
var oEditorArea = this._FCKEditingArea ;
-
+
+ // Save this reference to be re-used later.
+ oEditorArea.Document = oEditorArea.Window.document ;
+
oEditorArea.MakeEditable() ;
// Fire the "OnLoad" event.
@@ -214,7 +258,7 @@
// Disable the standard table editing features of Firefox.
oDoc.execCommand( 'enableInlineTableEditing', false, !FCKConfig.DisableFFTableHandles ) ;
}
- catch (e)
+ catch (e)
{
// In Firefox if the iframe is initially hidden it can't be set to designMode and it raises an exception
// So we set up a DOM Mutation event Listener on the HTML, as it will raise several events when the document is visible again
@@ -229,12 +273,12 @@
function FCKEditingArea_Document_AttributeNodeModified( evt )
{
var editingArea = evt.currentTarget.contentWindow._FCKEditingArea ;
-
+
// We want to run our function after the events no longer fire, so we can know that it's a stable situation
if ( editingArea._timer )
window.clearTimeout( editingArea._timer ) ;
- editingArea._timer = FCKTools.SetTimeout( FCKEditingArea_MakeEditableByMutation, 1000, editingArea ) ;
+ editingArea._timer = FCKTools.SetTimeout( FCKEditingArea_MakeEditableByMutation, 1000, editingArea ) ;
}
// This function ideally should be called after the document is visible, it does clean up of the
Index: editor/_source/classes/fckpanel.js
===================================================================
--- editor/_source/classes/fckpanel.js (revision 1190)
+++ editor/_source/classes/fckpanel.js (working copy)
@@ -34,10 +34,20 @@
if ( FCKBrowserInfo.IsIE )
{
+ // This is a trick to IE6 (not IE7). The original domain must be set
+ // before creating the popup, so we are able to take a refence to the
+ // document inside of it, and the set the proper domain for it. (#123)
+ if ( FCK_IS_CUSTOM_DOMAIN )
+ document.domain = FCK_ORIGINAL_DOMAIN ;
+
// Create the Popup that will hold the panel.
this._Popup = this._Window.createPopup() ;
oDocument = this.Document = this._Popup.document ;
+ // Set the proper domain inside the popup.
+ if ( FCK_IS_CUSTOM_DOMAIN )
+ document.domain = oDocument.domain = FCK_RUNTIME_DOMAIN ;
+
FCK.IECleanup.AddItem( this, FCKPanel_Cleanup ) ;
}
else
Index: editor/_source/classes/fckxml_gecko.js
===================================================================
--- editor/_source/classes/fckxml_gecko.js (revision 1190)
+++ editor/_source/classes/fckxml_gecko.js (working copy)
@@ -26,28 +26,43 @@
LoadUrl : function( urlToCall )
{
this.Error = false ;
- var oFCKXml = this ;
+ var oXml ;
var oXmlHttp = FCKTools.CreateXmlObject( 'XmlHttp' ) ;
- oXmlHttp.open( "GET", urlToCall, false ) ;
+ oXmlHttp.open( 'GET', urlToCall, false ) ;
oXmlHttp.send( null ) ;
if ( oXmlHttp.status == 200 || oXmlHttp.status == 304 )
- this.DOMDocument = oXmlHttp.responseXML ;
+ oXml = oXmlHttp.responseXML ;
else if ( oXmlHttp.status == 0 && oXmlHttp.readyState == 4 )
- this.DOMDocument = oXmlHttp.responseXML ;
+ oXml = oXmlHttp.responseXML ;
else
- this.DOMDocument = null ;
+ oXml = null ;
- if ( this.DOMDocument == null || this.DOMDocument.firstChild == null )
+ if ( oXml )
{
+ // Try to access something on it.
+ try
+ {
+ var test = oXml.firstChild ;
+ }
+ catch (e)
+ {
+ // If document.domain has been changed (#123), we'll have a security
+ // error at this point. The workaround here is parsing the responseText:
+ // http://alexander.kirk.at/2006/07/27/firefox-15-xmlhttprequest-reqresponsexml-and-documentdomain/
+ oXml = (new DOMParser()).parseFromString( oXmlHttp.responseText, 'text/xml' ) ;
+ }
+ }
+
+ if ( !oXml || !oXml.firstChild )
+ {
this.Error = true ;
- if (window.confirm( 'Error loading "' + urlToCall + '"\r\nDo you want to see more info?' ) )
- alert( 'URL requested: "' + urlToCall + '"\r\n' +
- 'Server response:\r\nStatus: ' + oXmlHttp.status + '\r\n' +
- 'Response text:\r\n' + oXmlHttp.responseText ) ;
-
+ if ( window.confirm( 'Error loading "' + urlToCall + '" (HTTP Status: ' + oXmlHttp.status + ').\r\nDo you want to see the server response dump?' ) )
+ alert( oXmlHttp.responseText ) ;
}
+
+ this.DOMDocument = oXml ;
},
SelectNodes : function( xpath, contextNode )
@@ -84,4 +99,4 @@
else
return null ;
}
-} ;
\ No newline at end of file
+} ;
Index: editor/_source/internals/fck.js
===================================================================
--- editor/_source/internals/fck.js (revision 1190)
+++ editor/_source/internals/fck.js (working copy)
@@ -558,11 +558,6 @@
Preview : function()
{
- var iWidth = FCKConfig.ScreenWidth * 0.8 ;
- var iHeight = FCKConfig.ScreenHeight * 0.7 ;
- var iLeft = ( FCKConfig.ScreenWidth - iWidth ) / 2 ;
- var oWindow = window.open( '', null, 'toolbar=yes,location=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=' + iWidth + ',height=' + iHeight + ',left=' + iLeft ) ;
-
var sHTML ;
if ( FCKConfig.FullPage )
@@ -586,8 +581,31 @@
'