[xwiki-users] Changing border-top color of basic tables
Hi, I was looking into a way to modify the border-top color of tables in XWiki (defined in table.less) such that all basic tables have a solid 1px black top border (instead of the current solid 1px #ddd definition). I've been having trouble with finding a proper way to apply the style only to basic tables. Here are a few approaches I have taken: *Approach 1.* Override the tables.less file in our own tables_overrides.less and make all tables have a black 1px border. *Problem:* This selector is too general, and adds a black border to all tables on the page (History pane, Format guide, etc) *Approach 2.* Narrow the selector down to #xwikicontent (only the user’s content). #xwikicontent .table *Problem:* Now all tables in the xwikicontent div have borders and nowhere outside; however, other tables (such as those used by live tables) are also selected, making the LiveTables look wrong. *Approach 3.* Modify only the source where the border-color is defined (because table styles simply use @table-border-color variable to define the default border-top style *Problem:* XWiki uses tables throughout (i.e. History pane) and these tables also use @table-border-color, making their border-top black as well. *Approach 4.* Create a new table class (i.e. class=“bordered”) so that we can specifically select tables defined by CKEditor and nothing else. Hook into CKEditor table dialog and set Stylesheet Classes to “bordered” by default *Problem:* Users creating tables via source editor will have no context of adding borders to their table and their tables will not have proper borders by default As of now, there does not seem to be any clear cut way of selecting only the basic tables (because so many other parts of XWiki use that basic table). I was wondering if anyone has any insight on a possible solution to this issue. Thanks! -- View this message in context: http://xwiki.475771.n2.nabble.com/Changing-border-top-color-of-basic-tables-... Sent from the XWiki- Users mailing list archive at Nabble.com.
Not really a good advice, but kind of a workaround: when I have the problem of styling only tables inside the wiki-content and nothing else, I use the "Approach 2", except that the selector looks like #xwikicontent>table { ... } this selector does not style the livetables, because they are not directly nested in the #xwikicontent but nested inside additional div elements Of course this approach does not work for tables which are deeper nested in the normal content (i.e. inside info-macros, or sections created with the '((( ... )))' syntax), but most users do not create theses constructs, and those who do can speak wiki-syntax, and can be brought on board with "Approach 4" because they know (or can be taught) the '(% class="bordered" %)' trick ... ... however so far this has not been necessary for me (because among my folks I am the only one who needed this trick, and only once) HTH Clemens ----- Ursprüngliche Nachricht ----- Von: Andrew Kuang Am: Tuesday, 14.06.2016, 00:19 An: Xwiki Users Betreff: [xwiki-users] Changing border-top color of basic tables
Hi,
I was looking into a way to modify the border-top color of tables in XWiki (defined in table.less) such that all basic tables have a solid 1px black top border (instead of the current solid 1px #ddd definition). I've been having trouble with finding a proper way to apply the style only to basic tables. Here are a few approaches I have taken:
*Approach 1.* Override the tables.less file in our own tables_overrides.less and make all tables have a black 1px border. *Problem:* This selector is too general, and adds a black border to all tables on the page (History pane, Format guide, etc)
*Approach 2.* Narrow the selector down to #xwikicontent (only the user’s content). #xwikicontent .table *Problem:* Now all tables in the xwikicontent div have borders and nowhere outside; however, other tables (such as those used by live tables) are also selected, making the LiveTables look wrong.
*Approach 3.* Modify only the source where the border-color is defined (because table styles simply use @table-border-color variable to define the default border-top style *Problem:* XWiki uses tables throughout (i.e. History pane) and these tables also use @table-border-color, making their border-top black as well.
*Approach 4.* Create a new table class (i.e. class=“bordered”) so that we can specifically select tables defined by CKEditor and nothing else. Hook into CKEditor table dialog and set Stylesheet Classes to “bordered” by default *Problem:* Users creating tables via source editor will have no context of adding borders to their table and their tables will not have proper borders by default
As of now, there does not seem to be any clear cut way of selecting only the basic tables (because so many other parts of XWiki use that basic table). I was wondering if anyone has any insight on a possible solution to this issue. Thanks!
-- View this message in context: http://xwiki.475771.n2.nabble.com/Changing-border-top-color-of-basic-tables-... Sent from the XWiki- Users mailing list archive at Nabble.com. _______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Thanks for the suggestion! I have thought about this; however, I was hoping for a more robust solution. Ideally, I'd prefer to not have users do extra work to have what should be the default behavior. -- View this message in context: http://xwiki.475771.n2.nabble.com/Changing-border-top-color-of-basic-tables-... Sent from the XWiki- Users mailing list archive at Nabble.com.
participants (2)
-
Andrew Kuang -
Clemens Klein-Robbenhaar