ckeditor5-table
ckeditor5-table copied to clipboard
[wip] Feature: Resize column widths
https://github.com/ckeditor/ckeditor5-table/issues/3
A preliminary attempt at adding the feature to resize column widths.
- Adds simple UI Element
resizer
to each cell - Adds new DOMEventObserver for
mousemove
andmouseup
events - Adds
colwidth
attribute toTableCell
and adds inline styles
Additional information
- Why add a resizer to each cell? Well, mainly because I think it was the simplest way - you pretty much don't have to worry about complex CSS to make the UI work.
- Why add inline styles to each cell? Why not just the first row? Well, that would work as you create a table, but then you'd lose all the styling if you deleted the top row (or else have to transfer all the attributes down to the next) which I think makes less sense.
Todo
- Tests
- I've introduced a new bug; seems to cause all sorts of problems now when you add an image inside of table cell. I don't know why that's happening yet.
- Better UI? Maybe the cursor should remain
ew-resize
while dragging the whole time. Maybe the entire side of the column should "light up" too, not just the cell. - Do we need to specify a max width?
- Currently, the text in the cell remains selected, and when you drag, it can make that selection keep changing. Not sure if we need to make the resizer itself selectable, and if so, what that means for the
TableCell
model.