New Foswiki release 2.1.6 is available with important security fixes.
Sourceforge foswiki email lists being discontinued. Subscribe to the new Foswiki announce and discuss lists at MailingLists

Item8178: WikiText doesn't work in NAT skin for latest version of TinyMCEPlugin

Priority: Urgent
Current State: Closed
Released In:
Target Release: n/a
Applies To: Extension
Component: TinyMCEPlugin, NatEditPlugin
Reported By: Foswiki:Main.TjMaciak
Waiting For:
Last Change By: MichaelDaum
-- TjMaciak - 10 Jun 2009

I should point out that the outcome of clicking on the WikiText button is that the edit topic is displayed as HTML

-- TjMaciak - 10 Jun 2009

WikiText functionality is broken for NAT skin (works with pattern skin) in:

This site is running Foswiki version Foswiki-1.0.5, Sat, 25 Apr 2009, build 3705, Plugin API version 2.0 WysiwygPlugin (03 Aug 2008, $Rev: 4051 (2009-06-06) $) TinyMCEPlugin (21 Jan 2009, $Rev: 4050 (2009-06-06) $) NatSkinPlugin (3.00-pre36, $Rev: 1995 (15 Jan 2009) $)

Javascript Error: TJCRI> document.getElementById("foswikiTinyMcePluginWysiwygEditHelp") is null [Break on this error] return;el.onclick=function(){var editor=...i];text=cb.apply(editor,[editor,text]);} document.getElementById("foswikiTinyMcePluginWysiwygEditHelp") is null foswiki/pub/System/TinyMCEPlugin/foswiki_tiny.js?v=%24Rev:%204050%20%282009-06-06%29%20%24 Line 10

No other reported errors in apache or foswiki logs.

This functionality (as the Axe icon) was working when I had the following versions of Wysiwyg Plugin:

WysiwygPlugin (03 Aug 2008, $Rev: 3509 (2009-04-18) $): TinyMCEPlugin (21 Jan 2009, $Rev: 3236 (2009-03-21) $)

If you need more clarification you can contact me on #foswiki as TJCRI

I resolved the "element is null" problem. (I also changed the "summary" and "component" this issue applies to. This problem is related to TinyMCEPlugin, not to WysiwygPlugin.)

TJCRI then reported that when you click on save or cancel, the browser just jumps to the top of the page. It does not save or cancel. I was able to reproduce this, as follows:
Sequence Comment
Edit -> Wikitext -> Save-and-continue -> Wikitext -> Save This makes the browser jump to the top of the page, still in wikitext edit mode.
Edit -> Wikitext -> Save This reloads the TMCE edit mode. It should go back to "topic view".

I don't understand why this happens.

My configuration is:

I noted that NatEditPlugin bypasses the default form-submit processing. This interferes with anything that uses an onsubmit handler.
  1. The validation breaks, because foswikiStrikeOne is called via onsubmit. Every save from NatEdit generates a "suspicious request from browser" warning.
  2. If you click "save" whilst in TMCE's wikitext mode, the changes made since selecting wikitext mode are lost. This is because foswiki_tiny.js uses an onsubmit handler to prevent TMCE from destroying the changes made since selecting wikitext mode. I see this behaviour with JQueryPlugin 0.80, from

I also noted that TinyMCEPlugin does not work at all with NatSkin (rev 1994). I get an almost-empty page when I click edit. The only visible content is a grey horizontal line.

I think that NatEditPlugin must be changed to support foswikiStrikeOne, but I do not know what else is wrong. I cannot say for sure that there is nothing wrong with TinyMCEPlugin, either, because I do not know how editor plugins are supposed to interact.

-- MichaelTempest - 16 Jun 2009

I added this problem to KnownIssuesOfFoswiki01x00. Please update that page when the NatSkin-related problems are fixed, to indicate that new version(s) of the various components are available.

-- MichaelTempest - 01 Jul 2009

Fixed in Item8189.

-- MichaelDaum - 02 Jul 2009

I'm silently losing edits on save from NatEdit when invoked from WYSIWYG, in 1.0.6 with the trunk version of NatSkin, NatEdit, and TinyMCEPlugin. A few people on IRC (MichaelTempest w/FF3.5.2 & IE8 included) are also reporting that this is still a problem.

Tested on Firefox (Iceweasel) 1.0.6 and Opera 9.64.

Confirmed on an up-to-date trunk installation (rev4728) with Iceweasel.

I'm exploring with FireBug...

NB: For what it's worth, I fixed my local copy of as per Item1985, but it made no difference...

NB2: Wireshark confirms there's no hits to tml2html here... the brief flash of HTML in the NatEdit textarea is an artifact of some JS shenanigans. The NatEdit #topic/#savearea value just isn't making it to the POST...

-- PaulHarvey - 31 Aug 2009

System/TinyMCEPlugin/foswiki_tiny_src.js line 196
        this.onSubmitHandler = function(ed, e) {
            // SMELL: Editor.initialized is undocumented and liable
            // to break when we upgrade TMCE
            editor.initialized = false;

This is the best I can come up with... TMCE save is happening even though editor.initialized = false.

-- PaulHarvey - 01 Sep 2009

So, having learnt much more about JavaScript, I'm in a better position to debug this... onSubmitHandler above is never being called. Setting editor.initialized = false just before editForm.submit() in NatEdit/edit.js allows us to save from NatEdit smile

Update: I think the patch (attached) is the most reasonable way to fix this.

Before we commit...
  • I'm not sure I've used a cross-browser compatible way of checking if the tinyMCE object exists. Maybe there's a better a way of doing this.
  • Need to test that this solution works in all the major browsers, with both TinyMCEPlugin present and disabled

Have fun smile

-- PaulHarvey - 11 Sep 2009

Main.MichaelTempest reported on IRC works for me on IE8, Opera 10 and FF 3.52

-- PaulHarvey - 13 Sep 2009

Raised this to urgent because it is such a small fix that will make a world of difference, hopefully we can have this committed for 1.0.7 release?

Tested successfully on the following browsers today:

  • IE 6.0.2900.5512.xpsp_sp3_gdr.090206-1234 (XP)
  • Firefox (Iceweasel) 3.0.12 (Linux)
  • Firefox 3.5.3 (XP)
  • Opera 10.00 (Linux)
  • Chrome (XP)
  • Epiphany 2.22.3 (Linux)
  • Safari 4.0.3 (XP)

-- PaulHarvey - 14 Sep 2009

Gr8. This was bugging me for a long time. Released new version.

-- MichaelDaum - 14 Sep 2009

ItemTemplate edit

Summary WikiText doesn't work in NAT skin for latest version of TinyMCEPlugin
ReportedBy Foswiki:Main.TjMaciak
Codebase 1.0.6, 1.0.5, trunk
SVN Range Foswiki-1.0.0, Thu, 08 Jan 2009, build 1878
AppliesTo Extension
Component TinyMCEPlugin, NatEditPlugin
Priority Urgent
CurrentState Closed
Checkins distro:2be5bba5894f distro:92bf8efa8942 distro:72ffbc68c121 distro:0b09fd7da359 distro:1e4d68d71f27
TargetRelease n/a
Topic attachments
I Attachment Action Size Date Who Comment
NatEditPlugin_fix_save_with_tinymce.diffdiff NatEditPlugin_fix_save_with_tinymce.diff manage 3 K 12 Sep 2009 - 05:34 PaulHarvey 3rd rev of this patch. Used more robust JS syntax in if(conditional).
Topic revision: r21 - 14 Sep 2009, MichaelDaum - This page was cached on 20 Sep 2018 - 19:50.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy