Highlight a single table cell?

What is the recommended way to handle highlighting of single cells within a table?

Under the Styles menu, I see the option to highlight a table row as Danger, Warning, etc., but I don’t see a way to use the Styles menu to highlight a single cell. I also see the Background Color option under the Cell Properties, but that’s a little tedious since you have to type in a RGB color code and which makes it hard to enforce a consistent color across all tables in the wiki. There didn’t appear to be a good extension that added a cell color picker or similar to the UI either.

In order to have consistent styling we have recently developed Image Style Application (XWiki.org) but that’s for image and not for tables unfortunately :wink:

For tables, if you’re using the WYSIWYG editor I don’t think there’s more than what you’ve found.

If you’re willing to use the wiki editor, then you could pass some class attribute.

For example:

|a|a1 
|b|(% class="cell-highlight" %)b1
|c|c1 

See XWiki Syntaxes (XWiki.org)

Then you’ll need to define the CSS for cell-highlight, either in the Skin or (better IMO), in a SSX.

Another idea would to be write a wiki macro (e.g. cellHighlight) and ask users to use it to wrap the content of a cell when using the WYSIWYG editor. That macro would just wrap the content with:

(% class="cell-highlight" %)(((
...content here...
)))
1 Like

Thank you for these suggestions, @vmassol. The recommendation to use a SSX to define color classes seems like it will be particularly useful.

However, using the wiki editor is not the most convenient solution to this issue. My wiki contains many comparison tables highlighted similarly to ones that you’ll often find on Wikipedia. (For example, see the style of the tables in: Comparison of wiki software - Wikipedia) In my old Confluence instance, it was possible to highlight a group of cells using ctrl-click and click a Confluence toolbar button to quickly highlight the selected cells in the desired color. However, using the wiki editor in XWiki would require copy/pasting the style info which would be a little tedious and probably not go over too well with my users.

I can look into writing a macro though since macros appear to be compatible with the multi-selection feature for table cells. I assume that macros can then be used to create new entries in the Styles menu in the WYSIWYG editor? (e.g., Could the macros be used to create new entries in the Styles menu such as: Info Cell, Danger Cell, etc?)

+1 for this feature, my users (and I) also miss colors in tables, makes them much more convenient and useful.

In the doc at https://extensions.xwiki.org/xwiki/bin/view/Extension/CKEditor%20Integration/#HStandardCKEditorFeatures I see:

For this we disable by default the features that are related to styles, such as text aligning, changing fonts or text color. If you really need these features you can enable them from the dedicated administration section.

Wouldn’t this be enough for your need?

Thanks

Thanks for the pointer but this just changes the background colour of the selected text, but not whole table rows.

The question in this thread was about Highlight a single table cell?

Isn’t this achievable with changing the background color of cells?

Regarding mass change of colors, I see that CK5 has this at Table and cell styling tools | CKEditor 5 Documentation

However, XWiki is currently on CK4 (for several reasons), so we would need to find a plugin in this list: Add-ons list | CKEditor.com

If you can find one from this list that would match your need, let us know, maybe you could install it in your XWiki instance.

Thx

I know, sorry, I kind of hijacked this thread. :-/

I actually found one, thanks (Table Tools | CKEditor.com), now I just have to figure out how to install it.

Yes, that’s a possible workaround, but it’s really cumbersome because you have to first determine the color code that you want (either in hexadecimal, or by using macros like “red” - which I could not find clearly documented anywhere), then you have to highlight the cells, right-click and open the Cell Properties, and set the background color. By comparison, in Confluence, you just highlight the cells and pick a color from the toolbar.

This looks good. The color picker alone would be a real time-saver. Are there plans for XWiki to upgrade to CK5 sometime?

For an entire row, there are some very limited options built into the XWiki editor. If you highlight a row and look at the Styles drop-down menu in the toolbar, there are options like Active Row (gray), Success Row (green), Info Row (blue), Warning Row (yellow), and Danger Row (red). This is nowhere near as convenient as Confluence’s table highlighting tools, but it can be useful if you’re not needing a lot of different types of colors in your table and are not picky about the specific color used to highlight the row.

Thanks, I just tried that and although it is a workaround, it is still a far way off the way our users usually used this feature…

Very interested in that too!

See Hi! Have any plan to use ckeditor 5 in XWiki? - #11 by MichaelHamann