Item5635: Edit Chapter Save with WYSIWYG Editor displayed deletes entire contents of topic
Priority: Enhancement
Current State: Closed
Released In:
Target Release: n/a
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 [tzobel@seibert-media.net]
Sent: Thursday, 26 March 2009 9:07 PM
To: foswiki-discuss@lists.sourceforge.net
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"}% %TMPL:P{"button_save"}% %TMPL:P{"button_quietsave"}% %MAKETEXT{"or"}% %TMPL:P{"button_cancel"}%%TMPL:END%
A small piece JS (requires JQuery) follows:
$(document).ready(function(){
$('#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
Thomas
To make this work, apparently I changed
$('#button_save_new').click()
to
$('#save_new').click()
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