-
-
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
Introduce ModelDocument.applyDelta #3768
Comments
Although such method would be useful for OT I am unsure how do you see regular deltas working with it. For instance what split delta do is creating a new element and moving nodes to this element. The element need to be created, so the insert operation need to be applied, to move nodes to it. We could create a move operation on the future position, not existing yet, but it makes deltas creation much more complicated. |
It's not like creating deltas is your everyday bread and butter and it's not like it becomes 10 lines of code instead of 1. We will need some improvements in this part of API soon anyway, so I'd keep it in milestone 0.2 as it is and we can discuss it. |
We have two ways to create deltas:
This causes problems. I.e. in There are more and more reasons to introduce And as far as |
And what's the reason for how the API looks currently? |
Historical reasons. We first had operations and we based editors foundations on them, without knowing if deltas are good idea. |
C'mon. It's not a historical reason. This is to let you create deltas in an easy way: creating operation one after another. So now you:
If we want to apply the whole delta you need to create operation 2 in the way it will work fine on the different state of the document. And the idea is that the delta API is scalable, any plugin should be able to create and add delta. And calculating position seems to be tricky for 3-rd party develpers. On the other hand, to be honest, I do not believe that 3-rd party developers will create new deltas, so |
Well, we kept |
Since we will change deltas to operations, this issue is invalid. |
We should introduce
applyDelta
method inengine.model.Document
and use it from now on. We decided that operations should always be applied in deltas. Not having such method right now cripples us a bit, because in many places of code we need to make redundant loops through all operations in delta + we don't have a one way to inform the editor that delta was applied (from start to end). We need this for OT plugin, because OT should recognize when delta starts and when delta ends and should send operations packed in deltas.The text was updated successfully, but these errors were encountered: