{"action":"created","comment":{"url":"https://api.github.com/repos/bustlelabs/content-kit-editor/pulls/comments/36539715","id":36539715,"diff_hunk":"@@ -19,6 +20,53 @@ export default class Post {\n     this.insertSectionAfter(newSection, section);\n     this.removeSection(section);\n   }\n+  cutMarkers(markers) {\n+    let firstSection = markers[0].section,\n+        lastSection  = markers[markers.length - 1].section;\n+\n+    let currentSection = firstSection;\n+    let removedSections = [],\n+        changedSections = [firstSection, lastSection];\n+\n+    let previousMarker = markers[0].previousSibling;\n+\n+    markers.forEach(marker => {\n+      if (marker.section !== currentSection) { // this marker is in a section we haven't seen yet\n+        if (marker.section !== firstSection &&\n+            marker.section !== lastSection) {\n+          // section is wholly contained by markers, and can be removed\n+          removedSections.push(marker.section);\n+        }\n+      }\n+\n+      currentSection = marker.section;\n+      currentSection.removeMarker(marker);\n+    });\n+\n+    // add a blank marker to any sections that are now empty\n+    changedSections.forEach(section => {\n+      if (section.isEmpty()) {\n+        section.appendMarker(Marker.createBlank());","path":"src/js/models/post.js","position":35,"original_position":35,"commit_id":"96bbe82e7df26f52fc7a20bad0bd5076c4b5694b","original_commit_id":"96bbe82e7df26f52fc7a20bad0bd5076c4b5694b","user":{"login":"mixonic","id":8752,"avatar_url":"https://avatars.githubusercontent.com/u/8752?v=3","gravatar_id":"","url":"https://api.github.com/users/mixonic","html_url":"https://github.com/mixonic","followers_url":"https://api.github.com/users/mixonic/followers","following_url":"https://api.github.com/users/mixonic/following{/other_user}","gists_url":"https://api.github.com/users/mixonic/gists{/gist_id}","starred_url":"https://api.github.com/users/mixonic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mixonic/subscriptions","organizations_url":"https://api.github.com/users/mixonic/orgs","repos_url":"https://api.github.com/users/mixonic/repos","events_url":"https://api.github.com/users/mixonic/events{/privacy}","received_events_url":"https://api.github.com/users/mixonic/received_events","type":"User","site_admin":false},"body":"Should go through the builder?","created_at":"2015-08-07T17:15:47Z","updated_at":"2015-08-07T17:15:47Z","html_url":"https://github.com/bustlelabs/content-kit-editor/pull/46#discussion_r36539715","pull_request_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/pulls/46","_links":{"self":{"href":"https://api.github.com/repos/bustlelabs/content-kit-editor/pulls/comments/36539715"},"html":{"href":"https://github.com/bustlelabs/content-kit-editor/pull/46#discussion_r36539715"},"pull_request":{"href":"https://api.github.com/repos/bustlelabs/content-kit-editor/pulls/46"}}},"pull_request":{"url":"https://api.github.com/repos/bustlelabs/content-kit-editor/pulls/46","id":41842205,"html_url":"https://github.com/bustlelabs/content-kit-editor/pull/46","diff_url":"https://github.com/bustlelabs/content-kit-editor/pull/46.diff","patch_url":"https://github.com/bustlelabs/content-kit-editor/pull/46.patch","issue_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/issues/46","number":46,"state":"open","locked":false,"title":"37 selection deletion","user":{"login":"bantic","id":2023,"avatar_url":"https://avatars.githubusercontent.com/u/2023?v=3","gravatar_id":"","url":"https://api.github.com/users/bantic","html_url":"https://github.com/bantic","followers_url":"https://api.github.com/users/bantic/followers","following_url":"https://api.github.com/users/bantic/following{/other_user}","gists_url":"https://api.github.com/users/bantic/gists{/gist_id}","starred_url":"https://api.github.com/users/bantic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bantic/subscriptions","organizations_url":"https://api.github.com/users/bantic/orgs","repos_url":"https://api.github.com/users/bantic/repos","events_url":"https://api.github.com/users/bantic/events{/privacy}","received_events_url":"https://api.github.com/users/bantic/received_events","type":"User","site_admin":false},"body":"This adds `post#cutMarkers(markers)` and `editor#deleteSelection`.\r\n\r\nAlso adds `Helpers.toolbar` for sharing toolbar-related assertions in tests, and\r\n`Helpers.dom.triggerDelete`, which detects phantom and simulates a delete (by calling `editor.handleDeletion`) — this allows some of the previous skipped-in-phantom tests to run in phantom, now.\r\n\r\nReady for review. I will start on the items below but make a separate PR for them. @mixonic lmk if you have feedback.\r\n\r\nTo do:\r\n  * [ ] handle newlines when there is a selection (delete the selection first then apply the newline action)\r\n  * [ ] handle keystrokes when there is a selection (contenteditable almost does this for us, but it inserts irrelevant spans to try to maintain visual styling — this should be handled semantically as well)","created_at":"2015-08-06T22:27:09Z","updated_at":"2015-08-07T17:15:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8deb78c5bff05f52d2efce946b51280d58b355e4","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/pulls/46/commits","review_comments_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/pulls/46/comments","review_comment_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/issues/46/comments","statuses_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/statuses/96bbe82e7df26f52fc7a20bad0bd5076c4b5694b","head":{"label":"bustlelabs:37-selection-deletion","ref":"37-selection-deletion","sha":"96bbe82e7df26f52fc7a20bad0bd5076c4b5694b","user":{"login":"bustlelabs","id":2198187,"avatar_url":"https://avatars.githubusercontent.com/u/2198187?v=3","gravatar_id":"","url":"https://api.github.com/users/bustlelabs","html_url":"https://github.com/bustlelabs","followers_url":"https://api.github.com/users/bustlelabs/followers","following_url":"https://api.github.com/users/bustlelabs/following{/other_user}","gists_url":"https://api.github.com/users/bustlelabs/gists{/gist_id}","starred_url":"https://api.github.com/users/bustlelabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bustlelabs/subscriptions","organizations_url":"https://api.github.com/users/bustlelabs/orgs","repos_url":"https://api.github.com/users/bustlelabs/repos","events_url":"https://api.github.com/users/bustlelabs/events{/privacy}","received_events_url":"https://api.github.com/users/bustlelabs/received_events","type":"Organization","site_admin":false},"repo":{"id":21694966,"name":"content-kit-editor","full_name":"bustlelabs/content-kit-editor","owner":{"login":"bustlelabs","id":2198187,"avatar_url":"https://avatars.githubusercontent.com/u/2198187?v=3","gravatar_id":"","url":"https://api.github.com/users/bustlelabs","html_url":"https://github.com/bustlelabs","followers_url":"https://api.github.com/users/bustlelabs/followers","following_url":"https://api.github.com/users/bustlelabs/following{/other_user}","gists_url":"https://api.github.com/users/bustlelabs/gists{/gist_id}","starred_url":"https://api.github.com/users/bustlelabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bustlelabs/subscriptions","organizations_url":"https://api.github.com/users/bustlelabs/orgs","repos_url":"https://api.github.com/users/bustlelabs/repos","events_url":"https://api.github.com/users/bustlelabs/events{/privacy}","received_events_url":"https://api.github.com/users/bustlelabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bustlelabs/content-kit-editor","description":"A modern, minimalist WYSIWYG editor","fork":false,"url":"https://api.github.com/repos/bustlelabs/content-kit-editor","forks_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/forks","keys_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/teams","hooks_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/hooks","issue_events_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/issues/events{/number}","events_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/events","assignees_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/assignees{/user}","branches_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/branches{/branch}","tags_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/tags","blobs_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/git/refs{/sha}","trees_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/statuses/{sha}","languages_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/languages","stargazers_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/stargazers","contributors_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/contributors","subscribers_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/subscribers","subscription_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/subscription","commits_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/commits{/sha}","git_commits_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/git/commits{/sha}","comments_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/comments{/number}","issue_comment_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/issues/comments{/number}","contents_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/contents/{+path}","compare_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/merges","archive_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/downloads","issues_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/issues{/number}","pulls_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/pulls{/number}","milestones_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/milestones{/number}","notifications_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/labels{/name}","releases_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/releases{/id}","created_at":"2014-07-10T13:22:19Z","updated_at":"2015-08-07T11:54:03Z","pushed_at":"2015-08-07T17:08:47Z","git_url":"git://github.com/bustlelabs/content-kit-editor.git","ssh_url":"git@github.com:bustlelabs/content-kit-editor.git","clone_url":"https://github.com/bustlelabs/content-kit-editor.git","svn_url":"https://github.com/bustlelabs/content-kit-editor","homepage":"","size":1495,"stargazers_count":62,"watchers_count":62,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":7,"mirror_url":null,"open_issues_count":9,"forks":7,"open_issues":9,"watchers":62,"default_branch":"master"}},"base":{"label":"bustlelabs:master","ref":"master","sha":"23a13c2afe913c8dcafd98aab2db4c3c9a757e55","user":{"login":"bustlelabs","id":2198187,"avatar_url":"https://avatars.githubusercontent.com/u/2198187?v=3","gravatar_id":"","url":"https://api.github.com/users/bustlelabs","html_url":"https://github.com/bustlelabs","followers_url":"https://api.github.com/users/bustlelabs/followers","following_url":"https://api.github.com/users/bustlelabs/following{/other_user}","gists_url":"https://api.github.com/users/bustlelabs/gists{/gist_id}","starred_url":"https://api.github.com/users/bustlelabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bustlelabs/subscriptions","organizations_url":"https://api.github.com/users/bustlelabs/orgs","repos_url":"https://api.github.com/users/bustlelabs/repos","events_url":"https://api.github.com/users/bustlelabs/events{/privacy}","received_events_url":"https://api.github.com/users/bustlelabs/received_events","type":"Organization","site_admin":false},"repo":{"id":21694966,"name":"content-kit-editor","full_name":"bustlelabs/content-kit-editor","owner":{"login":"bustlelabs","id":2198187,"avatar_url":"https://avatars.githubusercontent.com/u/2198187?v=3","gravatar_id":"","url":"https://api.github.com/users/bustlelabs","html_url":"https://github.com/bustlelabs","followers_url":"https://api.github.com/users/bustlelabs/followers","following_url":"https://api.github.com/users/bustlelabs/following{/other_user}","gists_url":"https://api.github.com/users/bustlelabs/gists{/gist_id}","starred_url":"https://api.github.com/users/bustlelabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bustlelabs/subscriptions","organizations_url":"https://api.github.com/users/bustlelabs/orgs","repos_url":"https://api.github.com/users/bustlelabs/repos","events_url":"https://api.github.com/users/bustlelabs/events{/privacy}","received_events_url":"https://api.github.com/users/bustlelabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bustlelabs/content-kit-editor","description":"A modern, minimalist WYSIWYG editor","fork":false,"url":"https://api.github.com/repos/bustlelabs/content-kit-editor","forks_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/forks","keys_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/teams","hooks_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/hooks","issue_events_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/issues/events{/number}","events_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/events","assignees_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/assignees{/user}","branches_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/branches{/branch}","tags_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/tags","blobs_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/git/refs{/sha}","trees_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/statuses/{sha}","languages_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/languages","stargazers_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/stargazers","contributors_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/contributors","subscribers_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/subscribers","subscription_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/subscription","commits_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/commits{/sha}","git_commits_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/git/commits{/sha}","comments_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/comments{/number}","issue_comment_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/issues/comments{/number}","contents_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/contents/{+path}","compare_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/merges","archive_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/downloads","issues_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/issues{/number}","pulls_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/pulls{/number}","milestones_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/milestones{/number}","notifications_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/labels{/name}","releases_url":"https://api.github.com/repos/bustlelabs/content-kit-editor/releases{/id}","created_at":"2014-07-10T13:22:19Z","updated_at":"2015-08-07T11:54:03Z","pushed_at":"2015-08-07T17:08:47Z","git_url":"git://github.com/bustlelabs/content-kit-editor.git","ssh_url":"git@github.com:bustlelabs/content-kit-editor.git","clone_url":"https://github.com/bustlelabs/content-kit-editor.git","svn_url":"https://github.com/bustlelabs/content-kit-editor","homepage":"","size":1495,"stargazers_count":62,"watchers_count":62,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":7,"mirror_url":null,"open_issues_count":9,"forks":7,"open_issues":9,"watchers":62,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bustlelabs/content-kit-editor/pulls/46"},"html":{"href":"https://github.com/bustlelabs/content-kit-editor/pull/46"},"issue":{"href":"https://api.github.com/repos/bustlelabs/content-kit-editor/issues/46"},"comments":{"href":"https://api.github.com/repos/bustlelabs/content-kit-editor/issues/46/comments"},"review_comments":{"href":"https://api.github.com/repos/bustlelabs/content-kit-editor/pulls/46/comments"},"review_comment":{"href":"https://api.github.com/repos/bustlelabs/content-kit-editor/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bustlelabs/content-kit-editor/pulls/46/commits"},"statuses":{"href":"https://api.github.com/repos/bustlelabs/content-kit-editor/statuses/96bbe82e7df26f52fc7a20bad0bd5076c4b5694b"}}}}