Index: lams_central/web/fckeditor/editor/_source/commandclasses/fck_othercommands.js
===================================================================
diff -u -rec7cf4ccd30c2f44920a59691c6055f714e5e36c -re7bc7c1b21c5e95239af85cf7d5e5ab01b18e279
--- lams_central/web/fckeditor/editor/_source/commandclasses/fck_othercommands.js (.../fck_othercommands.js) (revision ec7cf4ccd30c2f44920a59691c6055f714e5e36c)
+++ lams_central/web/fckeditor/editor/_source/commandclasses/fck_othercommands.js (.../fck_othercommands.js) (revision e7bc7c1b21c5e95239af85cf7d5e5ab01b18e279)
@@ -149,6 +149,13 @@
// Get the linked field form.
var oForm = FCK.LinkedField.form ;
+ if ( typeof( oForm.onsubmit ) == 'function' )
+ {
+ var bRet = oForm.onsubmit() ;
+ if ( bRet != null && bRet === false )
+ return ;
+ }
+
// Submit the form.
oForm.submit() ;
}
@@ -167,7 +174,9 @@
FCKNewPageCommand.prototype.Execute = function()
{
FCKUndo.SaveUndoStep() ;
- FCK.SetHTML( FCKBrowserInfo.IsGecko ? ' ' : '' ) ;
+ FCK.SetHTML( '' ) ;
+// FCK.SetHTML( FCKBrowserInfo.IsGecko ? ' ' : '' ) ;
+// FCK.SetHTML( FCKBrowserInfo.IsGecko ? '
' : '' ) ;
}
FCKNewPageCommand.prototype.GetState = function()
@@ -183,7 +192,14 @@
FCKSourceCommand.prototype.Execute = function()
{
- FCK.SwitchEditMode() ;
+ if ( FCKBrowserInfo.IsGecko )
+ {
+ var iWidth = screen.width * 0.65 ;
+ var iHeight = screen.height * 0.65 ;
+ FCKDialog.OpenDialog( 'FCKDialog_Source', FCKLang.Source, 'dialog/fck_source.html', iWidth, iHeight, null, null, true ) ;
+ }
+ else
+ FCK.SwitchEditMode() ;
}
FCKSourceCommand.prototype.GetState = function()
@@ -208,7 +224,7 @@
FCKUndoCommand.prototype.GetState = function()
{
if ( FCKBrowserInfo.IsIE )
- return ( FCKUndo.CurrentIndex > 0 ? FCK_TRISTATE_OFF : FCK_TRISTATE_DISABLED ) ;
+ return ( FCKUndo.Typing || FCKUndo.CurrentIndex > 0 ? FCK_TRISTATE_OFF : FCK_TRISTATE_DISABLED ) ;
else
return FCK.GetNamedCommandState( 'Undo' ) ;
}
@@ -230,7 +246,7 @@
FCKRedoCommand.prototype.GetState = function()
{
if ( FCKBrowserInfo.IsIE )
- return ( FCKUndo.CurrentIndex < ( FCKUndo.SavedData.length - 1 ) ? FCK_TRISTATE_OFF : FCK_TRISTATE_DISABLED ) ;
+ return ( !FCKUndo.Typing && FCKUndo.CurrentIndex < ( FCKUndo.SavedData.length - 1 ) ? FCK_TRISTATE_OFF : FCK_TRISTATE_DISABLED ) ;
else
return FCK.GetNamedCommandState( 'Redo' ) ;
}
\ No newline at end of file
Index: lams_central/web/fckeditor/editor/_source/commandclasses/fckpastewordcommand.js
===================================================================
diff -u -rec7cf4ccd30c2f44920a59691c6055f714e5e36c -re7bc7c1b21c5e95239af85cf7d5e5ab01b18e279
--- lams_central/web/fckeditor/editor/_source/commandclasses/fckpastewordcommand.js (.../fckpastewordcommand.js) (revision ec7cf4ccd30c2f44920a59691c6055f714e5e36c)
+++ lams_central/web/fckeditor/editor/_source/commandclasses/fckpastewordcommand.js (.../fckpastewordcommand.js) (revision e7bc7c1b21c5e95239af85cf7d5e5ab01b18e279)
@@ -27,5 +27,8 @@
FCKPasteWordCommand.prototype.GetState = function()
{
- return FCK.GetNamedCommandState( 'Paste' ) ;
+ if ( FCKConfig.ForcePasteAsPlainText )
+ return FCK_TRISTATE_DISABLED ;
+ else
+ return FCK.GetNamedCommandState( 'Paste' ) ;
}
Index: lams_central/web/fckeditor/editor/_source/commandclasses/fcktablecommand.js
===================================================================
diff -u -rec7cf4ccd30c2f44920a59691c6055f714e5e36c -re7bc7c1b21c5e95239af85cf7d5e5ab01b18e279
--- lams_central/web/fckeditor/editor/_source/commandclasses/fcktablecommand.js (.../fcktablecommand.js) (revision ec7cf4ccd30c2f44920a59691c6055f714e5e36c)
+++ lams_central/web/fckeditor/editor/_source/commandclasses/fcktablecommand.js (.../fcktablecommand.js) (revision e7bc7c1b21c5e95239af85cf7d5e5ab01b18e279)
@@ -23,6 +23,8 @@
FCKTableCommand.prototype.Execute = function()
{
+ FCKUndo.SaveUndoStep() ;
+
switch ( this.Name )
{
case 'TableInsertRow' :
Index: lams_central/web/fckeditor/editor/_source/globals/fckeditorapi.js
===================================================================
diff -u -rec7cf4ccd30c2f44920a59691c6055f714e5e36c -re7bc7c1b21c5e95239af85cf7d5e5ab01b18e279
--- lams_central/web/fckeditor/editor/_source/globals/fckeditorapi.js (.../fckeditorapi.js) (revision ec7cf4ccd30c2f44920a59691c6055f714e5e36c)
+++ lams_central/web/fckeditor/editor/_source/globals/fckeditorapi.js (.../fckeditorapi.js) (revision e7bc7c1b21c5e95239af85cf7d5e5ab01b18e279)
@@ -30,7 +30,7 @@
FCKeditorAPI.__Instances = new Object() ;
// Set the current version.
- FCKeditorAPI.Version = '2.0 FC' ;
+ FCKeditorAPI.Version = '2.0' ;
// Function used to get a instance of an existing editor present in the
// page.
Index: lams_central/web/fckeditor/editor/_source/internals/fck.js
===================================================================
diff -u -rec7cf4ccd30c2f44920a59691c6055f714e5e36c -re7bc7c1b21c5e95239af85cf7d5e5ab01b18e279
--- lams_central/web/fckeditor/editor/_source/internals/fck.js (.../fck.js) (revision ec7cf4ccd30c2f44920a59691c6055f714e5e36c)
+++ lams_central/web/fckeditor/editor/_source/internals/fck.js (.../fck.js) (revision e7bc7c1b21c5e95239af85cf7d5e5ab01b18e279)
@@ -23,9 +23,39 @@
FCK.Status = FCK_STATUS_NOTLOADED ;
FCK.EditMode = FCK_EDITMODE_WYSIWYG ;
-// First try to get the Linked field using its ID.
-FCK.LinkedField = window.parent.document.getElementById( FCK.Name ) ;
+// There is a bug on IE... getElementById returns any META tag that has the
+// name set to the ID you are looking for. So the best way in to get the array
+// by names and look for the correct one.
-// If no linked field is available with that ID, try with the "Name".
-if ( !FCK.LinkedField )
- FCK.LinkedField = window.parent.document.getElementsByName( FCK.Name )[0] ;
+var aElements = window.parent.document.getElementsByName( FCK.Name ) ;
+var i = 0;
+while ( FCK.LinkedField = aElements[i++] )
+{
+ if ( FCK.LinkedField.tagName == 'INPUT' || FCK.LinkedField.tagName == 'TEXTAREA' )
+ break ;
+}
+
+var FCKTempBin = new Object() ;
+FCKTempBin.Elements = new Array() ;
+
+FCKTempBin.AddElement = function( element )
+{
+ var iIndex = FCKTempBin.Elements.length ;
+ FCKTempBin.Elements[ iIndex ] = element ;
+ return iIndex ;
+}
+
+FCKTempBin.RemoveElement = function( index )
+{
+ var e = FCKTempBin.Elements[ index ] ;
+ FCKTempBin.Elements[ index ] = null ;
+ return e ;
+}
+
+FCKTempBin.Reset = function()
+{
+ var i = 0 ;
+ while ( i < FCKTempBin.Elements.length )
+ FCKTempBin.Elements[ i++ ] == null ;
+ FCKTempBin.Elements.length = 0 ;
+}
\ No newline at end of file
Index: lams_central/web/fckeditor/editor/_source/internals/fck_1.js
===================================================================
diff -u -rec7cf4ccd30c2f44920a59691c6055f714e5e36c -re7bc7c1b21c5e95239af85cf7d5e5ab01b18e279
--- lams_central/web/fckeditor/editor/_source/internals/fck_1.js (.../fck_1.js) (revision ec7cf4ccd30c2f44920a59691c6055f714e5e36c)
+++ lams_central/web/fckeditor/editor/_source/internals/fck_1.js (.../fck_1.js) (revision e7bc7c1b21c5e95239af85cf7d5e5ab01b18e279)
@@ -31,8 +31,8 @@
// The Base Path of the editor is saved to rebuild relative URL (IE issue).
// this.BaseUrl = this.EditorDocument.location.protocol + '//' + this.EditorDocument.location.host ;
-// if ( FCKBrowserInfo.IsGecko )
-// this.MakeEditable() ;
+ if ( FCKBrowserInfo.IsGecko )
+ this.MakeEditable() ;
// Set the editor's startup contents
this.SetHTML( FCKTools.GetLinkedFieldValue() ) ;
@@ -163,7 +163,12 @@
if ( FCKConfig.FullPage )
var sXHTML = FCKXHtml.GetXHTML( this.EditorDocument.getElementsByTagName( 'html' )[0], true, format ) ;
else
- var sXHTML = FCKXHtml.GetXHTML( this.EditorDocument.body, false, format ) ;
+ {
+ if ( FCKConfig.IgnoreEmptyParagraphValue && this.EditorDocument.body.innerHTML == '
' ) + var sXHTML = '' ; + else + var sXHTML = FCKXHtml.GetXHTML( this.EditorDocument.body, false, format ) ; + } if ( bSource ) this.SwitchEditMode() ; @@ -211,3 +216,109 @@ { FCK.RegisteredDoubleClickHandlers[ tag.toUpperCase() ] = handlerFunction ; } + +FCK.OnAfterSetHTML = function() +{ + var oProcessor, i = 0 ; + while( oProcessor = FCKDocumentProcessors[i++] ) + oProcessor.ProcessDocument( FCK.EditorDocument ) ; + + this.Events.FireEvent( 'OnAfterSetHTML' ) ; +} + +// Advanced document processors. + +var FCKDocumentProcessors = new Array() ; + +var FCKDocumentProcessors_CreateFakeImage = function( fakeClass, realElement ) +{ + var oImg = FCK.EditorDocument.createElement( 'IMG' ) ; + oImg.className = fakeClass ; + oImg.src = FCKConfig.FullBasePath + 'images/spacer.gif' ; + oImg.setAttribute( '_fckfakelement', 'true', 0 ) ; + oImg.setAttribute( '_fckrealelement', FCKTempBin.AddElement( realElement ), 0 ) ; + return oImg ; +} + +// Link Anchors +var FCKAnchorsProcessor = new Object() ; +FCKAnchorsProcessor.ProcessDocument = function( document ) +{ + var aLinks = document.getElementsByTagName( 'A' ) ; + + var oLink ; + var i = aLinks.length - 1 ; + while ( i >= 0 && ( oLink = aLinks[i--] ) ) + { + // If it is anchor. + if ( oLink.name.length > 0 && ( !oLink.getAttribute('href') || oLink.getAttribute('href').length == 0 ) ) + { + var oImg = FCKDocumentProcessors_CreateFakeImage( 'FCK__Anchor', oLink.cloneNode(true) ) ; + oImg.setAttribute( '_fckanchor', 'true', 0 ) ; + + oLink.parentNode.insertBefore( oImg, oLink ) ; + oLink.parentNode.removeChild( oLink ) ; + } + } +} + +FCKDocumentProcessors.addItem( FCKAnchorsProcessor ) ; + +// Flash Embeds. +var FCKFlashProcessor = new Object() ; +FCKFlashProcessor.ProcessDocument = function( document ) +{ + /* + Sample code: + This is some sample text. You are using FCKeditor. + */ + + var aEmbeds = document.getElementsByTagName( 'EMBED' ) ; + + var oEmbed ; + var i = aEmbeds.length - 1 ; + while ( i >= 0 && ( oEmbed = aEmbeds[i--] ) ) + { + if ( oEmbed.src.endsWith( '.swf', true ) ) + { + var oImg = FCKDocumentProcessors_CreateFakeImage( 'FCK__Flash', oEmbed.cloneNode(true) ) ; + oImg.setAttribute( '_fckflash', 'true', 0 ) ; + + FCKFlashProcessor.RefreshView( oImg, oEmbed ) ; + + oEmbed.parentNode.insertBefore( oImg, oEmbed ) ; + oEmbed.parentNode.removeChild( oEmbed ) ; + +// oEmbed.setAttribute( '_fckdelete', 'true', 0) ; +// oEmbed.style.display = 'none' ; +// oEmbed.hidden = true ; + } + } +} + +FCKFlashProcessor.RefreshView = function( placholderImage, originalEmbed ) +{ + if ( originalEmbed.width > 0 ) + placholderImage.style.width = FCKTools.ConvertHtmlSizeToStyle( originalEmbed.width ) ; + + if ( originalEmbed.height > 0 ) + placholderImage.style.height = FCKTools.ConvertHtmlSizeToStyle( originalEmbed.height ) ; +} + +FCKDocumentProcessors.addItem( FCKFlashProcessor ) ; + +FCK.GetRealElement = function( fakeElement ) +{ + var e = FCKTempBin.Elements[ fakeElement.getAttribute('_fckrealelement') ] ; + + if ( fakeElement.getAttribute('_fckflash') ) + { + if ( fakeElement.style.width.length > 0 ) + e.width = FCKTools.ConvertStyleSizeToHtml( fakeElement.style.width ) ; + + if ( fakeElement.style.height.length > 0 ) + e.height = FCKTools.ConvertStyleSizeToHtml( fakeElement.style.height ) ; + } + + return e ; +} \ No newline at end of file Index: lams_central/web/fckeditor/editor/_source/internals/fck_1_gecko.js =================================================================== diff -u -rec7cf4ccd30c2f44920a59691c6055f714e5e36c -re7bc7c1b21c5e95239af85cf7d5e5ab01b18e279 --- lams_central/web/fckeditor/editor/_source/internals/fck_1_gecko.js (.../fck_1_gecko.js) (revision ec7cf4ccd30c2f44920a59691c6055f714e5e36c) +++ lams_central/web/fckeditor/editor/_source/internals/fck_1_gecko.js (.../fck_1_gecko.js) (revision e7bc7c1b21c5e95239af85cf7d5e5ab01b18e279) @@ -21,6 +21,13 @@ FCK.InitializeBehaviors = function() { + // Enable table borders visibility. + if ( FCKConfig.ShowBorders ) + { + var oStyle = FCKTools.AppendStyleSheet( this.EditorDocument, FCKConfig.FullBasePath + 'css/fck_showtableborders_gecko.css' ) ; + oStyle.setAttribute( '_fcktemp', 'true' ) ; + } + // Disable Right-Click var oOnContextMenu = function( e ) { @@ -29,32 +36,23 @@ } this.EditorDocument.addEventListener( 'contextmenu', oOnContextMenu, true ) ; - /* - TODO: - This is not working... on Gecko there is no "OnPaste" event that - can prevent the user to paste. - I've tried with the OnKeyDown event for the "CTRL-V" key "down", but the - paste still occours (preventDefault does nothing in this case). - + // Handle pasting operations. var oOnKeyDown = function( e ) { if ( e.ctrlKey && !e.shiftKey && !e.altKey ) { // Char 86/118 = V/v if ( e.which == 86 || e.which == 118 ) { - if ( FCK.Status == FCK_STATUS_COMPLETE ) + if ( FCK.Status != FCK_STATUS_COMPLETE || !FCK.Events.FireEvent( "OnPaste" ) ) { - if ( !FCK.Events.FireEvent( "OnPaste" ) ) - e.preventDefault() ; - } - else e.preventDefault() ; + e.stopPropagation() ; + } } } } - this.EditorDocument.addEventListener( 'keydown', oOnKeyDown, true ) ; - */ + this.EditorDocument.addEventListener( 'keypress', oOnKeyDown, true ) ; this.ExecOnSelectionChange = function() { @@ -161,7 +159,7 @@ this._Initialized = true ; } - + this.EditorDocument.open() ; this.EditorDocument.write( sHtml ) ; this.EditorDocument.close() ; @@ -187,38 +185,43 @@ sHtml += '