-
-
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
The findOptimalInsertionPosition() should use getTopMostBlocks() instead getSelectedBlocks() #4609
Comments
ps.: Changing the |
Haha :D Check out the history and timing of this issue: https://github.com/ckeditor/ckeditor5-engine/issues/826 |
I didn't know that we introduced
cc @scofalik |
@scofalik shares the same sentiments. Block quote may be a use case for the current behaviour of |
I couldn't find any feature that uses that deep structure, to be honest. The block quote feature actually uses the After renaming |
Other: Remove the `Selection#getTopMostBlocks()` method. Closes ckeditor/ckeditor5-widget#95. Closes ckeditor/ckeditor5-table#199. BREAKING CHANGE: The `Selection#getTopMostBlocks()` was removed from the public API. Use `Selection#getSelectedBlocks()` instead. BREAKING CHANGE: The `Selection#getSelectedBlocks()` does not return blocks nested in other blocks now.
I'm still battling with a more generic issue but it seems that
selection.getSelectedBlocks()
is causing some problems (https://github.com/ckeditor/ckeditor5-indent/issues/11, https://github.com/ckeditor/ckeditor5-table/issues/126 and the latest: https://github.com/ckeditor/ckeditor5-table/issues/199).Generally speaking the below use of this method:
in most cases will return the first block but in case of tables it will return first inner child of a parent block and the table.
So if a selection contains a table and a heading it will return:
For some algorithms (most?) we want to have top-most blocks (so the
selection.getTopMostBlocks()
should be used. Which would return only:@Reinmar I didn't dig much into it looks like most similar issues are related to that algorithm so either:
selection.getSelectedBlocks()
should return parent firstselection.getTopMostBlocks()
rather thanselection.getSelectedBlocks()
.The text was updated successfully, but these errors were encountered: