Item12341: WysiwygPlugin identifies spans inside protected macros with TMLhtml, but fails to remove the class during save.
Priority: Normal
Current State: Closed
Released In: 2.0.0
Target Release: major
Applies To: Extension
Component: WysiwygPlugin
Branches: Release01x01 trunk master
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