Opened 17 years ago
Closed 17 years ago
#1151 closed Bug (fixed)
FCKeditor not compatible with wikitex extension in mediawiki
Reported by: | x-rayman | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | Project : MediaWiki+FCKeditor | Version: | SVN (FCKeditor) - Retired |
Keywords: | Cc: |
Description
Basically when using both fckeditor extension with the wikitex extension in mediawiki (tested on 1.10) FCKeditor changes the code in the wikitex feeds making them unusable.
You can normally post once but on the second edit FCK edits out the special characters For example you would post:
<amsmath>\sideset{}{'}\sum_{n<k,\;\text{$n$ odd}} nE_n</amsmath>
And that would make the correct equation in mediawiki however if you did edit again or even if the previous option had been used to do a preview when you went to save the wikitex extension would fail because fckedit had changed the characters to:
<amsmath>\sideset{}{'}\sum_{n&lt;k,\;\text{$n$ odd}} nE_n</amsmath>
Before and working:<amsmath>\sideset{}{'}\sum_{n<k,\;\text{$n$ odd}} nE_n</amsmath> After and broken: <amsmath>\sideset{}{'}\sum_{n&lt;k,\;\text{$n$ odd}} nE_n</amsmath>
If you try to use the math tool in fckeditor it incorrectly encases the code in the <math> brackets which also prevents it from rendering.
I think what is needed is for fckeditor to ignore the code inside the special wikitex braces? I've tried this using: wikitex 1.05 FCKeditor version 2.5 SVN Build 16068 MediaWiki: 1.10.1 PHP: 5.1.6 (apache2handler) MySQL: 5.0.27
Known parser extension tags: <abc>, <amsmath>, <batik>, <chem>, <chess>, <circo>, <fdp>, <feyn>, <go>, <greek>, <graph>, <ling>, <music>, <neato>, <plot>, <ppch>, <schem>, <svg>, <teng>, <tipa>, <twopi> and <pre>
Change History (5)
comment:1 Changed 17 years ago by
comment:2 Changed 17 years ago by
I'm slightly confused the contents of fckplugins.js are as follows:
var FCKPlugins = FCK.Plugins = new Object() ; FCKPlugins.ItemsCount = 0 ; FCKPlugins.Items = new Object() ; FCKPlugins.Load = function() { var oItems = FCKPlugins.Items ; // build the plugins collection. for ( var i = 0 ; i < FCKConfig.Plugins.Items.length ; i++ ) { var oItem = FCKConfig.Plugins.Items[i] ; var oPlugin = oItems[ oItem[0] ] = new FCKPlugin( oItem[0], oItem[1], oItem[2] ) ; FCKPlugins.ItemsCount++ ; } // Load all items in the plugins collection. for ( var s in oItems ) oItems[s].Load() ; // This is a self destroyable function (must be called once). FCKPlugins.Load = null ; }
So there is no where to edit the line
case 'fck_mw_template' :
However, fckplugin.js does have the above line but changing it makes no difference.
An interesting note:
Every time you save the page with the broken tex in FCKeditor alters it: So, virgin and working
<amsmath>\sideset{}{'}\sum_{n<k,\;\text{$n$ odd}} nE_n</amsmath>
1st re-edit:
<amsmath>\sideset{}{'}\sum_{n&lt;k,\;\text{$n$ odd}} nE_n</amsmath>
2nd re-edit:
<amsmath>\sideset{}{'}\sum_{n&amp;lt;k,\;\text{$n$ odd}} nE_n</amsmath>
3rd re-edit:
<amsmath>\sideset{}{'}\sum_{n&amp;amp;lt;k,\;\text{$n$ odd}} nE_n</amsmath>
The above are the result of clicking on wikitext to see the real code. Every time you click between viewing the real code (the only way to paste in your tex statement and get it to work) and the FCKeditor generated page so every press of the wikitext button it adds
amp;
as well!
Sorry thanks for trying.
comment:3 Changed 17 years ago by
The real fckplugins.js is in "extensions/FCKeditor/plugins/mediawiki".
Above code is actually to correct this issue for templates, not special tags. For special tags, replace the "case 3" switch for text nodes by:
var parentIsSpecialTag = htmlNode.parentNode.getAttribute( '_fck_mw_customtag' ) ; var textValue = htmlNode.nodeValue; if ( !parentIsSpecialTag ) //YC { textValue = textValue.replace( /[\n\t]/g, ' ' ) ; textValue = FCKTools.HTMLEncode( textValue ) ; textValue = textValue.replace( /\u00A0/g, ' ' ) ; if ( !htmlNode.previousSibling || ( stringBuilder.length > 0 && stringBuilder[ stringBuilder.length - 1 ].EndsWith( '\n' ) ) ) { textValue = textValue.LTrim() ; } if ( !htmlNode.nextSibling ) textValue = textValue.RTrim() ; textValue = textValue.replace( / {2,}/g, ' ' ) ; if ( this._IsInsideCell ) textValue = textValue.replace( /\|/g, '|' ) ; } else { textValue = FCKTools.HTMLDecode( textValue ) ; } stringBuilder.push( textValue ) ; return ;
comment:4 Changed 17 years ago by
Excellent!
That did the trick. However on my install the file you pointed to is called fckplugin.js NOT fckplugins.js
fckplugins.js is located in /extensions/FCKeditor/fckeditor/editor/_source/internals/
find -name "fckplugin*.js" ./extensions/FCKeditor/fckeditor/editor/plugins/tablecommands/fckplugin.js ./extensions/FCKeditor/fckeditor/editor/plugins/autogrow/fckplugin.js ./extensions/FCKeditor/fckeditor/editor/plugins/dragresizetable/fckplugin.js ./extensions/FCKeditor/fckeditor/editor/plugins/simplecommands/fckplugin.js ./extensions/FCKeditor/fckeditor/editor/plugins/bbcode/fckplugin.js ./extensions/FCKeditor/fckeditor/editor/plugins/placeholder/fckplugin.js ./extensions/FCKeditor/fckeditor/editor/_source/classes/fckplugin.js ./extensions/FCKeditor/fckeditor/editor/_source/internals/fckplugins.js ./extensions/FCKeditor/plugins/mediawiki/fckplugin.js
Editing /extensions/FCKeditor/plugins/mediawiki/fckplugin.js with the comments you made above sorted it good and proper.
Cheers
comment:5 Changed 17 years ago by
Keywords: | wikitex parser wiki mediawiki editing removed |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Once again I would like to thank you ycombarnous for a great patch.
This proposal has been applied with [954].
This can be solved by changing fckplugins.js from
To: