-
-
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
Support for styling table & table cells #3287
Comments
MotivationThere are two distinctive requirements:
MVPStyles conversion (step 1)
UI (step 2)
Styling options to includeCell styling (priority: highest)Styles applied to
Table styling (priority: high)Styles applied to
Future
Other considerationsStyle normalization
Model:
Upcasting:
Downcasting:
Enabling/disabling styling options
Extending the list of optionsIdeally, it should be possible to write your own plugin which will add its option to e.g. cell properties panel. It's not necessarily MVP material, but if it will turn out that this is easily doable, it'll be perfect. Could be done like this: editor.plugins.get( 'TableCellPropertiesUI' ).addProperty( {
ui: sth, // some way to specify how the input will be displayed,
onSave: sth, // a callback doing something on save,
order: 100 // place on the list,
} ); This is oversimplified, because I don't know what's the best option to load the data into the UI and save it back. Especially in col/row cases when you have to read data from multiple items. Perhaps, the simplest option is callback based. const input = LabeledInputView( { label: 'Padding' } );
editor.plugins.get( 'TableCellPropertiesUI' ).addProperty( {
ui: ( cell ) => {
input.value = cell.getAttribute( 'padding' );
return input;
},
onSave: () => {
editor.execute( 'tableCellPadding', { value: cleanupValue( input.value ) } );
},
order: 100
} ); |
BTW, I'm totally unsure what to do with commands here. Separate commands for all those options? There will be many of them, but perhaps there's no other way. |
First steps:
|
Just to confirm - the table/tableCell/tableRow properties should be prefixed with model element name?
|
I think this is still a table cell's setting. As the spec says:
BTW, I did you skip the alignment (of a table, but also a horizontal alignment of a table cell) on purpose when listing those attributes? |
I've might just miss them. The other thing is that at least MS Word places the alignment on paragraphs so this works out of the box and I wonder what we should do there. |
OK I see that prefixing those attributes doesn't make any sense - we have |
OK guys, to sum up current work status I've concluded this list to track progress to finish MVP in a step 1 form - retention of as much pasted content as possible without adding table styles support in Paste From Office. I've extracted this from @Reinmar's comment with only relevant parts.
ps.: this comment might be updated with more steps but ATM I think that's all what's needed for MVP step 1. |
when this can be on prod? |
In two weeks 🤞 |
We can add support for styling table cells.
In this case it doesn't seem reasonable to approach the problem with our usual "closed set of styles" (like image "full" and "aside" styles). Instead, we need a full flavored option.
One way to imagine it would be a button "cell properties" in a table toolbar. It would open a bigger panel where you could choose border style, border width, cell size, alignment (v and h), background color, border color.
If you'd like to see this feature implemented, please react with 👍 to this ticket.
The text was updated successfully, but these errors were encountered: