Item12448: WYSIWYG-Editor: Table Cell Background Color and other table styling lost on save
Current State: Closed
Released In: 1.1.9
Target Release: patch
I am using the WYSIWYG editor to create and edit a table, e.g.: TableCellBGColor
Using "Table Cell Properties", I change one cell's background color to named "yellow" -> #ffff00
In the editor, the change is visible, the cell turns yellow. When I click save, the change is lost, though. The wikitext does not show any color information either.
My installation is 1.1.5, I have TablePlugin
installed, but do not make use of it in this page. Also reproducible on foswiki.org, which currently uses 1.1.8.
When saving a topic your carefully crafted HTML-Tables are translated to Foswiki markup tables using pipe symbols and such.
However, while you are able to alter the background color of table cells within the wysiwyg editor, this feature does not carry over to Foswiki tables. As a consequence your colors are thrown away. This is a know limitations of Foswiki markup.
- 27 Mar 2013
Thanks, Michael, for the explanation. What I'm wondering is this - what's the reason for implementing a color chooser UI, if the color get's lost on save anyway? Is there a workaround that I can use to keep the table in HTML mode?
- 27 Mar 2013
- 28 Mar 2013
The Color Chooser UI (and wyswiyg table handling in general) is part of the default TinyMCE
HTML Editor. Foswiki has a challenge to convert from TML to HTML and then back to TML. Generally for users developing wiki applications, it's often important to preserve the
| TML | Style |
table markup to allow it to be more easily parsed in applications.
I think I see the issue. The HTML -> TML conversion is supposed to detect HTML attributes that cannot be represented in TML. See Extensions.WysiwygPlugin#WYSIWYGPLUGIN_STICKYBITS_45_Protect_tags_based_upon_their_arguments
. However attributes like "bgcolor" have been deprecated and recent TinyMCE
editors do not use them.
I'm not sure of the solution. It might be possible to specify "style" as the "stickybit", but that's probably too general. It would need to match on something like
But there are a lot more combinations - border-style, border-color, etc.
Setting this to confirmed.
- 01 Apr 2013
Not sure what's going on here. I've tried adding "style" to the STICKYBITS for all the table tags. But it still doesn't protect the table html.
- 19 Apr 2013
I think I have a fix I'll check in. If you set a background or border setting, the html will not be converted back to TML, so you'll be left with HTML in the topic, but the settings will be preserved. I'm picking through some of the other TMCE table settings to see if others should preserve HTML and prevent the conversion to TML.
The "style" can't be used as a stickybit because it's treated specially by the conversion.
- 15 Oct 2013
Note that preserving HTML tables somewhat damages the ability to use TML table processing. The preferred way to set table attributes is to use the
- 16 Oct 2013
Crawford, I've checked in a fix, but it needs review. It might go too far. And probably ought to be configurable. And it breaks some ancient kupu compatibility tests.
- 16 Oct 2013