-
-
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
Simplify batches/deltas and change event #3882
Comments
https://github.com/ckeditor/ckeditor5-engine/issues/678 describes the bigger picture of this change. |
Quick thought, without much of an analysis: Each delta module should expose a function called like today's model.batch().insert( what, where ); you'd do: const batch = model.createBatch();
insert( batch, what, where ); That
We have hundreds of |
Reviewing ckeditor/ckeditor5-engine#793 I realized that we should also update the change event. Now it's very messy. It could be fired not per operation, but per delta and contains operations as internal. Fortunately, because big part of the code is listening on the dispatcher, not on the change event, it might be not that hard to change as it looks like. |
That's a part of a whole topic – https://github.com/ckeditor/ckeditor5-engine/issues/678. |
Fixing https://github.com/ckeditor/ckeditor5-engine/issues/1099 we decided to fire change event also when there is no real change (for instance rename to the same value). This is because there is no other event which let you notice that operation was applied and some plugins need such information. We should consider having a more abstract |
A case that we need to consider here is that people will try to use the E.g. see #599 (comment). This code is not only unnecessarily slow but also dangerous because after some changes If we'll introduce API for postfixer there's a chance that we should hide the atomic |
It's partially fixed by https://github.com/ckeditor/ckeditor5-engine/issues/858, https://github.com/ckeditor/ckeditor5-engine/issues/1172 and https://github.com/ckeditor/ckeditor5-engine/issues/1186. The rest will be fixed by https://github.com/ckeditor/ckeditor5-engine/issues/1207 and https://github.com/ckeditor/ckeditor5-engine/issues/1162. We can close this ticket. |
I do not believe anymore that users will create their own Deltas. It will not gonna happen. So we can simplify this piece of the API:
register
to the delta constructor,ModelDocument.applyDelta
https://github.com/ckeditor/ckeditor5-engine/issues/500 (@scofalik will be happy).I'm not sure about two thinks:
Batch
,Delta
andapplyDelta
should look like: do I need to passBatch
to theDelta
constructor? Do I need to addDelta
to theBatch
? In fact, I need to add delta to the batch and apply it at the same time so, maybe I should pass bothDelta
andBatch
to theapplyDelta
and it will add delta to the batch? Or addingDelta
to theBatch
should apply it sinceBatch
knows about the document?Delta
class won't it be a problem for the OT where we need to create a delta in a custom way? The simplest solution would be to keep the constructor empty and move theregister
logic to theinit
method, which can not be called in the OT, but then we make the API more complicated again.The text was updated successfully, but these errors were encountered: