-
-
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
Table selection should hook into model's deleteContent() and insertContent(), not the commands #6356
Comments
I pushed 3 branches: But I came across this problem:
TL;DR we may still need to hook into const deleteContentSelection = model.deleteContent( selection, {
doNotResetEntireContent,
direction: this.direction
} );
// ...
writer.setSelection( deleteContentSelection || selection ); |
First of all, the hook should not check things like I wanted to report earlier that the The other problem with that hook, which is an off topic, but which I just notice and which we'll need to resolve at some point is that |
What I wrote above will solve your first issue – if the hook will be stateless, then it will care only about the passed selection. It will iterate over ranges and handle those which contain cells. The corner case here is – one range contains a cell, the other is some random range. What should happen? I don't care :D This should never happen but we don't have a mechanism which prevents that. So, we can have this hook working like that – it does something with ranges which contain cells and just skip other ranges. |
LOL 😂I've just read through this and it seems that I already gave the answer to that in my previous comments (by coincident).
It does not. It sets the selection to the selection that it passed to Where's the problem? The current implementation of the hook changes the document selection instead of indicating where it would put it via changing the passed standalone selection. Then, when So, once again if the hook will correctly distinguish document and standard selection, this will probably work just fine. In that specific case, |
Docs: Extended `Model#deleteContent()` docs with an information about the direction option (see ckeditor/ckeditor5#6356, ckeditor/ckeditor5#6355).
Other: `DeleteCommand` should pass its direction to `Model#deleteContent()`. Closes ckeditor/ckeditor5#6355. See ckeditor/ckeditor5#6356.
Internal: Dropped `DeleteCommand` hooks in favor of the `Model#deleteContent()` hook in the `TableSelection` plugin. Improved `deleteContent()` integration tests. Closes ckeditor/ckeditor5#6356.
📝 Provide a description of the improvement
Followup for ckeditor/ckeditor5-table#254.
The base methods are the place to hook in. They are the building blocks for more features.
This issue is a part of #6328 which is a broder topic (to ensure that the base functions work well too). Here, we should focus on making the ckeditor5-table extending the right thing.
If you'd like to see this improvement implemented, add a 👍 reaction to this post.
The text was updated successfully, but these errors were encountered: