diff --git a/documentation/changelog.html b/documentation/changelog.html
index 36227ccee8..979040868e 100644
--- a/documentation/changelog.html
+++ b/documentation/changelog.html
@@ -34,7 +34,7 @@
The installation sript: The page about system requilements has been updated. Also, at the very beginning, a check has been added whether the mbstring php-extension is installed - see the related forum topic. (FS#306)
A new php-based configuration for the online editor has been implemented, see dokeos/main/inc/lib/fckeditor/myconfig.php. Also, toolbar definitions have been split in separate php-files within the directory dokeos/main/inc/lib/fckeditor/toolbars/ . Customization of the editor is more convenient and flexible now. (FS#2867)
Online editor: A upgrade from FCKEditor 2.6.4 to FCKEditor 2.6.4.1 has been implemented. (FS#4383)
- Online editor: Several known bug-fixes from FCKEditor 2.6.5 SVN have been implemented, tickets #1537, #2821, #2856, #2915, #3120, #3181, #3429, #3439, #3880. (FS#2867)
+ Online editor: Several known bug-fixes from FCKEditor 2.6.5 SVN have been implemented, tickets #1537, #2156, #2821, #2856, #2915, #3120, #3181, #3429, #3439, #3880. (FS#2867)
Online editor: The simple file manager, the advanced file manager and the image manager have been integrated by default with the editor's dialog system. Thus, they work faster and in a more secure way. (FS#2867)
Online editor: Blocking copy/paste for trainees has been added. The feature is configurable through editing the toolbar definition files within the directory dokeos/main/inc/lib/fckeditor/toolbars/ . (FS#2867)
Online editor: Preview tabs have been added to the dialogs for inserting video, flv-video, and YouTube video. (FS#2867)
diff --git a/main/inc/lib/fckeditor/editor/_source/internals/fckdomtools.js b/main/inc/lib/fckeditor/editor/_source/internals/fckdomtools.js
index 7eaf3bde51..cf11075c5f 100644
--- a/main/inc/lib/fckeditor/editor/_source/internals/fckdomtools.js
+++ b/main/inc/lib/fckeditor/editor/_source/internals/fckdomtools.js
@@ -488,18 +488,46 @@ var FCKDomTools =
for ( var i = 0 ; i < attributes.length ; i++ )
{
- if ( FCKBrowserInfo.IsIE && attributes[i].nodeName == 'class' )
+ if ( FCKBrowserInfo.IsIE )
{
- // IE has a strange bug. If calling removeAttribute('className'),
- // the attributes collection will still contain the "class"
- // attribute, which will be marked as "specified", even if the
- // outerHTML of the element is not displaying the class attribute.
- // Note : I was not able to reproduce it outside the editor,
- // but I've faced it while working on the TC of #1391.
- if ( element.className.length > 0 )
- return true ;
+ var attributeNodeName = attributes[i].nodeName ;
+
+ if ( attributeNodeName.StartsWith( '_fck' ) )
+ {
+ /**
+ * There are places in the FCKeditor code where HTML element objects
+ * get values stored as properties (e.g. _fckxhtmljob). In Internet
+ * Explorer, these are interpreted as attempts to set attributes on
+ * the element.
+ *
+ * http://msdn.microsoft.com/en-us/library/ms533026(VS.85).aspx#Accessing_Element_Pr
+ *
+ * Counting these as HTML attributes cripples
+ * FCK.Style.RemoveFromRange() once FCK.GetData() has been called.
+ *
+ * The above conditional prevents these internal properties being
+ * counted as attributes.
+ *
+ * refs #2156 and #2834
+ */
+
+ continue ;
+ }
+
+ if ( attributeNodeName == 'class' )
+ {
+ // IE has a strange bug. If calling removeAttribute('className'),
+ // the attributes collection will still contain the "class"
+ // attribute, which will be marked as "specified", even if the
+ // outerHTML of the element is not displaying the class attribute.
+ // Note : I was not able to reproduce it outside the editor,
+ // but I've faced it while working on the TC of #1391.
+ if ( element.className.length > 0 )
+ return true ;
+ continue ;
+ }
}
- else if ( attributes[i].specified )
+ if ( attributes[i].specified )
return true ;
}
diff --git a/main/inc/lib/fckeditor/editor/_source/internals/fckxhtml.js b/main/inc/lib/fckeditor/editor/_source/internals/fckxhtml.js
index 130a3a9b9f..480a1e1913 100644
--- a/main/inc/lib/fckeditor/editor/_source/internals/fckxhtml.js
+++ b/main/inc/lib/fckeditor/editor/_source/internals/fckxhtml.js
@@ -56,6 +56,23 @@ FCKXHtml.GetXHTML = function( node, includeNode, format )
else
this._AppendChildNodes( this.MainNode, node, false ) ;
+ /**
+ * FCKXHtml._AppendNode() marks DOM element objects it has
+ * processed by adding a property called _fckxhtmljob,
+ * setting it equal to the value of FCKXHtml.CurrentJobNum.
+ * On Internet Explorer, if an element object has such a
+ * property, it will show up in the object's attributes
+ * NamedNodeMap, and the corresponding Attr object in
+ * that collection will have is specified property set
+ * to true. This trips up code elsewhere that checks to
+ * see if an element is free of attributes before proceeding
+ * with an edit operation (c.f. FCK.Style.RemoveFromRange())
+ *
+ * refs #2156 and #2834
+ */
+ if ( FCKBrowserInfo.IsIE )
+ FCKXHtml._RemoveXHtmlJobProperties( node ) ;
+
// Get the resulting XHTML as a string.
var sXHTML = this._GetMainXmlString() ;
diff --git a/main/inc/lib/fckeditor/editor/_source/internals/fckxhtml_ie.js b/main/inc/lib/fckeditor/editor/_source/internals/fckxhtml_ie.js
index 94f2ef975c..2d23eaecf6 100644
--- a/main/inc/lib/fckeditor/editor/_source/internals/fckxhtml_ie.js
+++ b/main/inc/lib/fckeditor/editor/_source/internals/fckxhtml_ie.js
@@ -92,6 +92,42 @@ FCKXHtml._AppendAttributes = function( xmlNode, htmlNode, node, nodeName )
}
}
+/**
+ * Used to clean up HTML that has been processed FCKXHtml._AppendNode().
+ *
+ * For objects corresponding to HTML elements, Internet Explorer will
+ * treat a property as if it were an attribute set on that element.
+ *
+ * http://msdn.microsoft.com/en-us/library/ms533026(VS.85).aspx#Accessing_Element_Pr
+ *
+ * FCKXHtml._AppendNode() sets the property _fckxhtmljob on node objects
+ * corresponding HTML elements to mark them as having been processed.
+ * Counting these properties as attributes will cripple style removal
+ * because FCK.Styles.RemoveFromSelection() will not remove an element
+ * as long as it still has attributes.
+ *
+ * refs #2156 and #2834
+ */
+
+FCKXHtml._RemoveXHtmlJobProperties = function ( node )
+{
+ // Select only nodes of type ELEMENT_NODE
+ if (!node || !node.nodeType || node.nodeType != 1)
+ return ;
+
+ // Clear the _fckhtmljob attribute.
+ if ( typeof node._fckxhtmljob !== 'undefined' )
+ node.removeAttribute('_fckxhtmljob') ;
+
+ // Recurse upon child nodes.
+ if ( node.hasChildNodes() )
+ {
+ var childNodes = node.childNodes ;
+ for ( var i = childNodes.length - 1 ; i >= 0 ; i-- )
+ FCKXHtml._RemoveXHtmlJobProperties( childNodes.item(i) ) ;
+ }
+}
+
// On very rare cases, IE is loosing the "align" attribute for DIV. (right align and apply bulleted list)
FCKXHtml.TagProcessors['div'] = function( node, htmlNode )
{
diff --git a/main/inc/lib/fckeditor/editor/js/fckeditorcode_gecko.js b/main/inc/lib/fckeditor/editor/js/fckeditorcode_gecko.js
index b63d9c70ec..d43e355d88 100644
--- a/main/inc/lib/fckeditor/editor/js/fckeditorcode_gecko.js
+++ b/main/inc/lib/fckeditor/editor/js/fckeditorcode_gecko.js
@@ -32,7 +32,7 @@ var FCK={Name:FCKURLParams['InstanceName'],Status:0,EditMode:0,Toolbar:null,HasF
FCK.Description="FCKeditor for Gecko Browsers";FCK.InitializeBehaviors=function(){if (window.onresize) window.onresize();FCKFocusManager.AddWindow(this.EditorWindow);this.ExecOnSelectionChange=function(){FCK.Events.FireEvent("OnSelectionChange");};this._ExecDrop=function(evt){if (FCK.MouseDownFlag){FCK.MouseDownFlag=false;return;};if (FCKConfig.ForcePasteAsPlainText){if (evt.dataTransfer){var A=evt.dataTransfer.getData('Text');A=FCKTools.HTMLEncode(A);A=FCKTools.ProcessLineBreaks(window,FCKConfig,A);FCK.InsertHtml(A);}else if (FCKConfig.ShowDropDialog) FCK.PasteAsPlainText();evt.preventDefault();evt.stopPropagation();}};this._ExecCheckCaret=function(evt){if (FCK.EditMode!=0) return;if (evt.type=='keypress'){var B=evt.keyCode;if (B<33||B>40) return;};var C=function(H){if (H.nodeType!=1) return false;var D=H.tagName.toLowerCase();return (FCKListsLib.BlockElements[D]||FCKListsLib.EmptyElements[D]);};var E=function(){var F=FCKSelection.GetSelection();var G=F.getRangeAt(0);if (!G||!G.collapsed) return;var H=G.endContainer;if (H.nodeType!=3) return;if (H.nodeValue.length!=G.endOffset) return;var I=H.parentNode.tagName.toLowerCase();if (!(I=='a'||(!FCKBrowserInfo.IsOpera&&String(H.parentNode.contentEditable)=='false')||(!(FCKListsLib.BlockElements[I]||FCKListsLib.NonEmptyBlockElements[I])&&B==35))) return;var J=FCKTools.GetNextTextNode(H,H.parentNode,C);if (J) return;G=FCK.EditorDocument.createRange();J=FCKTools.GetNextTextNode(H,H.parentNode.parentNode,C);if (J){if (FCKBrowserInfo.IsOpera&&B==37) return;G.setStart(J,0);G.setEnd(J,0);}else{while (H.parentNode&&H.parentNode!=FCK.EditorDocument.body&&H.parentNode!=FCK.EditorDocument.documentElement&&H==H.parentNode.lastChild&&(!FCKListsLib.BlockElements[H.parentNode.tagName.toLowerCase()]&&!FCKListsLib.NonEmptyBlockElements[H.parentNode.tagName.toLowerCase()])) H=H.parentNode;if (FCKListsLib.BlockElements[I]||FCKListsLib.EmptyElements[I]||H==FCK.EditorDocument.body){G.setStart(H,H.childNodes.length);G.setEnd(H,H.childNodes.length);}else{var K=H.nextSibling;while (K){if (K.nodeType!=1){K=K.nextSibling;continue;};var L=K.tagName.toLowerCase();if (FCKListsLib.BlockElements[L]||FCKListsLib.EmptyElements[L]||FCKListsLib.NonEmptyBlockElements[L]) break;K=K.nextSibling;};var M=FCK.EditorDocument.createTextNode('');if (K) H.parentNode.insertBefore(M,K);else H.parentNode.appendChild(M);G.setStart(M,0);G.setEnd(M,0);}};F.removeAllRanges();F.addRange(G);FCK.Events.FireEvent("OnSelectionChange");};setTimeout(E,1);};this.ExecOnSelectionChangeTimer=function(){if (FCK.LastOnChangeTimer) window.clearTimeout(FCK.LastOnChangeTimer);FCK.LastOnChangeTimer=window.setTimeout(FCK.ExecOnSelectionChange,100);};this.EditorDocument.addEventListener('mouseup',this.ExecOnSelectionChange,false);this.EditorDocument.addEventListener('keyup',this.ExecOnSelectionChangeTimer,false);this._DblClickListener=function(e){FCK.OnDoubleClick(e.target);e.stopPropagation();};this.EditorDocument.addEventListener('dblclick',this._DblClickListener,true);this.EditorDocument.addEventListener('keydown',this._KeyDownListener,false);if (FCKBrowserInfo.IsGecko){this.EditorWindow.addEventListener('dragdrop',this._ExecDrop,true);}else if (FCKBrowserInfo.IsSafari){this.EditorDocument.addEventListener('dragover',function (evt){ if (!FCK.MouseDownFlag&&FCK.Config.ForcePasteAsPlainText) evt.returnValue=false;},true);this.EditorDocument.addEventListener('drop',this._ExecDrop,true);this.EditorDocument.addEventListener('mousedown',function(ev){var N=ev.srcElement;if (N.nodeName.IEquals('IMG','HR','INPUT','TEXTAREA','SELECT')){FCKSelection.SelectNode(N);}},true);this.EditorDocument.addEventListener('mouseup',function(ev){if (ev.srcElement.nodeName.IEquals('INPUT','TEXTAREA','SELECT')) ev.preventDefault()},true);this.EditorDocument.addEventListener('click',function(ev){if (ev.srcElement.nodeName.IEquals('INPUT','TEXTAREA','SELECT')) ev.preventDefault()},true);};if (FCKBrowserInfo.IsGecko||FCKBrowserInfo.IsOpera){this.EditorDocument.addEventListener('keypress',this._ExecCheckCaret,false);this.EditorDocument.addEventListener('click',this._ExecCheckCaret,false);};FCK.ContextMenu._InnerContextMenu.SetMouseClickWindow(FCK.EditorWindow);FCK.ContextMenu._InnerContextMenu.AttachToElement(FCK.EditorDocument);};FCK.MakeEditable=function(){this.EditingArea.MakeEditable();};function Document_OnContextMenu(e){if (!e.target._FCKShowContextMenu) e.preventDefault();};document.oncontextmenu=Document_OnContextMenu;FCK._BaseGetNamedCommandState=FCK.GetNamedCommandState;FCK.GetNamedCommandState=function(A){switch (A){case 'Unlink':return FCKSelection.HasAncestorNode('A')?0:-1;default:return FCK._BaseGetNamedCommandState(A);}};FCK.RedirectNamedCommands={Print:true,Paste:true};FCK.ExecuteRedirectedNamedCommand=function(A,B){switch (A){case 'Print':FCK.EditorWindow.print();break;case 'Paste':try{if (FCKBrowserInfo.IsSafari) throw '';if (FCK.Paste()) FCK.ExecuteNamedCommand('Paste',null,true);}catch (e) {if (FCKConfig.ForcePasteAsPlainText) FCK.PasteAsPlainText();else FCKDialog.OpenDialog('FCKDialog_Paste',FCKLang.Paste,'dialog/fck_paste.html',400,330,'Security');};break;default:FCK.ExecuteNamedCommand(A,B);}};FCK._ExecPaste=function(){FCKUndo.SaveUndoStep();if (FCKConfig.ForcePasteAsPlainText){FCK.PasteAsPlainText();return false;};return true;};FCK.InsertHtml=function(A){var B=FCK.EditorDocument,range;A=FCKConfig.ProtectedSource.Protect(A);A=FCK.ProtectEvents(A);A=FCK.ProtectUrls(A);A=FCK.ProtectTags(A);FCKUndo.SaveUndoStep();if (FCKBrowserInfo.IsGecko){A=A.replace(/ $/,'$&');var C=new FCKDocumentFragment(this.EditorDocument);C.AppendHtml(A);var D=C.RootNode.lastChild;range=new FCKDomRange(this.EditorWindow);range.MoveToSelection();var E=C.RootNode.firstChild;while (E&&E.nodeType!=1) E=E.nextSibling;if (E&&FCKListsLib.BlockElements[E.nodeName.toLowerCase()]) range.SplitBlock();range.DeleteContents();range.InsertNode(C.RootNode);range.MoveToPosition(D,4);}else B.execCommand('inserthtml',false,A);this.Focus();if (!range){range=new FCKDomRange(this.EditorWindow);range.MoveToSelection();};var E=range.CreateBookmark();FCKDocumentProcessor.Process(B);try{range.MoveToBookmark(E);range.Select();}catch (e) {};this.Events.FireEvent("OnSelectionChange");};FCK.PasteAsPlainText=function(){FCKTools.RunFunction(FCKDialog.OpenDialog,FCKDialog,['FCKDialog_Paste',FCKLang.PasteAsText,'dialog/fck_paste.html',400,330,'PlainText']);};FCK.GetClipboardHTML=function(){return '';};FCK.CreateLink=function(A,B){var C=[];if (FCKSelection.GetSelection().isCollapsed) return C;FCK.ExecuteNamedCommand('Unlink',null,false,!!B);if (A.length>0){var D='javascript:void(0);/*'+(new Date().getTime())+'*/';FCK.ExecuteNamedCommand('CreateLink',D,false,!!B);var E=this.EditorDocument.evaluate("//a[@href='"+D+"']",this.EditorDocument.body,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);for (var i=0;i0&&!isNaN(E)) this.PageConfig[D]=parseFloat(E);else this.PageConfig[D]=E;}};function FCKConfig_LoadPageConfig(){var A=FCKConfig.PageConfig;for (var B in A) FCKConfig[B]=A[B];};function FCKConfig_PreProcess(){var A=FCKConfig;if (A.AllowQueryStringDebug){try{if ((/fckdebug=true/i).test(window.top.location.search)) A.Debug=true;}catch (e) { }};if (!A.PluginsPath.EndsWith('/')) A.PluginsPath+='/';var B=A.ToolbarComboPreviewCSS;if (!B||B.length==0) A.ToolbarComboPreviewCSS=A.EditorAreaCSS;A.RemoveAttributesArray=(A.RemoveAttributes||'').split(',');if (!FCKConfig.SkinEditorCSS||FCKConfig.SkinEditorCSS.length==0) FCKConfig.SkinEditorCSS=FCKConfig.SkinPath+'fck_editor.css';if (!FCKConfig.SkinDialogCSS||FCKConfig.SkinDialogCSS.length==0) FCKConfig.SkinDialogCSS=FCKConfig.SkinPath+'fck_dialog.css';};FCKConfig.ToolbarSets={};FCKConfig.Plugins={};FCKConfig.Plugins.Items=[];FCKConfig.Plugins.Add=function(A,B,C){FCKConfig.Plugins.Items.push([A,B,C]);};FCKConfig.ProtectedSource={};FCKConfig.ProtectedSource._CodeTag=(new Date()).valueOf();FCKConfig.ProtectedSource.RegexEntries=[//g,/'+A;if (FCKBrowserInfo.IsIE) A=A.replace(/(]*?)\s*\/?>(?!\s*<\/base>)/gi,'$1>');else if (!B){var E=A.match(FCKRegexLib.BeforeBody);var F=A.match(FCKRegexLib.AfterBody);if (E&&F){var G=A.substr(E[1].length,A.length-E[1].length-F[1].length);A=E[1]+' '+F[1];if (FCKBrowserInfo.IsGecko&&(G.length==0||FCKRegexLib.EmptyParagraph.test(G))) G='
';this._BodyHTML=G;}else this._BodyHTML=A;};var H=this.IFrame=D.createElement('iframe');var I='';H.frameBorder=0;H.style.width=H.style.height='100%';if (FCK_IS_CUSTOM_DOMAIN&&FCKBrowserInfo.IsIE){window._FCKHtmlToLoad=A.replace(//i,''+I);H.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){H.src='javascript:void(0)';};C.appendChild(H);this.Window=H.contentWindow;if (!FCK_IS_CUSTOM_DOMAIN||!FCKBrowserInfo.IsIE){var J=this.Window.document;J.open();J.write(A.replace(//i,''+I));J.close();};if (FCKBrowserInfo.IsAIR) FCKAdobeAIR.EditingArea_Start(J,A);if (FCKBrowserInfo.IsGecko10&&!B){this.Start(A,true);return;};if (H.readyState&&H.readyState!='completed'){var K=this;setTimeout(function(){try{K.Window.document.documentElement.doScroll("left");}catch(e){setTimeout(arguments.callee,0);return;};K.Window._FCKEditingArea=K;FCKEditingArea_CompleteStart.call(K.Window);},0);}else{this.Window._FCKEditingArea=this;if (FCKBrowserInfo.IsGecko10) this.Window.setTimeout(FCKEditingArea_CompleteStart,500);else FCKEditingArea_CompleteStart.call(this.Window);}}else{var L=this.Textarea=D.createElement('textarea');L.className='SourceField';L.dir='ltr';FCKDomTools.SetElementStyles(L,{width:'100%',height:'100%',border:'none',resize:'none',outline:'none'});C.appendChild(L);L.value=A;FCKTools.RunFunction(this.OnLoad);}};function FCKEditingArea_CompleteStart(){if (!this.document.body){this.setTimeout(FCKEditingArea_CompleteStart,50);return;};var A=this._FCKEditingArea;A.Document=A.Window.document;A.MakeEditable();FCKTools.RunFunction(A.OnLoad);};FCKEditingArea.prototype.MakeEditable=function(){var A=this.Document;if (FCKBrowserInfo.IsIE){A.body.disabled=true;A.body.contentEditable=true;A.body.removeAttribute("disabled");}else{try{A.body.spellcheck=(this.FFSpellChecker!==false);if (this._BodyHTML){A.body.innerHTML=this._BodyHTML;A.body.offsetLeft;this._BodyHTML=null;};A.designMode='on';A.execCommand('enableObjectResizing',false,!FCKConfig.DisableObjectResizing);A.execCommand('enableInlineTableEditing',false,!FCKConfig.DisableFFTableHandles);}catch (e){FCKTools.AddEventListener(this.Window.frameElement,'DOMAttrModified',FCKEditingArea_Document_AttributeNodeModified);}}};function FCKEditingArea_Document_AttributeNodeModified(A){var B=A.currentTarget.contentWindow._FCKEditingArea;if (B._timer) window.clearTimeout(B._timer);B._timer=FCKTools.SetTimeout(FCKEditingArea_MakeEditableByMutation,1000,B);};function FCKEditingArea_MakeEditableByMutation(){delete this._timer;FCKTools.RemoveEventListener(this.Window.frameElement,'DOMAttrModified',FCKEditingArea_Document_AttributeNodeModified);this.MakeEditable();};FCKEditingArea.prototype.Focus=function(){try{if (this.Mode==0){if (FCKBrowserInfo.IsIE) this._FocusIE();else this.Window.focus();}else{var A=FCKTools.GetElementDocument(this.Textarea);if ((!A.hasFocus||A.hasFocus())&&A.activeElement==this.Textarea) return;this.Textarea.focus();}}catch(e) {}};FCKEditingArea.prototype._FocusIE=function(){this.Document.body.setActive();this.Window.focus();var A=this.Document.selection.createRange();var B=A.parentElement();var C=B.nodeName.toLowerCase();if (B.childNodes.length>0||!(FCKListsLib.BlockElements[C]||FCKListsLib.NonEmptyBlockElements[C])){return;};A=new FCKDomRange(this.Window);A.MoveToElementEditStart(B);A.Select();};function FCKEditingArea_Cleanup(){if (this.Document) this.Document.body.innerHTML="";this.TargetElement=null;this.IFrame=null;this.Document=null;this.Textarea=null;if (this.Window){this.Window._FCKEditingArea=null;this.Window=null;}};