-
Notifications
You must be signed in to change notification settings - Fork 40
T/ckeditor5 widget/95: Remove the getTopMostBlocks() method #1770
Conversation
Oh.. I'll check what is wrong with the build. |
OK.. the block-quote have to be checked-out also :/ Tests run locally just fine. |
There's one thing that should be noted about the changes. Previously, when you made selection like this: Now, it won't happen because always the top blocks are returned. I think that's actually for good. I didn't like the previous behavior even though you could argue that it is technically correct (those cells were selected, sooo... 🤷♂they got changed to heading 🤷♂). However, this can be discussed if we are not missing something with this change of behavior. Other than that R+ from me. |
@Reinmar so the main work is done. I have only one doubt with @scofalik comments on this case:
As at this moment it will return
it will return A, B, C (so will omit the X & Y). Now I have no opinion on that - is it OK or not? We do not encurage such constructs but only the Sooo maybe the |
I'm not 100% sure what should be the expected behaviour here regarding nested blocks. Since it's so hard to understand this, let's simply wait for use cases. |
Suggested merge commit message (convention)
Other: Remove the
selection.getTopMostBlocks()
. Closes ckeditor/ckeditor5#4609. Closes ckeditor/ckeditor5#3276.BREAKING CHANGE: The
selection.getTopMostBlocks()
was removed from the public API. Useselection.getSelectedBlocks()
instead.BREAKING CHANGE: The
selection.getSelectedBlocks()
does not return blocks nested in other blocks now.Additional information
Changes in other repositories:
After some tests & digging I came to mind that
getSelectedBlocks()
should work asgetTopMostBlock()
so it does not return blocks nested in other blocks but it will search for blocks if they are nested in other non-block elements.most of the tests were refactored from the old ones - I've used the
element#contents
notation in order to properly check the cases.I've requested you both SC & PK for reviews since I'd like to have double feedback :)