{"action":"closed","issue":{"url":"https://api.github.com/repos/ianstormtaylor/slate/issues/1730","repository_url":"https://api.github.com/repos/ianstormtaylor/slate","labels_url":"https://api.github.com/repos/ianstormtaylor/slate/issues/1730/labels{/name}","comments_url":"https://api.github.com/repos/ianstormtaylor/slate/issues/1730/comments","events_url":"https://api.github.com/repos/ianstormtaylor/slate/issues/1730/events","html_url":"https://github.com/ianstormtaylor/slate/issues/1730","id":309000024,"node_id":"MDU6SXNzdWUzMDkwMDAwMjQ=","number":1730,"title":"[Idea] Abstract Delta Operations","user":{"login":"bryanph","id":3816712,"node_id":"MDQ6VXNlcjM4MTY3MTI=","avatar_url":"https://avatars1.githubusercontent.com/u/3816712?v=4","gravatar_id":"","url":"https://api.github.com/users/bryanph","html_url":"https://github.com/bryanph","followers_url":"https://api.github.com/users/bryanph/followers","following_url":"https://api.github.com/users/bryanph/following{/other_user}","gists_url":"https://api.github.com/users/bryanph/gists{/gist_id}","starred_url":"https://api.github.com/users/bryanph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bryanph/subscriptions","organizations_url":"https://api.github.com/users/bryanph/orgs","repos_url":"https://api.github.com/users/bryanph/repos","events_url":"https://api.github.com/users/bryanph/events{/privacy}","received_events_url":"https://api.github.com/users/bryanph/received_events","type":"User","site_admin":false},"labels":[{"id":412790240,"node_id":"MDU6TGFiZWw0MTI3OTAyNDA=","url":"https://api.github.com/repos/ianstormtaylor/slate/labels/idea","name":"idea","color":"eeeeee","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-03-27T14:42:24Z","updated_at":"2018-10-20T08:48:54Z","closed_at":"2018-10-20T08:48:54Z","author_association":"CONTRIBUTOR","body":"This is basically the same as #1456, but I will describe an approach here in the hope to get some feedback and to start a discussion. This is a first (perhaps naive) attempt at describing a possible approach.\r\n\r\n### Reasons\r\n* For storing delta operations in a back-end, it would be more efficient to store abstract operations which can later be converted to detailed operations,\r\n* Allow undoing of user-defined groups of actions\r\n\r\n### Data structures\r\nTwo Operation datastructures:\r\n* Operation: the existing low-level operation designed to be minimally expressive\r\n* AbstractOperation: user-defined collection of Operations to be applied\r\n\r\n![image](https://user-images.githubusercontent.com/3816712/37973433-bd899cf8-31da-11e8-8e66-1a0de8d9bdfd.png)\r\nHere OP represents an Operations and Aop an AbstractOperation (sorry for the terrible camera quality (and drawing ability ;))). As you can see, Aop's are composable and the top-level nodes are the \"sources of truth\" so to say. These can then be unpacked into their original Op's to actually apply the changes by the editor.\r\n\r\n### Determining AbstractOperations from Operations\r\nWhen applying operations, these should then be converted to one AbstractOperation that represents the series of changes.\r\nFor example, when inserting a series of characters and we have an \"insertWord\" AbstractOperation; when the user adds characters, these should be combined into the \"insertWord\" AbstractOperation until the user presses \"space\", then when typing new letters, the operations will be combined in a separate AbstractOperation.\r\n\r\n### Code implications\r\n* These AbstractOperations must be registered somewhere so that the editor is able to determine AbstractOperations from Operations and can succesfully compose them.\r\n* This would replace the functionality here for merging Operations in the history (https://github.com/ianstormtaylor/slate/blob/3339d088e14ad0bf04a674c14834179403ae369f/packages/slate/src/models/history.js#L133)\r\nInstead, registered Abstract operations should be given the chance to allow merging of operations. The merging functionality for text as it works right now could be replaced by an AbstractOperation instance which represents the merged behaviour.\r\n\r\n### AbstractOperation data structure\r\n??? todo\r\n\r\n### Other possible solutions\r\n* Allow the user to give a \"label\" to a change object (which represents a series of change operations).\r\n\r\n\r\n\r\n\r\n"}}
{"actor":{"display_login":"bryanph"}}