-
-
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
How to handle undo and selection context change in features #3895
Comments
What about selection change being fired when the parent tree of the selection has changes? |
This is interesting question. For sure, listening to @fredck - this won't work. |
What we have right now are low-level selection events: Now, feature (and developers) need some nice API to handle their typical tasks – refreshing when context has changed and when attributes have changed, but including here data changes (which should include initial data load). Let's have a more useful set of |
Note: Thanks to having these events exposed in one place, we'll have just one listener to e.g. |
First thing to change after we introduce a new event: ckeditor/ckeditor5-heading#50 |
I am not sure we need a new event for this. When would it be fired? What it will solve? |
It would be fired when anything about the selection has changed – its context or attributes. Note that the context may change as a result of content changes while selection's ranges stay untouched. Rationale – potential performance issues. We're now refreshing all the commands on every single This means that this is not a super high priority ticket. However, it needs to be considered by every feature which needs to act on such a change. It can be added later (we'll just change the event) but please keep in mind that this won't be a backward compatible change. By switching from Regarding performance – this doesn't seem like a super heavy scenario, but I've seen how CKE4 is affected by too many checks done on "change". The problem here may be that if the content changes the browser needs to re-render the view, so it's pretty overloaded already if the content is long. Adding dozen of checks don't help. |
We again stumbled upon this. And by the feedback I got from @oleq I can see that it is confusing, but he got it right by himself. The issue was: https://github.com/ckeditor/ckeditor5-core/issues/50. Intuitively, someone (IIRC @scofalik, who, nota bene, knows the engine extremely well) used Unfortunately, just like In all cases, these were our mistakes. However, we made them. So the question is whether we shouldn't have a better, safer event and warnings in these events' docs that they are limited. |
I confirmed the issue because we need to do something. The minimum is adding some warnings in the docs. |
There has been no activity on this issue for the past year. We've marked it as stale and will close it in 30 days. We understand it may be relevant, so if you're interested in the solution, leave a comment or reaction under this issue. |
We've closed your issue due to inactivity over the last year. We understand that the issue may still be relevant. If so, feel free to open a new one (and link this issue to it). |
Some features (
heading
for example) are listening on model's selection change events to update command's state (and UI). What would be the best way to handle such situation:paragraph
:heading
command is executed, block type is changed, UI is updated:undo
command is executed,heading1
is converted back toparagraph
.This is fine but there is no selection change event (because there is no selection change, it's more a selection context change), so how command can be notified about this change? Should we listen also to document change event?
The text was updated successfully, but these errors were encountered: