You are here: Foswiki>Tasks Web>Item12341 (05 Jul 2015, GeorgeClark)Edit Attach

Item12341: WysiwygPlugin identifies spans inside protected macros with TMLhtml, but fails to remove the class during save.

pencil
Priority: Normal
Current State: Closed
Released In: 2.0.0
Target Release: major
Applies To: Extension
Component: WysiwygPlugin
Branches: Release01x01 trunk master
Reported By: GeorgeClark
Waiting For:
Last Change By: GeorgeClark
After an Edit/Save cycle:
%SEARCH{
  header="<div class='foswikiNotification'><span class='foswikiAlert'>$percntX$percnt *some alert* </span>"
  footer="</div>"
}%

becomes:

%SEARCH{
  header="<div class='foswikiNotification TMLhtml'><span class='foswikiAlert TMLhtml'>$percntX$percnt *some alert* </span>"
  footer="</div>"
}%

And another TMLhtml is added after each save.


The following works, but is probably not correct. I think it will remove the TMLhtml string a bit too aggressively. It would probably be better if the conversion to HTML avoided "classifying" the tags in the first place rather than stripping the classification.

diff --git a/WysiwygPlugin/lib/Foswiki/Plugins/WysiwygPlugin/TML2HTML.pm b/WysiwygPlugin/lib/Foswiki/Plugins/WysiwygPlugin/TML2HTML.pm
index f477393..b3ca2c0 100644
--- a/WysiwygPlugin/lib/Foswiki/Plugins/WysiwygPlugin/TML2HTML.pm
+++ b/WysiwygPlugin/lib/Foswiki/Plugins/WysiwygPlugin/TML2HTML.pm
@@ -329,8 +329,10 @@ sub _processTags {
               # The commented out lines disable PROTECTED for %SIMPLE% vars. See
               # Bugs: Item4828 for the sort of problem this would help to avert.
               #                if ($tag =~ /^\n?%\w+{.*}%/) {
+                $tag =~ s/class=(["'].*?) TMLhtml(["'])/class=$1$2/g;
                 $stackTop =
                   pop(@stack) . $nl . $this->_liftOut( $tag, 'PROTECTED' );
+                  print STDERR "Lifting out $tag\n";
 
                 #                } else {
                 #                    $stackTop = pop( @stack ).$tag;

-- GeorgeClark - 10 Jan 2013

Crawford. This has a unit test and a proposed fix that I'm a bit uncomfortable with. You're the master of wysiwyg, if you have some time to review. Thanks

-- GeorgeClark - 12 Jan 2015
 

ItemTemplate edit

Summary WysiwygPlugin identifies spans inside protected macros with TMLhtml, but fails to remove the class during save.
ReportedBy GeorgeClark
Codebase 1.1.6, trunk
SVN Range
AppliesTo Extension
Component WysiwygPlugin
Priority Normal
CurrentState Closed
WaitingFor
Checkins distro:98fee398d0ab distro:8e22a9dc3ecc distro:e461ea635f00 distro:877aaf2dcf0b
TargetRelease major
ReleasedIn 2.0.0
CheckinsOnBranches Release01x01 trunk master
trunkCheckins distro:8e22a9dc3ecc
masterCheckins distro:e461ea635f00 distro:877aaf2dcf0b
ItemBranchCheckins
Release01x01Checkins distro:98fee398d0ab
Topic revision: r9 - 05 Jul 2015, GeorgeClark - This page was cached on 02 Jul 2016 - 11:44.

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