New Foswiki release 2.1.6 is available with important security fixes.
Sourceforge foswiki email lists being discontinued. Subscribe to the new Foswiki announce and discuss lists at MailingLists

Item5221: Wysiwyg tables, very difficult to get rid of paragraph html tags in table cell

Priority: Normal
Current State: Closed
Released In: 1.1.0
Target Release: minor
Applies To: Extension
Component: TinyMCEPlugin
Reported By: TWiki:Main.KennethLavrsen
Waiting For:
Last Change By: KennethLavrsen
An annoyance more than a show stopper.

Several of my users have pointed out that once you have hit enter inside a table cell the TMCE adds html paragraph tags round the text making the text in the cell jump down. You more or less have to pickaxe your way out of that.

The only work around I have found it to change the text to heading 1 and then back to normal.
Some table text where I did not hit enter

Some text where I hit enter before the text and tried to delete it again

Some text where I hit enter

in the middle to get two lines of text

Some text where I hit
shift enter to get a BR instead

I wonder what we can do to make the editing experience a bit better. Not a release blocker.

-- TWiki:Main/KennethLavrsen - 08 Jan 2008

Yeah, it's a PITA. Note that the behviour is different on different browsers; it's all to do with the way MIDAS is implemented, I think.



It's interesting that our editor setup even with TMCE 3.2.7 exhibits this problem, but the following (similar) configuration does not:

-- PaulHarvey - 15 Oct 2009

Actually, the minimal config above does exhibit the problem: for some reason the <p>s are just not giving us newlines around the para in the editor. I can observe that the <p> remains in the DOM.

Will work on updating the bug upstream:

-- PaulHarvey - 05 Nov 2009

We need a server-side fix in WysiwygPlugin.

-- PaulHarvey - 16 Jan 2010

Here is a possible fix; a multi-editor solution would need this to be configurable - and I'm not sure we should apply it until we get the browser-in-the-loop tests passing... OTOH it's pretty simple:

Index: test/unit/WysiwygPlugin/
--- test/unit/WysiwygPlugin/   (revision 7305)
+++ test/unit/WysiwygPlugin/   (working copy)
@@ -747,6 +747,20 @@
 | Foo | a |
+    {
+        name => 'Item5221_EatUnwantedParasInTableCells',
+        exec => $HTML2TML | $ROUNDTRIP,
+        html => <<'HERE',
+<table cellspacing="1" cellpadding="0" border="1">
+<tr><th> a </th></tr>
+<tr><td> <p>1</p> </td></tr>
+        tml => <<'HERE',
+| *a* |
+| 1 |
+    },
 sub compareTML_HTML {
Index: lib/Foswiki/Plugins/WysiwygPlugin/HTML2TML/
--- lib/Foswiki/Plugins/WysiwygPlugin/HTML2TML/   (revision 7305)
+++ lib/Foswiki/Plugins/WysiwygPlugin/HTML2TML/   (working copy)
@@ -872,6 +872,9 @@
     $td =~
 s/(<br \/>|<br>|$WC::NBSP|$WC::NBBR|$WC::CHECKn|$WC::CHECKs|$WC::CHECKw|$WC::CHECK1|$WC::CHECK2|$WC::TAB|\s)+$//so;
+    # Item5221: Eat impossible-to-remove-in-TinyMCE <p>...</p> surrounding table
+    # cell content, created if a user hits the return key inside a table cell
+    $td =~ s/^<p>(.*)<\/p>$/$1/so;
     return $td;

-- PaulHarvey - 01 May 2010

Be careful not to destroy content like this, that has more than one <p> tag:
<p>Line one</p>
<p>Line two</p>

-- MichaelTempest - 01 May 2010


-- MichaelTempest - 16 May 2010

ItemTemplate edit

Summary Wysiwyg tables, very difficult to get rid of paragraph html tags in table cell
ReportedBy TWiki:Main.KennethLavrsen
Codebase 1.0.9, trunk
SVN Range TWiki-4.3.0, Sun, 30 Dec 2007, build 16120
AppliesTo Extension
Component TinyMCEPlugin
Priority Normal
CurrentState Closed
Checkins distro:81b85965a03d distro:1d013e8f76ea
TargetRelease minor
ReleasedIn 1.1.0
Topic revision: r11 - 04 Oct 2010, KennethLavrsen - This page was cached on 12 Jul 2018 - 21:28.

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