-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to make table border=none setting work? #6841
Comments
I think we should do more with this one. As you know there is a style It looks to me that "border none" in our dialog serves as default value. Something like "nothing has been selected from the dropdown" which in my opinion is invalid thus I propose adding new default option to the dropdown like e.g. "Select One" or "Default" and making the "None" setting actually applying |
Issue #6363 was closed and this issue was created. Close reason was duplicate, but it isn't. Our use case, that I tried to explain in closed issue, is that we want to add table with borders by default and allow users to change selected borders as none ( invisible ) as needed ( this functionality is working in CK4, we are migrating to CK5 and this is breaking deal for us ). Majority of our tables will have borders only very few (most of them are needed for layout purposes will be partially or fully invisible ). Adding tables with full borders is how other editors works, it is intuitive and users already familiar with table feature from other products. I think for developers to start changing default css values is a big no-no. Both plugin and default css values comes from CK editor. Your are in full control of them. If those css values needs to be changed in future, it can be very complicated for projects relying on CK editor to update versions, without introducing subtle bugs. Especial if your customers rely on backwards comparability ( document created with CK version x should render same with CK version x+1 ). Ideally table plugin should be aware of css properties ( that comes from stylesheets ) and show correct border styles. If that is too much work or CK team wants to avoid detecting css properties ( very very valid reasons ) perhaps there can be some kind of hook/method that I can provide in config, which would be called when table is added and I could apply styling there ? Or perhaps, even a flag, which if set, would add all css properties for solid table inside html. This would increase html size, but then plugin would be in full control of table and wouldn't need to assume what are defaults in stylesheets. Both options seems hacky, again, I think ideally plugin should be aware of css coming from styleheet. |
How do I use if I am using Nuxt 3 @Reinmar ? |
@hendisantika you could override the CSS as suggested in the description. |
Where can I find table properties? |
BTW, Where I can set Table Properties Balloon? |
@hendisantika check the docs in that matter. |
It's possible to achieve table: {
tableProperties: {
// The default styles for tables in the editor.
// They should be synchronized with the content styles.
defaultProperties: {
borderStyle: 'double',
borderColor: 'hsl(0, 0%, 70%)',
borderWidth: '1px',
width: '100%',
height: '100%'
}
// The default styles for table cells in the editor.
// They should be synchronized with the content styles.
},
tableCellProperties: {
defaultProperties: {
borderStyle: 'solid',
borderColor: 'hsl(0, 0%, 75%)',
borderWidth: '1px'
}
}
} Inserted table: Changed table and table cells to border:none I believe it would make sense to set these values by default in our feature to match our content styles. |
I agree, it's confusing right now, and our default config should match the styles. |
The @Mgsy solution works fine, will push this change, but I wanted to take it even one step further. Perhaps we could also have the option to propagate the table border styles to the cell styles (as a checkbox or by default, no strong opinions on that), because changing table border style to Let me know what do you think. |
Yes, this is the HTML environment that influences the UI. While I like the propagation idea, it's one of many. The other one is to have tables in two modes, advanced (HTML), and basic (Notion-like). I wouldn't increase the scope in this ticket, this will be in scope for the future improvements of tables. |
One more thing to consider - while testing the above solution (setting |
I think it would be against our current default in other features: Font Size, Font Type, when we operate on default, we don't keep them (in model or HTML). But in those, we don't specifically set the values (just "default"), we just use stylesheets 🤔 . We also got this recently: #15917 @Reinmar any context we are missing here? |
There's also this discussion: #14921 (comment) |
📝 Provide a description of the improvement
If you set table borders to none this is what you'll likely see:
The table still has a border. Why does it happen? It's because the table is styled by default content styles to this:
These styles are applied by default via a stylesheet to every table in the editor. Since the "none" style set in the "Table properties" balloon does not apply any inline style to the
<table>
element, the styles coming from the stylesheet are applied.Therefore, in order to make a table not have any border by default one needs to add such a CSS to their website's styles (note:
td
s need to be styled too):With this style, you'll get:
However, this isn't perfect – the table is now rendered in a very unclear way. Therefore, it's better to load different stylesheet in a page where the editor is rendered and in a page where the editor contents is rendered:
This will make the table visible when rendered in the editor even if it has no border set via the "Table properties" and "Table cell properties" balloons:
While ensuring that everything still works when the table is being styled via the balloons:
And that the border is not rendered at all if it was not set via the balloon when the content outputted from the editor is rendered on a target page (that uses
page-with-editor-content.css
).Should we do something with this?
It may be confusing for some developers why setting borders to none via the UI does not make the borders disappear completely. It'd be good to at least point in the documentation to this ticket.
However, perhaps we should do more?
If you'd like to see this improvement implemented, add a 👍 reaction to this post.
The text was updated successfully, but these errors were encountered: