{"action":"created","issue":{"url":"https://api.github.com/repos/ckeditor/ckeditor5-engine/issues/500","repository_url":"https://api.github.com/repos/ckeditor/ckeditor5-engine","labels_url":"https://api.github.com/repos/ckeditor/ckeditor5-engine/issues/500/labels{/name}","comments_url":"https://api.github.com/repos/ckeditor/ckeditor5-engine/issues/500/comments","events_url":"https://api.github.com/repos/ckeditor/ckeditor5-engine/issues/500/events","html_url":"https://github.com/ckeditor/ckeditor5-engine/issues/500","id":162118334,"number":500,"title":"Introduce ModelDocument.applyDelta","user":{"login":"scofalik","id":1502228,"avatar_url":"https://avatars.githubusercontent.com/u/1502228?v=3","gravatar_id":"","url":"https://api.github.com/users/scofalik","html_url":"https://github.com/scofalik","followers_url":"https://api.github.com/users/scofalik/followers","following_url":"https://api.github.com/users/scofalik/following{/other_user}","gists_url":"https://api.github.com/users/scofalik/gists{/gist_id}","starred_url":"https://api.github.com/users/scofalik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scofalik/subscriptions","organizations_url":"https://api.github.com/users/scofalik/orgs","repos_url":"https://api.github.com/users/scofalik/repos","events_url":"https://api.github.com/users/scofalik/events{/privacy}","received_events_url":"https://api.github.com/users/scofalik/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ckeditor/ckeditor5-engine/labels/status:discussion","name":"status:discussion","color":"e6e6e6"},{"url":"https://api.github.com/repos/ckeditor/ckeditor5-engine/labels/type:feature","name":"type:feature","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-06-24T10:21:25Z","updated_at":"2016-09-07T12:41:36Z","closed_at":null,"body":"We should introduce `applyDelta` method in `engine.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."},"comment":{"url":"https://api.github.com/repos/ckeditor/ckeditor5-engine/issues/comments/245268039","html_url":"https://github.com/ckeditor/ckeditor5-engine/issues/500#issuecomment-245268039","issue_url":"https://api.github.com/repos/ckeditor/ckeditor5-engine/issues/500","id":245268039,"user":{"login":"scofalik","id":1502228,"avatar_url":"https://avatars.githubusercontent.com/u/1502228?v=3","gravatar_id":"","url":"https://api.github.com/users/scofalik","html_url":"https://github.com/scofalik","followers_url":"https://api.github.com/users/scofalik/followers","following_url":"https://api.github.com/users/scofalik/following{/other_user}","gists_url":"https://api.github.com/users/scofalik/gists{/gist_id}","starred_url":"https://api.github.com/users/scofalik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scofalik/subscriptions","organizations_url":"https://api.github.com/users/scofalik/orgs","repos_url":"https://api.github.com/users/scofalik/repos","events_url":"https://api.github.com/users/scofalik/events{/privacy}","received_events_url":"https://api.github.com/users/scofalik/received_events","type":"User","site_admin":false},"created_at":"2016-09-07T12:41:36Z","updated_at":"2016-09-07T12:41:36Z","body":"We have two ways to create deltas:\r\n1. Through `Batch` API - then each operation is created \"alone\", added and applied to the document, one after one.\r\n2. Through Collaborative Editing and `Undo` - then the whole delta is created at once by operational transformation. When you apply first operation of such delta, it already has all other operations added.\r\n\r\nThis causes problems. I.e. in `Typing` feature, in `ChangeBuffer` class, it checked whether there is one operation in the batch. That caused a bug, because deltas created in `Undo` did not pass that check and in return did not reset `ChangeBuffer` batch.\r\n\r\nThere are more and more reasons to introduce `applyDelta` and get rid off operation-by-operation approach. Honestly, I multiple times had to write some work-around code because of how deltas were written originally.\r\n\r\nAnd as far as `SplitDelta` or `MergeDelta` are concerned. It is very easy to calculate positions for operations inside those deltas, so this will not be a problem."}}
{"actor":{"display_login":"scofalik"}}