You are here: Foswiki>Tasks Web>Item4485 (14 Dec 2008, GeorgeClark)Edit Attach

Item4485: WYSIWYG plugin adds script lines at the end of the topic.

pencil
Priority: Normal
Current State: Closed
Released In:
Target Release: n/a
Applies To: Extension
Component: ToolTipPlugin
Branches:
Reported By: TWiki:Main.SteveJonesST
Waiting For: Foswiki:Main.GeorgeClark
Last Change By: GeorgeClark
The WYSIWYG plugin adds the following text repeatedly at the end of the topic, after every WYSIWYG edit-save cycle (ignore the verbatim tags in this post).

<script src="http://cadweb.bri.st.com/twiki/pub/TWiki/ToolTipPlugin/wz_tooltip.js" type="text/javascript"></script>

It could be I've set the template up incorrectly, but if so, I can't see how.

-- TWiki:Main/SteveJonesST - 22 Aug 2007

I have seen similar from RevCommentPlugin. Not all the time. Depends on what else is in the topic. I have not found a pattern. But once it is added, one more line is added with the same after each save. This is on the Wysiwyg shipped with 4.1.2.

-- TWiki:Main.KennethLavrsen - 22 Aug 2007

I can't reproduce this. What plugins? Which editor? (Kupu or TinyMCE)

CC

This is with Kupu (I can't test with TinyMCE, as I'm still on 4.0.5), and I confirm it does occur with the latest Wysiwyg plugin. This script line corrupts the rest of the page, so the left bar goes missing, and users are very confused by it. I have a set of users who can't adopt without Wysiwyg, so they are not participating at the moment.

-- TWiki:Main.SteveJonesST - 04 Sep 2007

Some more info. This is added by the ToolTipPlugin, which has the following in its postRenderingHandler:
$_[0] =~ s|(</body>)|<script type="text/javascript" src="$TWiki::cfg{DefaultUrlHost}$TWiki::cfg{PubUrlPath}/$TWiki::cfg{SystemWebName}/$pluginName/wz_tooltip.
js"></script>$1|;
Somehow this is interpreted by Wysiwyg as part of the topic text, and it gets saved along with the topic. The presence of this script line in the topic breaks the view of all topics edited with Wysiwyg, and is now the main barrier to adoption of Wysiwyg on our site.

Should this be fixed in the ToolTipPlugin, or should it be handled properly by the Wysiwyg plugin ? We need both, so I have to find a solution somewhere.

Hope this helps.

-- TWiki:Main.SteveJonesST - 04 Sep 2007

My workaround is to comment the line from the postRenderingHandler in ToolTipPlugin, and add the following to the body.pattern.template, just before the final closing body tag:

<script type="text/javascript" src="%PUBURLPATH%/%TWIKIWEB%/ToolTipPlugin/wz_tooltip.js"></script>

This allows both the Wysiwyg and ToolTip plugins to coexist in my installation.

I believe we should understand where this should be fixed however, in case it's a more general case which could affect Wysiwyg proliferation.

-- TWiki:Main.SteveJonesST - 04 Sep 2007

You should be able to use TinyMCE with 4.0.5.

From what you describe here, this is a really horrible hack in the ToolTopPlugin. So I'm passing the buck; it should be fixed there.

-- CrawfordCurrie - 04 Sep 2007

I have not observed this problem with the current 4.2.2 TWiki. The ToolTipPlugin still inserts the javascript file in the post rendering handler. Note that I did change the plugin to only add the javascript when a tooltip is found on the page. I don't see why every page should get the .js file if tooltips are not in use.

-- TWiki:Main.GeorgeClark - 29 Aug 2008

I tried to change the TWiki:Plugins.ToolTipPlugin to use the TWiki::Func::addToHEAD API to add the wz_tooltip.js to the page. Unfortunately the .js file checks and enforces a requirement that the .js file be loaded in the <body> of the page. addToHEAD won't work for this script.

-- TWiki:Main.GeorgeClark - 01 Sep 2008

Is anyone still running into this problem or can this item be closed?

-- TWiki:Main.GeorgeClark - 20 Sep 2008

I believe that the work done to convert ToolTipPlugin to a registerTagHandler should resolve this. Also, as reported against the kupu editor, this probably doesn't apply. Not observed with TinyMCE.

ItemTemplate edit

Summary WYSIWYG plugin adds script lines at the end of the topic.
ReportedBy TWiki:Main.SteveJonesST
Codebase
SVN Range TWiki-4.2.0, Wed, 22 Aug 2007, build 14581
AppliesTo Extension
Component ToolTipPlugin
Priority Normal
CurrentState Closed
WaitingFor Foswiki:Main.GeorgeClark
Checkins ToolTipPlugin:dc02d93ff65c
TargetRelease n/a
ReleasedIn
Topic revision: r12 - 14 Dec 2008, GeorgeClark
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