Opened 9 years ago
Last modified 8 years ago
#13833 assigned Bug
Styles dropdown doesn't work correctly for tables with border=0
Reported by: | Alfonso Martínez de Lizarrondo | Owned by: | Tomasz Jakut |
---|---|---|---|
Priority: | Nice to have (we want to work on it) | Milestone: | |
Component: | Core : Tables | Version: | 3.1 |
Keywords: | Cc: |
Description
Steps to reproduce
- Add some styles to add a class to a table
CKEDITOR.config.allowedContent = true; CKEDITOR.stylesSet.add( 'my_styles', [ // Block-level styles { name: 'Nice table', element: 'table', attributes: { 'class': 'MyTable' } } ] ); CKEDITOR.config.stylesSet = 'my_styles';
- add a little CSS to check that it works
.MyTable { border-collapse:collapse; border:1px solid blue; background-color: #00DD00; } .MyTable td, .MyTable th{ border:1px solid blue; padding: 5px 1em; }
- Put some tables in your content with that class and border = 0 or border = 1
- Now try to use the Styles dropdown
Expected result
In both tables the Style should be shown as "Nice table"
Actual result
Only works correctly in the second one. The first one has the "cke_show_border" class that CKEditor adds automatically and the Styles system doesn't ignore it. Once you click then it's applied and then it works correctly until you reload the content.
Other details (browser, OS, CKEditor version, installed plugins)
This has been failing for eons, all browsers demo at http://jsfiddle.net/8jcyf9aa/
Change History (19)
comment:1 Changed 9 years ago by
Status: | new → confirmed |
---|---|
Version: | 4.5.4 → 3.1 |
comment:2 Changed 9 years ago by
Milestone: | → CKEditor 4.5.5 |
---|
There are multiple approaches. The easiest one is to use attribute instead of a class, and this would solve this particular issue. But I'd rather do a quick revise of showborders plugin, as it's pretty simple and I see some IE6 legacy stuff which is no longer needed.
comment:3 Changed 9 years ago by
Milestone: | CKEditor 4.5.5 → CKEditor 4.5.6 |
---|
comment:4 Changed 9 years ago by
Owner: | set to Tomasz Jakut |
---|---|
Status: | confirmed → assigned |
comment:5 Changed 9 years ago by
Status: | assigned → review |
---|
I've connected getComputedStyle
approach with attribute one - so showborders plugin is nearly completely rewritten. I also added some basic tests for it. Pushed branch:t/13833.
comment:6 Changed 9 years ago by
Milestone: | CKEditor 4.5.6 → CKEditor 4.5.7 |
---|
comment:7 Changed 9 years ago by
Milestone: | CKEditor 4.5.7 → CKEditor 4.5.8 |
---|
comment:8 Changed 9 years ago by
Milestone: | CKEditor 4.5.8 → CKEditor 4.5.9 |
---|
comment:9 Changed 9 years ago by
Milestone: | CKEditor 4.5.9 → CKEditor 4.5.10 |
---|
comment:10 Changed 9 years ago by
Milestone: | CKEditor 4.5.10 → CKEditor 4.5.11 |
---|
Moving tickets to the next milestone.
comment:11 Changed 8 years ago by
Milestone: | CKEditor 4.5.11 → CKEditor 4.6.1 |
---|
comment:12 Changed 8 years ago by
Milestone: | CKEditor 4.6.1 → CKEditor 4.6.2 |
---|
Moving to 4.6.2 minor release, as 4.6.1 is mostly about polishing 4.6.0.
comment:13 Changed 8 years ago by
Just a note: we could extract border function into CKEDITOR.tools.style.parse
in a similar fashion as margin method.
comment:14 Changed 8 years ago by
Status: | review → review_failed |
---|
One thing I noticed is that once the user applies the table style and changes the selection so that it's still within the same cell it used to be, the style dropdown does not react to that.
This happens regardless of the border attribute value.
comment:15 Changed 8 years ago by
Status: | review_failed → assigned |
---|
The issue seems to be more complicated. The whole plugin does not react to any changes in table's styles. If the table has initially borders, then even switching to the borderless styles does not trigger the styles from the plugin.
comment:17 Changed 8 years ago by
I've rebased the branch on top of latest master, and added minor doc change.
comment:18 Changed 8 years ago by
Milestone: | CKEditor 4.6.2 → CKEditor 4.7.0 |
---|
comment:19 Changed 8 years ago by
Milestone: | CKEditor 4.7.0 |
---|---|
Priority: | Normal → Nice to have (we want to work on it) |
Problem can be reproduced from CKEditor 3.1 when "cke_show_border" was introduced.
We could either don't assign this class when table has custom class assigned. But what if custom class doesn't touch borders?
Another approach would be checking if table has border assigned (maybe from getComputedStyle).