You are here: Foswiki>Tasks Web>Item11592 (02 Dec 2012, GeorgeClark)Edit Attach

Item11592: WYSIWYG doesn't protect newlines in GluePlugin macro syntax

pencil
Priority: Enhancement
Current State: Closed
Released In: 1.1.6
Target Release: patch
Applies To: Extension
Component: WysiwygPlugin
Branches: Release01x01 trunk
Reported By: VickiBrown
Waiting For:
Last Change By: GeorgeClark
Consider the following code, set up for GluePlugin:

| *Company ID* | *Supplier Type* | *Partner Rank* | *Service Focus* | *Supplier Markets* | *Market Focus* |
%~~ SEARCH{
~~~ search="META:FORM.*?ApplicationForm" 
~~~ topic="XYZ*" nosearch="on" nototal="on" regex="on" noheader="on" 
~~~ excludetopic="%TOPIC%"
~~~ format="| 
~~~ [[$topic][$formfield(CompanyID)]] | 
~~~ $formfield(SupplierType) |
~~~ $formfield(PartnerRank) |
~~~ $formfield(Service Focus) |
~~~ $formfield(SupplierMarkets) |
~~~ $formfield(MarketFocus) |
~~~ " }%

If this code is in a page that is edited with WYSIWYG, whether or not the code in this section is modified, when the page is saved the result is

| *Company ID* | *Supplier Type* | *Partner Rank* | *Service Focus* | *Supplier Markets* | *Market Focus* |
%~~ SEARCH{ ~~~ search="META:FORM.*?ApplicationForm" ~~~ topic="XYZ*" nosearch="on" nototal="on" regex="on" noheader="on" ~~~ excludetopic="%TOPIC%" ~~~ format="| ~~~ [[$topic][$formfield(CompanyID)]] | ~~~ $formfield(SupplierType) | ~~~ $formfield(PartnerRank) | ~~~ $formfield(Service Focus) | ~~~ $formfield(SupplierMarkets) | ~~~ $formfield(MarketFocus) | ~~~ " }%

This breaks the code. (Glue Plugin cannot use it.)

It also violates the Principle of Least Surprise. WYSIWYG should not reformat the content of the page unless the USER reformats the content.

-- VickiBrown - 03 Mar 2012

Thanks Vicki,

You're right, of course, but the mechanics of actually achieving this is hugely non-trivial.

Having said that, MichaelTempest did some great work on trunk's WysiwygPlugin which addresses this in Item2174. I made a testing release (and I think Crawford made another) that you can test, if you're feeling adventurous, at Extensions/Testing.WysiwygPlugin - also requires trunk TinyMCEPlugin, you can get from Extensions/Testing.TinyMCEPlugin

FWIW you can also do without GluePlugin, Eg.
| *Company ID* | *Supplier Type* | *Partner Rank* | *Service Focus* | *Supplier Markets* | *Market Focus* |
%SEARCH{
  search="form.name~'*ApplicationForm'"
  type="query"
  topic="XYZ*"
  nonoise="on"
  excludetopic="%TOPIC%"
  format="| [[$topic][$formfield(CompanyID)]] \
| $formfield(SupplierType) \
| $formfield(PartnerRank) \
| $formfield(Service Focus) \
| $formfield(SupplierMarkets) \
| $formfield(MarketFocus) |"
}%

I'm not sure if it works with GluePlugin markup, though, so your testing would be very welcome

If you have the time to confirm that the latest WysiwygPlugin & TinyMCEPlugin works okay with glue markup, we can mark this as duplicate of Item2174

-- PaulHarvey - 03 Mar 2012

Silly me; I tested at trunk.foswiki.org/Sandbox http://trunk.foswiki.org/Sandbox/TestTopic44758.

%SEARCH{....}% is protected fine; but %~~~ SEARCH{}% isn't.

I've re-titled the bug so we can think about improving Item2174 to cover unofficial macro syntax the GluePlugin one.

-- PaulHarvey - 03 Mar 2012

It appears to be a simple fix. The regex looking to protect macros needs to match %(?:~~ )? - allowing for optional glue syntax between the % and the macro name.

-- GeorgeClark - 06 May 2012
 

ItemTemplate edit

Summary WYSIWYG doesn't protect newlines in GluePlugin macro syntax
ReportedBy VickiBrown
Codebase 1.1.5, 1.1.4, trunk
SVN Range
AppliesTo Extension
Component WysiwygPlugin
Priority Enhancement
CurrentState Closed
WaitingFor
Checkins distro:b599db68462e distro:e14610f3846b distro:97cb76fa453a
TargetRelease patch
ReleasedIn 1.1.6
CheckinsOnBranches Release01x01 trunk
trunkCheckins distro:b599db68462e distro:e14610f3846b
Release01x01Checkins distro:97cb76fa453a
Topic revision: r9 - 02 Dec 2012, 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