You are here: Foswiki>Tasks Web>Item5635 (16 Nov 2009, MichaelDaum)Edit Attach

Item5635: Edit Chapter Save with WYSIWYG Editor displayed deletes entire contents of topic

Priority: Enhancement
Current State: Closed
Released In:
Target Release: n/a
Applies To: Extension
Component: EditChapterPlugin
Reported By: TWiki:Main.JoeMarandola
Waiting For:
Last Change By: MichaelDaum
This is related to Bug 5355: WYSIWYG Editor Appearing with raw text during Chapter Edit

When you save with the WYSIWYG Editor appearing, the entire contents of the topic are cleared.

If you remove the WYSIWYG Editor before save (selecting pick icon), then the edit works correctly.

-- TWiki:Main/JoeMarandola - 15 May 2008

This bugs requires running with EditChapterPlugin so I will lower the priority to Normal. I will not let an interaction with EditChapterPlugin be a 4.2.1 release blocker.

-- TWiki:Main.KennethLavrsen - 16 May 2008

As described in the EditChapterPlugin documentation, it doesn't work with WysiwygPlugin. I see that as an issue in the EditChapterPlugin. Regrading to enhancement and assigning to EditChapterPlugin.

-- CrawfordCurrie - 04 Aug 2008

Some more background information: while only a part of the topic is edited, EditChapterPlugin always saves a complete topic. It does so by storing the part before and after the chapter to be edited in hidden textareas. The content of these two and the current editable textareas are recombined when the form is submitted. The combined content is stored into another hidden textarea called text which then is submitted to save. Problems arise when the text textarea is submitted without being initialized correctly. As it is empty initially, an empty text area is submitted to save and it deletes the entire content.

For similar reasons switching to wiki text and then clicking on save causes problems.

-- MichaelDaum - 02 Jul 2009

From: Thomas Zobel []
Sent: Thursday, 26 March 2009 9:07 PM
Cc: Heiko Ihrig
Subject: Re: [Foswiki-discuss] EditChapterPlugin WYSIWYG enhancement

To be true: This 'solution' is a bit clumsy but it worked in TWiki! I think it is better than nothing.

I changed the edit.chapter.tmpl a bit:

A new save button was added and the old one was set to display:none;

%TMPL:DEF{"button_save_new"}%<input type="button"
class="twikiSubmit" id="save_new" %MAKETEXT{"value='Save' accesskey='s'"}% />%TMPL:END%

%TMPL:DEF{"button_save"}%<input style="display:none;" type="submit" class="twikiSubmit" name="action_save" id="save" %MAKETEXT{"value='Save' accesskey='s'"}% />%TMPL:END%

%TMPL:DEF{"action_buttons"}%%TMPL:P{"button_save_new"}%&nbsp;%TMPL:P{"button_save"}%&nbsp;%TMPL:P{"button_quietsave"}% %MAKETEXT{"or"}% %TMPL:P{"button_cancel"}%%TMPL:END%

A small piece JS (requires JQuery) follows:


        $('#button_save_new').click(function() {
                //Checking if raw or WYSIWYG
                var topicDisplay = $('textarea#topic').css('display');

                if (topicDisplay == 'none') {
                    // If WYSIWYG then switch to raw
                    tinyMCE.execCommand("mceToggleEditor", null, 'mce_editor_0');
                    // The click on the 'original' save button is triggered, 2 sec of waiting is enough to get the content
                    window.setTimeout("$('#save').trigger('click')", '2000');
                } else {
                    window.setTimeout("$('#save').trigger('click')", '10');


Viele Grüße

To make this work, apparently I changed

I will try to improve this plugin at some point over the next few weeks.

-- PaulHarvey - 20 Sep 2009

Adding a nowysiwyg=on to the edit url seems to fix it as well.

-- MichaelDaum - 16 Nov 2009

ItemTemplate edit

Summary Edit Chapter Save with WYSIWYG Editor displayed deletes entire contents of topic
ReportedBy TWiki:Main.JoeMarandola
SVN Range TWiki-5.0.0, Sun, 04 May 2008, build 16770
AppliesTo Extension
Component EditChapterPlugin
Priority Enhancement
CurrentState Closed
Checkins EditChapterPlugin:f7f8e1ec2854
TargetRelease n/a
Topic revision: r8 - 16 Nov 2009, MichaelDaum
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