{"action":"closed","number":2522,"pull_request":{"url":"https://api.github.com/repos/ianstormtaylor/slate/pulls/2522","id":242105219,"node_id":"MDExOlB1bGxSZXF1ZXN0MjQyMTA1MjE5","html_url":"https://github.com/ianstormtaylor/slate/pull/2522","diff_url":"https://github.com/ianstormtaylor/slate/pull/2522.diff","patch_url":"https://github.com/ianstormtaylor/slate/pull/2522.patch","issue_url":"https://api.github.com/repos/ianstormtaylor/slate/issues/2522","number":2522,"state":"closed","locked":false,"title":"Refactor to utils","user":{"login":"thesunny","id":469587,"node_id":"MDQ6VXNlcjQ2OTU4Nw==","avatar_url":"https://avatars2.githubusercontent.com/u/469587?v=4","gravatar_id":"","url":"https://api.github.com/users/thesunny","html_url":"https://github.com/thesunny","followers_url":"https://api.github.com/users/thesunny/followers","following_url":"https://api.github.com/users/thesunny/following{/other_user}","gists_url":"https://api.github.com/users/thesunny/gists{/gist_id}","starred_url":"https://api.github.com/users/thesunny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thesunny/subscriptions","organizations_url":"https://api.github.com/users/thesunny/orgs","repos_url":"https://api.github.com/users/thesunny/repos","events_url":"https://api.github.com/users/thesunny/events{/privacy}","received_events_url":"https://api.github.com/users/thesunny/received_events","type":"User","site_admin":false},"body":"#### Is this adding or improving a _feature_ or fixing a _bug_?\r\n\r\nRefactored methods to utils in preparation for adding Android mobile support.\r\n\r\n#### What's the new behavior?\r\n\r\nApart from refactoring to make the code more reusable, I changed the set selection code after a spelling correction (in `after.js` on the `onInput` method). It used to move the cursor to the end of the change. I've changed it so that it sets the cursor position to be the same as in the DOM. In other words, the browser decides the behavior of where the cursor should be which makes Slate behave the way the browser natively behaves.\r\n\r\nThis same logic will be used when I implement the Android composition handling.\r\n\r\n#### How does this change work?\r\n\r\nMostly, this just creates two new methods in `utils` called `set-selection-from-dom` and `set-text-from-dom-node`.\r\n\r\nThe `onInput` method calls `set-text-from-dom-node` then `set-selection-from-dom`. These are mostly just refactoring of existing methods. Also `set-selection-from-dom` is called from the `onFocus` method.\r\n\r\n#### Have you checked that...?\r\n\r\n* [x] The new code matches the existing patterns and styles.\r\n* [x] The tests pass with `yarn test`.\r\n* [x] The linter passes with `yarn lint`. (Fix errors with `yarn prettier`.)\r\n* [x] The relevant examples still work. (Run examples with `yarn watch`.)\r\n\r\n#### Does this fix any issues or need any specific reviewers?\r\n\r\nDoes not fix, but is in preparation for https://github.com/ianstormtaylor/slate/issues/2062 as well as almost all the other issues related to Android and mobile.","created_at":"2019-01-03T20:41:59Z","updated_at":"2019-01-04T20:02:34Z","closed_at":"2019-01-04T20:02:34Z","merged_at":"2019-01-04T20:02:34Z","merge_commit_sha":"92c1ffbcd32dca0a527f2f630b374db598fbdc8b","assignee":null,"assignees":[],"requested_reviewers":[{"login":"ianstormtaylor","id":311752,"node_id":"MDQ6VXNlcjMxMTc1Mg==","avatar_url":"https://avatars0.githubusercontent.com/u/311752?v=4","gravatar_id":"","url":"https://api.github.com/users/ianstormtaylor","html_url":"https://github.com/ianstormtaylor","followers_url":"https://api.github.com/users/ianstormtaylor/followers","following_url":"https://api.github.com/users/ianstormtaylor/following{/other_user}","gists_url":"https://api.github.com/users/ianstormtaylor/gists{/gist_id}","starred_url":"https://api.github.com/users/ianstormtaylor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ianstormtaylor/subscriptions","organizations_url":"https://api.github.com/users/ianstormtaylor/orgs","repos_url":"https://api.github.com/users/ianstormtaylor/repos","events_url":"https://api.github.com/users/ianstormtaylor/events{/privacy}","received_events_url":"https://api.github.com/users/ianstormtaylor/received_events","type":"User","site_admin":false},{"login":"Soreine","id":5644953,"node_id":"MDQ6VXNlcjU2NDQ5NTM=","avatar_url":"https://avatars0.githubusercontent.com/u/5644953?v=4","gravatar_id":"","url":"https://api.github.com/users/Soreine","html_url":"https://github.com/Soreine","followers_url":"https://api.github.com/users/Soreine/followers","following_url":"https://api.github.com/users/Soreine/following{/other_user}","gists_url":"https://api.github.com/users/Soreine/gists{/gist_id}","starred_url":"https://api.github.com/users/Soreine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Soreine/subscriptions","organizations_url":"https://api.github.com/users/Soreine/orgs","repos_url":"https://api.github.com/users/Soreine/repos","events_url":"https://api.github.com/users/Soreine/events{/privacy}","received_events_url":"https://api.github.com/users/Soreine/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/ianstormtaylor/slate/pulls/2522/commits","review_comments_url":"https://api.github.com/repos/ianstormtaylor/slate/pulls/2522/comments","review_comment_url":"https://api.github.com/repos/ianstormtaylor/slate/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ianstormtaylor/slate/issues/2522/comments","statuses_url":"https://api.github.com/repos/ianstormtaylor/slate/statuses/c0fceff31a03c3f6baa94657e89b2b38526f70f1","head":{"label":"thesunny:refactor-to-utils","ref":"refactor-to-utils","sha":"c0fceff31a03c3f6baa94657e89b2b38526f70f1","user":{"login":"thesunny","id":469587,"node_id":"MDQ6VXNlcjQ2OTU4Nw==","avatar_url":"https://avatars2.githubusercontent.com/u/469587?v=4","gravatar_id":"","url":"https://api.github.com/users/thesunny","html_url":"https://github.com/thesunny","followers_url":"https://api.github.com/users/thesunny/followers","following_url":"https://api.github.com/users/thesunny/following{/other_user}","gists_url":"https://api.github.com/users/thesunny/gists{/gist_id}","starred_url":"https://api.github.com/users/thesunny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thesunny/subscriptions","organizations_url":"https://api.github.com/users/thesunny/orgs","repos_url":"https://api.github.com/users/thesunny/repos","events_url":"https://api.github.com/users/thesunny/events{/privacy}","received_events_url":"https://api.github.com/users/thesunny/received_events","type":"User","site_admin":false},"repo":{"id":75022028,"node_id":"MDEwOlJlcG9zaXRvcnk3NTAyMjAyOA==","name":"slate","full_name":"thesunny/slate","private":false,"owner":{"login":"thesunny","id":469587,"node_id":"MDQ6VXNlcjQ2OTU4Nw==","avatar_url":"https://avatars2.githubusercontent.com/u/469587?v=4","gravatar_id":"","url":"https://api.github.com/users/thesunny","html_url":"https://github.com/thesunny","followers_url":"https://api.github.com/users/thesunny/followers","following_url":"https://api.github.com/users/thesunny/following{/other_user}","gists_url":"https://api.github.com/users/thesunny/gists{/gist_id}","starred_url":"https://api.github.com/users/thesunny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thesunny/subscriptions","organizations_url":"https://api.github.com/users/thesunny/orgs","repos_url":"https://api.github.com/users/thesunny/repos","events_url":"https://api.github.com/users/thesunny/events{/privacy}","received_events_url":"https://api.github.com/users/thesunny/received_events","type":"User","site_admin":false},"html_url":"https://github.com/thesunny/slate","description":"A completely customizable framework for building rich text editors.","fork":true,"url":"https://api.github.com/repos/thesunny/slate","forks_url":"https://api.github.com/repos/thesunny/slate/forks","keys_url":"https://api.github.com/repos/thesunny/slate/keys{/key_id}","collaborators_url":"https://api.github.com/repos/thesunny/slate/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/thesunny/slate/teams","hooks_url":"https://api.github.com/repos/thesunny/slate/hooks","issue_events_url":"https://api.github.com/repos/thesunny/slate/issues/events{/number}","events_url":"https://api.github.com/repos/thesunny/slate/events","assignees_url":"https://api.github.com/repos/thesunny/slate/assignees{/user}","branches_url":"https://api.github.com/repos/thesunny/slate/branches{/branch}","tags_url":"https://api.github.com/repos/thesunny/slate/tags","blobs_url":"https://api.github.com/repos/thesunny/slate/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/thesunny/slate/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/thesunny/slate/git/refs{/sha}","trees_url":"https://api.github.com/repos/thesunny/slate/git/trees{/sha}","statuses_url":"https://api.github.com/repos/thesunny/slate/statuses/{sha}","languages_url":"https://api.github.com/repos/thesunny/slate/languages","stargazers_url":"https://api.github.com/repos/thesunny/slate/stargazers","contributors_url":"https://api.github.com/repos/thesunny/slate/contributors","subscribers_url":"https://api.github.com/repos/thesunny/slate/subscribers","subscription_url":"https://api.github.com/repos/thesunny/slate/subscription","commits_url":"https://api.github.com/repos/thesunny/slate/commits{/sha}","git_commits_url":"https://api.github.com/repos/thesunny/slate/git/commits{/sha}","comments_url":"https://api.github.com/repos/thesunny/slate/comments{/number}","issue_comment_url":"https://api.github.com/repos/thesunny/slate/issues/comments{/number}","contents_url":"https://api.github.com/repos/thesunny/slate/contents/{+path}","compare_url":"https://api.github.com/repos/thesunny/slate/compare/{base}...{head}","merges_url":"https://api.github.com/repos/thesunny/slate/merges","archive_url":"https://api.github.com/repos/thesunny/slate/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/thesunny/slate/downloads","issues_url":"https://api.github.com/repos/thesunny/slate/issues{/number}","pulls_url":"https://api.github.com/repos/thesunny/slate/pulls{/number}","milestones_url":"https://api.github.com/repos/thesunny/slate/milestones{/number}","notifications_url":"https://api.github.com/repos/thesunny/slate/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/thesunny/slate/labels{/name}","releases_url":"https://api.github.com/repos/thesunny/slate/releases{/id}","deployments_url":"https://api.github.com/repos/thesunny/slate/deployments","created_at":"2016-11-28T23:02:41Z","updated_at":"2018-12-29T00:12:51Z","pushed_at":"2019-01-03T20:35:28Z","git_url":"git://github.com/thesunny/slate.git","ssh_url":"git@github.com:thesunny/slate.git","clone_url":"https://github.com/thesunny/slate.git","svn_url":"https://github.com/thesunny/slate","homepage":"http://slatejs.org","size":64507,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ianstormtaylor:master","ref":"master","sha":"6f41f2e8e9f010cf4d26a00728e5d7b12f239578","user":{"login":"ianstormtaylor","id":311752,"node_id":"MDQ6VXNlcjMxMTc1Mg==","avatar_url":"https://avatars0.githubusercontent.com/u/311752?v=4","gravatar_id":"","url":"https://api.github.com/users/ianstormtaylor","html_url":"https://github.com/ianstormtaylor","followers_url":"https://api.github.com/users/ianstormtaylor/followers","following_url":"https://api.github.com/users/ianstormtaylor/following{/other_user}","gists_url":"https://api.github.com/users/ianstormtaylor/gists{/gist_id}","starred_url":"https://api.github.com/users/ianstormtaylor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ianstormtaylor/subscriptions","organizations_url":"https://api.github.com/users/ianstormtaylor/orgs","repos_url":"https://api.github.com/users/ianstormtaylor/repos","events_url":"https://api.github.com/users/ianstormtaylor/events{/privacy}","received_events_url":"https://api.github.com/users/ianstormtaylor/received_events","type":"User","site_admin":false},"repo":{"id":61412022,"node_id":"MDEwOlJlcG9zaXRvcnk2MTQxMjAyMg==","name":"slate","full_name":"ianstormtaylor/slate","private":false,"owner":{"login":"ianstormtaylor","id":311752,"node_id":"MDQ6VXNlcjMxMTc1Mg==","avatar_url":"https://avatars0.githubusercontent.com/u/311752?v=4","gravatar_id":"","url":"https://api.github.com/users/ianstormtaylor","html_url":"https://github.com/ianstormtaylor","followers_url":"https://api.github.com/users/ianstormtaylor/followers","following_url":"https://api.github.com/users/ianstormtaylor/following{/other_user}","gists_url":"https://api.github.com/users/ianstormtaylor/gists{/gist_id}","starred_url":"https://api.github.com/users/ianstormtaylor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ianstormtaylor/subscriptions","organizations_url":"https://api.github.com/users/ianstormtaylor/orgs","repos_url":"https://api.github.com/users/ianstormtaylor/repos","events_url":"https://api.github.com/users/ianstormtaylor/events{/privacy}","received_events_url":"https://api.github.com/users/ianstormtaylor/received_events","type":"User","site_admin":false},"html_url":"https://github.com/ianstormtaylor/slate","description":"A completely customizable framework for building rich text editors.","fork":false,"url":"https://api.github.com/repos/ianstormtaylor/slate","forks_url":"https://api.github.com/repos/ianstormtaylor/slate/forks","keys_url":"https://api.github.com/repos/ianstormtaylor/slate/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ianstormtaylor/slate/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ianstormtaylor/slate/teams","hooks_url":"https://api.github.com/repos/ianstormtaylor/slate/hooks","issue_events_url":"https://api.github.com/repos/ianstormtaylor/slate/issues/events{/number}","events_url":"https://api.github.com/repos/ianstormtaylor/slate/events","assignees_url":"https://api.github.com/repos/ianstormtaylor/slate/assignees{/user}","branches_url":"https://api.github.com/repos/ianstormtaylor/slate/branches{/branch}","tags_url":"https://api.github.com/repos/ianstormtaylor/slate/tags","blobs_url":"https://api.github.com/repos/ianstormtaylor/slate/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ianstormtaylor/slate/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ianstormtaylor/slate/git/refs{/sha}","trees_url":"https://api.github.com/repos/ianstormtaylor/slate/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ianstormtaylor/slate/statuses/{sha}","languages_url":"https://api.github.com/repos/ianstormtaylor/slate/languages","stargazers_url":"https://api.github.com/repos/ianstormtaylor/slate/stargazers","contributors_url":"https://api.github.com/repos/ianstormtaylor/slate/contributors","subscribers_url":"https://api.github.com/repos/ianstormtaylor/slate/subscribers","subscription_url":"https://api.github.com/repos/ianstormtaylor/slate/subscription","commits_url":"https://api.github.com/repos/ianstormtaylor/slate/commits{/sha}","git_commits_url":"https://api.github.com/repos/ianstormtaylor/slate/git/commits{/sha}","comments_url":"https://api.github.com/repos/ianstormtaylor/slate/comments{/number}","issue_comment_url":"https://api.github.com/repos/ianstormtaylor/slate/issues/comments{/number}","contents_url":"https://api.github.com/repos/ianstormtaylor/slate/contents/{+path}","compare_url":"https://api.github.com/repos/ianstormtaylor/slate/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ianstormtaylor/slate/merges","archive_url":"https://api.github.com/repos/ianstormtaylor/slate/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ianstormtaylor/slate/downloads","issues_url":"https://api.github.com/repos/ianstormtaylor/slate/issues{/number}","pulls_url":"https://api.github.com/repos/ianstormtaylor/slate/pulls{/number}","milestones_url":"https://api.github.com/repos/ianstormtaylor/slate/milestones{/number}","notifications_url":"https://api.github.com/repos/ianstormtaylor/slate/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ianstormtaylor/slate/labels{/name}","releases_url":"https://api.github.com/repos/ianstormtaylor/slate/releases{/id}","deployments_url":"https://api.github.com/repos/ianstormtaylor/slate/deployments","created_at":"2016-06-18T01:52:42Z","updated_at":"2019-01-04T17:55:06Z","pushed_at":"2019-01-04T20:02:34Z","git_url":"git://github.com/ianstormtaylor/slate.git","ssh_url":"git@github.com:ianstormtaylor/slate.git","clone_url":"https://github.com/ianstormtaylor/slate.git","svn_url":"https://github.com/ianstormtaylor/slate","homepage":"http://slatejs.org","size":225596,"stargazers_count":12779,"watchers_count":12779,"language":"JavaScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":1000,"mirror_url":null,"archived":false,"open_issues_count":295,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":1000,"open_issues":295,"watchers":12779,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ianstormtaylor/slate/pulls/2522"},"html":{"href":"https://github.com/ianstormtaylor/slate/pull/2522"},"issue":{"href":"https://api.github.com/repos/ianstormtaylor/slate/issues/2522"},"comments":{"href":"https://api.github.com/repos/ianstormtaylor/slate/issues/2522/comments"},"review_comments":{"href":"https://api.github.com/repos/ianstormtaylor/slate/pulls/2522/comments"},"review_comment":{"href":"https://api.github.com/repos/ianstormtaylor/slate/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ianstormtaylor/slate/pulls/2522/commits"},"statuses":{"href":"https://api.github.com/repos/ianstormtaylor/slate/statuses/c0fceff31a03c3f6baa94657e89b2b38526f70f1"}},"author_association":"COLLABORATOR","merged":true,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":{"login":"thesunny","id":469587,"node_id":"MDQ6VXNlcjQ2OTU4Nw==","avatar_url":"https://avatars2.githubusercontent.com/u/469587?v=4","gravatar_id":"","url":"https://api.github.com/users/thesunny","html_url":"https://github.com/thesunny","followers_url":"https://api.github.com/users/thesunny/followers","following_url":"https://api.github.com/users/thesunny/following{/other_user}","gists_url":"https://api.github.com/users/thesunny/gists{/gist_id}","starred_url":"https://api.github.com/users/thesunny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thesunny/subscriptions","organizations_url":"https://api.github.com/users/thesunny/orgs","repos_url":"https://api.github.com/users/thesunny/repos","events_url":"https://api.github.com/users/thesunny/events{/privacy}","received_events_url":"https://api.github.com/users/thesunny/received_events","type":"User","site_admin":false},"comments":1,"review_comments":0,"maintainer_can_modify":false,"commits":7,"additions":140,"deletions":128,"changed_files":4}}
{"actor":{"display_login":"thesunny"}}