Description

GUI Editor does not work in web-kit based browser, such as google chrome or safari.

GUI Editor in web-kit based browser is currently disabled by 'can_use_gui_editor()' of 'MoinMoin/web/static/htdocs/common/js/common.js'.

If I enable it and save some text in GUI mode (or change to Text mode), I'm got 500 error by ExpatError exception.

Details

MoinMoin Version

1.9.3

Discussion

This is because FCKeditor does not initialize correctly.

While initializing, FCKeditor fires 'OnSelectionChange' event. While processing the event, 'FCKSelection.GetStartNode' and 'FCKSelection.GetEndNode' of 'MoinMoin/web/static/htdocs/applets/moinFCKplugins/selection/fckplugin.js' are invoked and they raise an exception because there is no selection.

By this, initialization step failed and submit handler is not registered. So, if you save text in GUI mode, savedtext is not what you typed, but initial text generated by MoinMoin(like <p class="line874">Line1 <p class="line874">Line2...)

I changed the file and GUI editor seems to work well.

--- fckplugin.js.orig   2012-01-12 12:28:25.000000000 +0900
+++ fckplugin.js        2012-01-11 05:53:35.000000000 +0900
@@ -321,6 +321,7 @@
   FCKSelection.GetStartNode = function()
     {
       var oSelection = FCKSelection.GetSelection();
+      if(oSelection.rangeCount==0) return null;
       // startContainer returns the parent of the first node in the selection
       var oContainer = oSelection.getRangeAt(0).startContainer;
       // The offset within the startContainer where the range starts
@@ -343,6 +344,7 @@
   FCKSelection.GetEndNode = function()
   {
     var oSelection = FCKSelection.GetSelection();
+    if(oSelection.rangeCount==0) return null;
     var oContainer = oSelection.getRangeAt(0).endContainer;
     var iOffset = oSelection.getRangeAt(0).startEndset;

/!\ How is this fix related to the issue described in this bug report? Even if this fixes loading into fckeditor within chrome, you still have the problem that it doesn't sanitize the html to xhtml before posting it back to moin, so it still crashes (500) likely for any non-trivial page.

Exception message while initializing fckeditor in chrome.

error.png

Exception message after removing try-catch from FCKEvents.FireEvent.

error_detail.png

Plan

Note: Testing feedback on this is very welcome, please give browser version, OS, and whether GUI editing (and saving) the WikiSandBox default content worked successfully.


CategoryMoinMoinBugFixed

MoinMoin: MoinMoinBugs/1.9.3GUIEditorInWebKit (last edited 2015-10-18 21:25:25 by 2601:0:904:11b0:c516:a305:c117:1519)