{"action":"created","comment":{"url":"https://api.github.com/repos/basecamp/trix/pulls/comments/69728492","id":69728492,"diff_hunk":"@@ -78,16 +78,22 @@ class Trix.Composition extends Trix.BasicObject\n     block = document.getBlockAtIndex(index)\n \n     if block.getBlockBreakPosition() is offset\n-      document = document.removeTextAtRange(range)\n-      range = [position, position]\n+      if block.text.getStringAtRange([offset - 1, offset]) is \"\\n\"\n+        document = document.removeTextAtRange([position - 1, position])\n+      else if offset - 1 isnt 0\n+        position += 1\n     else\n       if block.text.getStringAtRange([offset, offset + 1]) is \"\\n\"\n         range = [position - 1, position + 1]\n       else if offset - 1 isnt 0\n         position += 1\n \n     newDocument = new Trix.Document [block.removeLastAttribute().copyWithoutText()]\n-    @setDocument(document.insertDocumentAtRange(newDocument, range))\n+    if \"header\" in block.attributes","path":"src/trix/models/composition.coffee","position":18,"original_position":18,"commit_id":"24ec88fe81f88c4683a2e7fd1ef2a3464381ce7f","original_commit_id":"24ec88fe81f88c4683a2e7fd1ef2a3464381ce7f","user":{"login":"javan","id":5355,"avatar_url":"https://avatars.githubusercontent.com/u/5355?v=3","gravatar_id":"","url":"https://api.github.com/users/javan","html_url":"https://github.com/javan","followers_url":"https://api.github.com/users/javan/followers","following_url":"https://api.github.com/users/javan/following{/other_user}","gists_url":"https://api.github.com/users/javan/gists{/gist_id}","starred_url":"https://api.github.com/users/javan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/javan/subscriptions","organizations_url":"https://api.github.com/users/javan/orgs","repos_url":"https://api.github.com/users/javan/repos","events_url":"https://api.github.com/users/javan/events{/privacy}","received_events_url":"https://api.github.com/users/javan/received_events","type":"User","site_admin":false},"body":"We generally don't access properties like `block.attributes` directly and favor the reader methods instead: `block.getAttributes()`.","created_at":"2016-07-06T13:24:06Z","updated_at":"2016-07-06T13:24:06Z","html_url":"https://github.com/basecamp/trix/pull/263#discussion_r69728492","pull_request_url":"https://api.github.com/repos/basecamp/trix/pulls/263","_links":{"self":{"href":"https://api.github.com/repos/basecamp/trix/pulls/comments/69728492"},"html":{"href":"https://github.com/basecamp/trix/pull/263#discussion_r69728492"},"pull_request":{"href":"https://api.github.com/repos/basecamp/trix/pulls/263"}}},"pull_request":{"url":"https://api.github.com/repos/basecamp/trix/pulls/263","id":76332743,"html_url":"https://github.com/basecamp/trix/pull/263","diff_url":"https://github.com/basecamp/trix/pull/263.diff","patch_url":"https://github.com/basecamp/trix/pull/263.patch","issue_url":"https://api.github.com/repos/basecamp/trix/issues/263","number":263,"state":"open","locked":false,"title":"Add header support","user":{"login":"drewrygh","id":2018508,"avatar_url":"https://avatars.githubusercontent.com/u/2018508?v=3","gravatar_id":"","url":"https://api.github.com/users/drewrygh","html_url":"https://github.com/drewrygh","followers_url":"https://api.github.com/users/drewrygh/followers","following_url":"https://api.github.com/users/drewrygh/following{/other_user}","gists_url":"https://api.github.com/users/drewrygh/gists{/gist_id}","starred_url":"https://api.github.com/users/drewrygh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drewrygh/subscriptions","organizations_url":"https://api.github.com/users/drewrygh/orgs","repos_url":"https://api.github.com/users/drewrygh/repos","events_url":"https://api.github.com/users/drewrygh/events{/privacy}","received_events_url":"https://api.github.com/users/drewrygh/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-07-05T19:55:15Z","updated_at":"2016-07-06T13:24:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"79012d71eec11a601dcfa42f6d1f2d73587f7589","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/basecamp/trix/pulls/263/commits","review_comments_url":"https://api.github.com/repos/basecamp/trix/pulls/263/comments","review_comment_url":"https://api.github.com/repos/basecamp/trix/pulls/comments{/number}","comments_url":"https://api.github.com/repos/basecamp/trix/issues/263/comments","statuses_url":"https://api.github.com/repos/basecamp/trix/statuses/24ec88fe81f88c4683a2e7fd1ef2a3464381ce7f","head":{"label":"basecamp:header","ref":"header","sha":"24ec88fe81f88c4683a2e7fd1ef2a3464381ce7f","user":{"login":"basecamp","id":13131,"avatar_url":"https://avatars.githubusercontent.com/u/13131?v=3","gravatar_id":"","url":"https://api.github.com/users/basecamp","html_url":"https://github.com/basecamp","followers_url":"https://api.github.com/users/basecamp/followers","following_url":"https://api.github.com/users/basecamp/following{/other_user}","gists_url":"https://api.github.com/users/basecamp/gists{/gist_id}","starred_url":"https://api.github.com/users/basecamp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/basecamp/subscriptions","organizations_url":"https://api.github.com/users/basecamp/orgs","repos_url":"https://api.github.com/users/basecamp/repos","events_url":"https://api.github.com/users/basecamp/events{/privacy}","received_events_url":"https://api.github.com/users/basecamp/received_events","type":"Organization","site_admin":false},"repo":{"id":11829145,"name":"trix","full_name":"basecamp/trix","owner":{"login":"basecamp","id":13131,"avatar_url":"https://avatars.githubusercontent.com/u/13131?v=3","gravatar_id":"","url":"https://api.github.com/users/basecamp","html_url":"https://github.com/basecamp","followers_url":"https://api.github.com/users/basecamp/followers","following_url":"https://api.github.com/users/basecamp/following{/other_user}","gists_url":"https://api.github.com/users/basecamp/gists{/gist_id}","starred_url":"https://api.github.com/users/basecamp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/basecamp/subscriptions","organizations_url":"https://api.github.com/users/basecamp/orgs","repos_url":"https://api.github.com/users/basecamp/repos","events_url":"https://api.github.com/users/basecamp/events{/privacy}","received_events_url":"https://api.github.com/users/basecamp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/basecamp/trix","description":"A rich text editor for everyday writing","fork":false,"url":"https://api.github.com/repos/basecamp/trix","forks_url":"https://api.github.com/repos/basecamp/trix/forks","keys_url":"https://api.github.com/repos/basecamp/trix/keys{/key_id}","collaborators_url":"https://api.github.com/repos/basecamp/trix/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/basecamp/trix/teams","hooks_url":"https://api.github.com/repos/basecamp/trix/hooks","issue_events_url":"https://api.github.com/repos/basecamp/trix/issues/events{/number}","events_url":"https://api.github.com/repos/basecamp/trix/events","assignees_url":"https://api.github.com/repos/basecamp/trix/assignees{/user}","branches_url":"https://api.github.com/repos/basecamp/trix/branches{/branch}","tags_url":"https://api.github.com/repos/basecamp/trix/tags","blobs_url":"https://api.github.com/repos/basecamp/trix/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/basecamp/trix/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/basecamp/trix/git/refs{/sha}","trees_url":"https://api.github.com/repos/basecamp/trix/git/trees{/sha}","statuses_url":"https://api.github.com/repos/basecamp/trix/statuses/{sha}","languages_url":"https://api.github.com/repos/basecamp/trix/languages","stargazers_url":"https://api.github.com/repos/basecamp/trix/stargazers","contributors_url":"https://api.github.com/repos/basecamp/trix/contributors","subscribers_url":"https://api.github.com/repos/basecamp/trix/subscribers","subscription_url":"https://api.github.com/repos/basecamp/trix/subscription","commits_url":"https://api.github.com/repos/basecamp/trix/commits{/sha}","git_commits_url":"https://api.github.com/repos/basecamp/trix/git/commits{/sha}","comments_url":"https://api.github.com/repos/basecamp/trix/comments{/number}","issue_comment_url":"https://api.github.com/repos/basecamp/trix/issues/comments{/number}","contents_url":"https://api.github.com/repos/basecamp/trix/contents/{+path}","compare_url":"https://api.github.com/repos/basecamp/trix/compare/{base}...{head}","merges_url":"https://api.github.com/repos/basecamp/trix/merges","archive_url":"https://api.github.com/repos/basecamp/trix/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/basecamp/trix/downloads","issues_url":"https://api.github.com/repos/basecamp/trix/issues{/number}","pulls_url":"https://api.github.com/repos/basecamp/trix/pulls{/number}","milestones_url":"https://api.github.com/repos/basecamp/trix/milestones{/number}","notifications_url":"https://api.github.com/repos/basecamp/trix/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/basecamp/trix/labels{/name}","releases_url":"https://api.github.com/repos/basecamp/trix/releases{/id}","deployments_url":"https://api.github.com/repos/basecamp/trix/deployments","created_at":"2013-08-01T22:21:30Z","updated_at":"2016-07-06T10:08:14Z","pushed_at":"2016-07-05T19:58:40Z","git_url":"git://github.com/basecamp/trix.git","ssh_url":"git@github.com:basecamp/trix.git","clone_url":"https://github.com/basecamp/trix.git","svn_url":"https://github.com/basecamp/trix","homepage":"https://trix-editor.org/","size":3413,"stargazers_count":6932,"watchers_count":6932,"language":"CoffeeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":252,"mirror_url":null,"open_issues_count":33,"forks":252,"open_issues":33,"watchers":6932,"default_branch":"master"}},"base":{"label":"basecamp:master","ref":"master","sha":"0b79f1b640f285babac4e49d65aff569bfd5a441","user":{"login":"basecamp","id":13131,"avatar_url":"https://avatars.githubusercontent.com/u/13131?v=3","gravatar_id":"","url":"https://api.github.com/users/basecamp","html_url":"https://github.com/basecamp","followers_url":"https://api.github.com/users/basecamp/followers","following_url":"https://api.github.com/users/basecamp/following{/other_user}","gists_url":"https://api.github.com/users/basecamp/gists{/gist_id}","starred_url":"https://api.github.com/users/basecamp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/basecamp/subscriptions","organizations_url":"https://api.github.com/users/basecamp/orgs","repos_url":"https://api.github.com/users/basecamp/repos","events_url":"https://api.github.com/users/basecamp/events{/privacy}","received_events_url":"https://api.github.com/users/basecamp/received_events","type":"Organization","site_admin":false},"repo":{"id":11829145,"name":"trix","full_name":"basecamp/trix","owner":{"login":"basecamp","id":13131,"avatar_url":"https://avatars.githubusercontent.com/u/13131?v=3","gravatar_id":"","url":"https://api.github.com/users/basecamp","html_url":"https://github.com/basecamp","followers_url":"https://api.github.com/users/basecamp/followers","following_url":"https://api.github.com/users/basecamp/following{/other_user}","gists_url":"https://api.github.com/users/basecamp/gists{/gist_id}","starred_url":"https://api.github.com/users/basecamp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/basecamp/subscriptions","organizations_url":"https://api.github.com/users/basecamp/orgs","repos_url":"https://api.github.com/users/basecamp/repos","events_url":"https://api.github.com/users/basecamp/events{/privacy}","received_events_url":"https://api.github.com/users/basecamp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/basecamp/trix","description":"A rich text editor for everyday writing","fork":false,"url":"https://api.github.com/repos/basecamp/trix","forks_url":"https://api.github.com/repos/basecamp/trix/forks","keys_url":"https://api.github.com/repos/basecamp/trix/keys{/key_id}","collaborators_url":"https://api.github.com/repos/basecamp/trix/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/basecamp/trix/teams","hooks_url":"https://api.github.com/repos/basecamp/trix/hooks","issue_events_url":"https://api.github.com/repos/basecamp/trix/issues/events{/number}","events_url":"https://api.github.com/repos/basecamp/trix/events","assignees_url":"https://api.github.com/repos/basecamp/trix/assignees{/user}","branches_url":"https://api.github.com/repos/basecamp/trix/branches{/branch}","tags_url":"https://api.github.com/repos/basecamp/trix/tags","blobs_url":"https://api.github.com/repos/basecamp/trix/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/basecamp/trix/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/basecamp/trix/git/refs{/sha}","trees_url":"https://api.github.com/repos/basecamp/trix/git/trees{/sha}","statuses_url":"https://api.github.com/repos/basecamp/trix/statuses/{sha}","languages_url":"https://api.github.com/repos/basecamp/trix/languages","stargazers_url":"https://api.github.com/repos/basecamp/trix/stargazers","contributors_url":"https://api.github.com/repos/basecamp/trix/contributors","subscribers_url":"https://api.github.com/repos/basecamp/trix/subscribers","subscription_url":"https://api.github.com/repos/basecamp/trix/subscription","commits_url":"https://api.github.com/repos/basecamp/trix/commits{/sha}","git_commits_url":"https://api.github.com/repos/basecamp/trix/git/commits{/sha}","comments_url":"https://api.github.com/repos/basecamp/trix/comments{/number}","issue_comment_url":"https://api.github.com/repos/basecamp/trix/issues/comments{/number}","contents_url":"https://api.github.com/repos/basecamp/trix/contents/{+path}","compare_url":"https://api.github.com/repos/basecamp/trix/compare/{base}...{head}","merges_url":"https://api.github.com/repos/basecamp/trix/merges","archive_url":"https://api.github.com/repos/basecamp/trix/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/basecamp/trix/downloads","issues_url":"https://api.github.com/repos/basecamp/trix/issues{/number}","pulls_url":"https://api.github.com/repos/basecamp/trix/pulls{/number}","milestones_url":"https://api.github.com/repos/basecamp/trix/milestones{/number}","notifications_url":"https://api.github.com/repos/basecamp/trix/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/basecamp/trix/labels{/name}","releases_url":"https://api.github.com/repos/basecamp/trix/releases{/id}","deployments_url":"https://api.github.com/repos/basecamp/trix/deployments","created_at":"2013-08-01T22:21:30Z","updated_at":"2016-07-06T10:08:14Z","pushed_at":"2016-07-05T19:58:40Z","git_url":"git://github.com/basecamp/trix.git","ssh_url":"git@github.com:basecamp/trix.git","clone_url":"https://github.com/basecamp/trix.git","svn_url":"https://github.com/basecamp/trix","homepage":"https://trix-editor.org/","size":3413,"stargazers_count":6932,"watchers_count":6932,"language":"CoffeeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":252,"mirror_url":null,"open_issues_count":33,"forks":252,"open_issues":33,"watchers":6932,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/basecamp/trix/pulls/263"},"html":{"href":"https://github.com/basecamp/trix/pull/263"},"issue":{"href":"https://api.github.com/repos/basecamp/trix/issues/263"},"comments":{"href":"https://api.github.com/repos/basecamp/trix/issues/263/comments"},"review_comments":{"href":"https://api.github.com/repos/basecamp/trix/pulls/263/comments"},"review_comment":{"href":"https://api.github.com/repos/basecamp/trix/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/basecamp/trix/pulls/263/commits"},"statuses":{"href":"https://api.github.com/repos/basecamp/trix/statuses/24ec88fe81f88c4683a2e7fd1ef2a3464381ce7f"}}}}
{"actor":{"display_login":"javan"}}