{"action":"created","issue":{"url":"https://api.github.com/repos/y-js/y-richtext/issues/112","repository_url":"https://api.github.com/repos/y-js/y-richtext","labels_url":"https://api.github.com/repos/y-js/y-richtext/issues/112/labels{/name}","comments_url":"https://api.github.com/repos/y-js/y-richtext/issues/112/comments","events_url":"https://api.github.com/repos/y-js/y-richtext/issues/112/events","html_url":"https://github.com/y-js/y-richtext/issues/112","id":150149030,"number":112,"title":"Peer Cursors","user":{"login":"Joeao","id":2255423,"avatar_url":"https://avatars.githubusercontent.com/u/2255423?v=3","gravatar_id":"","url":"https://api.github.com/users/Joeao","html_url":"https://github.com/Joeao","followers_url":"https://api.github.com/users/Joeao/followers","following_url":"https://api.github.com/users/Joeao/following{/other_user}","gists_url":"https://api.github.com/users/Joeao/gists{/gist_id}","starred_url":"https://api.github.com/users/Joeao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Joeao/subscriptions","organizations_url":"https://api.github.com/users/Joeao/orgs","repos_url":"https://api.github.com/users/Joeao/repos","events_url":"https://api.github.com/users/Joeao/events{/privacy}","received_events_url":"https://api.github.com/users/Joeao/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-04-21T18:10:57Z","updated_at":"2016-05-21T21:57:20Z","closed_at":null,"body":"Rather than place user data into YJS, I've placed YJS data (YJS User ID) into my user data object as user data is used just as much outside of YJS as inside. In order to keep track of which user is carrying out an action and where specifically, I've needed to make a few changes to both yjs/y-richtext and yjs/y-array.\r\n\r\n[y-richtext commit](https://github.com/Joeao/y-richtext/commit/927550610fc73b7f6c0f4b9674c9450916d1ffc8)\r\nAdded the real position of the addition/deletion to the event, as this is what Quill's multi-cursor cares about.\r\n\r\n[y-array commit](https://github.com/Joeao/y-array/commit/50eed967eb6a335abe0b3994db1696415366a5f6)\r\nReimplemented valueID on insert, which has been deleted since the latest release, and added it into deletion.\r\n\r\nI've not straight up made a pull request for the following reasons:\r\n1. You gave a reason why valueID isn't included in deletion, I just can't remember why.\r\n2. I'm not convinced that the y-array commit is inline with your future plans, seeing as you'd removed valueID from insert.\r\n3. The upcoming update will almost definitely change the results after these changes, hopefully for the better (See pasting of text in the gif below)\r\n\r\nThe code outside of YJS used to enable this is as follows:\r\n```javascript\r\nnewMap.observe(function(events) {\r\n    for(var i in events) {\r\n        var quill = newMap.instances[0].editor;\r\n        if(quill && events[i].valueId) {\r\n            var user = Objects.getPeerDetailsByYID(JSON.parse(events[i].valueId)[0]);\r\n\r\n            // Ensures cursor update isn't coming from this user\r\n            if(user.id != Properties.userID) {\r\n                quill.modules['multi-cursor'].setCursor(user.id, Math.max(events[i].pos + events[i].length, 0), user.firstName + ' ' + user.lastName, '#' + user.color.substring(2));\r\n            }\r\n        }\r\n    }\r\n})\r\n```\r\n\r\nHere's a gif of results after making these changes.\r\n\r\n![cursors](https://cloud.githubusercontent.com/assets/2255423/14719382/1a5cd44e-0826-11e6-8a1b-2b32b8431c6d.gif)\r\n\r\nLet me know if this is going down the right road, or if you can suggest a better way of doing this.\r\n"},"comment":{"url":"https://api.github.com/repos/y-js/y-richtext/issues/comments/220802494","html_url":"https://github.com/y-js/y-richtext/issues/112#issuecomment-220802494","issue_url":"https://api.github.com/repos/y-js/y-richtext/issues/112","id":220802494,"user":{"login":"Joeao","id":2255423,"avatar_url":"https://avatars.githubusercontent.com/u/2255423?v=3","gravatar_id":"","url":"https://api.github.com/users/Joeao","html_url":"https://github.com/Joeao","followers_url":"https://api.github.com/users/Joeao/followers","following_url":"https://api.github.com/users/Joeao/following{/other_user}","gists_url":"https://api.github.com/users/Joeao/gists{/gist_id}","starred_url":"https://api.github.com/users/Joeao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Joeao/subscriptions","organizations_url":"https://api.github.com/users/Joeao/orgs","repos_url":"https://api.github.com/users/Joeao/repos","events_url":"https://api.github.com/users/Joeao/events{/privacy}","received_events_url":"https://api.github.com/users/Joeao/received_events","type":"User","site_admin":false},"created_at":"2016-05-21T21:57:20Z","updated_at":"2016-05-21T21:57:20Z","body":"Just some updated info on this: multi-cursor support has been removed from Quill in 1.0 and will be reimplement in a future update as explained here: https://github.com/quilljs/quill/issues/635"}}
{"actor":{"display_login":"Joeao"}}