ckeditor5-table icon indicating copy to clipboard operation
ckeditor5-table copied to clipboard

[wip] Feature: Resize column widths

Open christinecha opened this issue 5 years ago • 1 comments

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 and mouseup events
  • Adds colwidth attribute to TableCell 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.

christinecha avatar Aug 21 '19 19:08 christinecha

Coverage Status

Coverage decreased (-3.3%) to 96.717% when pulling b36b7db6170da5a507a343a074bc605b92d0aca1 on christinecha:t/3 into 9f6445246c9641e9252dafd030b0752dfb22dd60 on ckeditor:master.

coveralls avatar Aug 21 '19 19:08 coveralls