-
Notifications
You must be signed in to change notification settings - Fork 17
Added a possibility to insert column or row with multiple selected cells #258
Conversation
* @param {module:engine/model/range~Range} range | ||
* @returns {module:engine/model/element~Element|null} | ||
*/ | ||
export function getRangeContainedElement( range ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Followup ckeditor/ckeditor5#6364.
cc @ckeditor/qa-team The code looks good. I reported one followup. |
Expected: an empty column inserted between d and e Actual: text content jumps from cell to cell, some cells are merged automatically ( like cells from e, f and g in this example ) and additional columns appear ( 9 at the beginning, 11 after first insertion ): |
Expected: row gets inserted below the whole cell
Expected: an empty column gets inserted between d and e |
Steps to reproduce
Current resultThe editor crashes. Errordomconverter.js:198 Uncaught TypeError: Cannot read property 'is' of undefined
at DomConverter.viewToDom (domconverter.js:198)
at getBalloonCellPositionData (utils.js:81)
at TableCellPropertiesUI._showView (tablecellpropertiesui.js:247)
at ButtonView.<anonymous> (tablecellpropertiesui.js:97)
at ButtonView.fire (emittermixin.js:209)
at TemplateToBinding.<anonymous> (buttonview.js:162)
at ProxyEmitter.callback (template.js:956)
at ProxyEmitter.fire (emittermixin.js:209)
at HTMLButtonElement.domListener (emittermixin.js:235) |
Steps to reproduce
Editor crashes: ckeditorerror.js:66 Uncaught CKEditorError: model-selection-range-intersects: Trying to add a range that intersects with another range in the selection. Read more: https://ckeditor.com/docs/ckeditor5/latest/framework/guides/support/error-codes.html#error-model-selection-range-intersects
{"addedRange":{"start":{"root":"main","path":[0,1,0],"stickiness":"toNext"},"end":{"root":"main","path":[0,1,1],"stickiness":"toPrevious"}},"intersectingRange":{"start":{"root":"main","path":[0,1,0],"stickiness":"toNext"},"end":{"root":"main","path":[0,1,1],"stickiness":"toPrevious"}}}
at LiveSelection._checkRange (http://localhost:8125/ckeditor5-table/tests/manual/tableselection.js:64801:11)
at LiveSelection._prepareRange (http://localhost:8125/ckeditor5-table/tests/manual/tableselection.js:51649:8)
at LiveSelection._fixGraveyardSelection (http://localhost:8125/ckeditor5-table/tests/manual/tableselection.js:51971:26)
at Model.LiveSelection.listenTo.priority (http://localhost:8125/ckeditor5-table/tests/manual/tableselection.js:51463:10)
at Model.fire (http://localhost:8125/ckeditor5-table/tests/manual/tableselection.js:124298:30)
at Model.<computed> [as applyOperation] (http://localhost:8125/ckeditor5-table/tests/manual/tableselection.js:126435:16)
at applyRemoveOperation (http://localhost:8125/ckeditor5-table/tests/manual/tableselection.js:69028:8)
at Writer.remove (http://localhost:8125/ckeditor5-table/tests/manual/tableselection.js:68013:4)
at http://localhost:8125/ckeditor5-table/tests/manual/tableselection.js:65925:11
at Model.change (http://localhost:8125/ckeditor5-table/tests/manual/tableselection.js:53798:12) tableutils.js:59 Uncaught TypeError: Cannot read property 'getChildIndex' of null
at TableUtils.getCellLocation (tableutils.js:59)
at TableSelection.getSelectedTableCells (tableselection.js:210)
at getSelectedTableCells.next (<anonymous>)
at TableSelection._updateModelSelection (tableselection.js:261)
at TableSelection.stopSelection (tableselection.js:177)
at MouseSelectionHandler._handleMouseMove (mouseselectionhandler.js:99)
at Document.<anonymous> (mouseselectionhandler.js:63)
at Document.fire (emittermixin.js:209)
at MouseEventsObserver.fire (domeventobserver.js:96)
at MouseEventsObserver.onDomEvent (mouseeventsobserver.js:42) Other info:
|
Thanks guys for the reports. I analysed them to understand which are related to the scope of this PR:
Since I'm quite confident that the issues that you found are either also reproducible on master/v17.0.0 or were covered by other PRs, I'm merging this. |
Suggested merge commit message (convention)
Other: Added a possibility to insert column or row with multiple selected cells. Closes ckeditor/ckeditor5#6125.
Additional information
As we're going to work with multi-range more, I believe it is a good idea to put a similar method to
getRangeContainedElement
in theRange
type at some point.I was unable to quickly find better assertions to asses model selection and data in the same call, so I used two separate method for both.
As expected, there are weird scenarios cellspan/rowspan, but at the same time it doesn't look that bad - so I didn't put too much energy into any adjustments in this area.