{"action":"closed","number":418,"pull_request":{"url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/pulls/418","id":74231345,"html_url":"https://github.com/wordpress-mobile/WordPress-Editor-Android/pull/418","diff_url":"https://github.com/wordpress-mobile/WordPress-Editor-Android/pull/418.diff","patch_url":"https://github.com/wordpress-mobile/WordPress-Editor-Android/pull/418.patch","issue_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/issues/418","number":418,"state":"closed","locked":false,"title":"Issue #415: Deleting media can remove surrounding paragraphs","user":{"login":"aforcier","id":9613966,"avatar_url":"https://avatars.githubusercontent.com/u/9613966?v=3","gravatar_id":"","url":"https://api.github.com/users/aforcier","html_url":"https://github.com/aforcier","followers_url":"https://api.github.com/users/aforcier/followers","following_url":"https://api.github.com/users/aforcier/following{/other_user}","gists_url":"https://api.github.com/users/aforcier/gists{/gist_id}","starred_url":"https://api.github.com/users/aforcier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aforcier/subscriptions","organizations_url":"https://api.github.com/users/aforcier/orgs","repos_url":"https://api.github.com/users/aforcier/repos","events_url":"https://api.github.com/users/aforcier/events{/privacy}","received_events_url":"https://api.github.com/users/aforcier/received_events","type":"User","site_admin":false},"body":"Fixes #415.\r\n\r\nThe cause of the issue was that, when paragraph breaks are deleted in HTML mode (resulting in a single `\\n` between the media item and the next/previous paragraph rather than `\\n\\n`), `wp.loadText()` would insert a break tag instead of starting a new paragraph. This would cause media items to share a paragraph `div` with some text, and deleting the media item cleared away the whole div, along with the text.\r\n\r\nSince in visual mode we always place media items in their own paragraph, I opted to change the result of `wp.loadText()` to replace the break tags with paragraphs immediately before or after media items. This won't affect line breaks added between normal text chunks in HTML mode.\r\n\r\nAs an additional safety measure, this PR also changes the behavior of the media delete button to only delete the media item and the edit container, not the entire div. For videos this left `<div><br></div>` behind, which caused some paragraph irregularities. I addressed that as well - the break tag didn't need to be added in the first place.\r\n\r\nSome tests I wrote to test the behavior for all media/paragraph combinations will be added in another PR.\r\n\r\ncc @maxme","created_at":"2016-06-17T11:59:08Z","updated_at":"2016-06-17T14:34:26Z","closed_at":"2016-06-17T14:34:25Z","merged_at":"2016-06-17T14:34:25Z","merge_commit_sha":"d03ea191e8d89a9ad8962f4d925e6688d63759c3","assignee":{"login":"maxme","id":40213,"avatar_url":"https://avatars.githubusercontent.com/u/40213?v=3","gravatar_id":"","url":"https://api.github.com/users/maxme","html_url":"https://github.com/maxme","followers_url":"https://api.github.com/users/maxme/followers","following_url":"https://api.github.com/users/maxme/following{/other_user}","gists_url":"https://api.github.com/users/maxme/gists{/gist_id}","starred_url":"https://api.github.com/users/maxme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maxme/subscriptions","organizations_url":"https://api.github.com/users/maxme/orgs","repos_url":"https://api.github.com/users/maxme/repos","events_url":"https://api.github.com/users/maxme/events{/privacy}","received_events_url":"https://api.github.com/users/maxme/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/milestones/13","html_url":"https://github.com/wordpress-mobile/WordPress-Editor-Android/milestones/1.2","labels_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/milestones/13/labels","id":1792688,"number":13,"title":"1.2","description":"","creator":{"login":"aforcier","id":9613966,"avatar_url":"https://avatars.githubusercontent.com/u/9613966?v=3","gravatar_id":"","url":"https://api.github.com/users/aforcier","html_url":"https://github.com/aforcier","followers_url":"https://api.github.com/users/aforcier/followers","following_url":"https://api.github.com/users/aforcier/following{/other_user}","gists_url":"https://api.github.com/users/aforcier/gists{/gist_id}","starred_url":"https://api.github.com/users/aforcier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aforcier/subscriptions","organizations_url":"https://api.github.com/users/aforcier/orgs","repos_url":"https://api.github.com/users/aforcier/repos","events_url":"https://api.github.com/users/aforcier/events{/privacy}","received_events_url":"https://api.github.com/users/aforcier/received_events","type":"User","site_admin":false},"open_issues":8,"closed_issues":27,"state":"open","created_at":"2016-05-27T19:27:25Z","updated_at":"2016-06-17T14:34:25Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/pulls/418/commits","review_comments_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/pulls/418/comments","review_comment_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/pulls/comments{/number}","comments_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/issues/418/comments","statuses_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/statuses/aa4bb12527ebb35f4e610a11bc9b2922977eba38","head":{"label":"wordpress-mobile:issue/415-media-delete-paragraphs","ref":"issue/415-media-delete-paragraphs","sha":"aa4bb12527ebb35f4e610a11bc9b2922977eba38","user":{"login":"wordpress-mobile","id":1306301,"avatar_url":"https://avatars.githubusercontent.com/u/1306301?v=3","gravatar_id":"","url":"https://api.github.com/users/wordpress-mobile","html_url":"https://github.com/wordpress-mobile","followers_url":"https://api.github.com/users/wordpress-mobile/followers","following_url":"https://api.github.com/users/wordpress-mobile/following{/other_user}","gists_url":"https://api.github.com/users/wordpress-mobile/gists{/gist_id}","starred_url":"https://api.github.com/users/wordpress-mobile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wordpress-mobile/subscriptions","organizations_url":"https://api.github.com/users/wordpress-mobile/orgs","repos_url":"https://api.github.com/users/wordpress-mobile/repos","events_url":"https://api.github.com/users/wordpress-mobile/events{/privacy}","received_events_url":"https://api.github.com/users/wordpress-mobile/received_events","type":"Organization","site_admin":false},"repo":{"id":30292255,"name":"WordPress-Editor-Android","full_name":"wordpress-mobile/WordPress-Editor-Android","owner":{"login":"wordpress-mobile","id":1306301,"avatar_url":"https://avatars.githubusercontent.com/u/1306301?v=3","gravatar_id":"","url":"https://api.github.com/users/wordpress-mobile","html_url":"https://github.com/wordpress-mobile","followers_url":"https://api.github.com/users/wordpress-mobile/followers","following_url":"https://api.github.com/users/wordpress-mobile/following{/other_user}","gists_url":"https://api.github.com/users/wordpress-mobile/gists{/gist_id}","starred_url":"https://api.github.com/users/wordpress-mobile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wordpress-mobile/subscriptions","organizations_url":"https://api.github.com/users/wordpress-mobile/orgs","repos_url":"https://api.github.com/users/wordpress-mobile/repos","events_url":"https://api.github.com/users/wordpress-mobile/events{/privacy}","received_events_url":"https://api.github.com/users/wordpress-mobile/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/wordpress-mobile/WordPress-Editor-Android","description":"A reusable Android rich text editor component.","fork":false,"url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android","forks_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/forks","keys_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/teams","hooks_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/hooks","issue_events_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/issues/events{/number}","events_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/events","assignees_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/assignees{/user}","branches_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/branches{/branch}","tags_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/tags","blobs_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/git/refs{/sha}","trees_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/statuses/{sha}","languages_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/languages","stargazers_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/stargazers","contributors_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/contributors","subscribers_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/subscribers","subscription_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/subscription","commits_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/commits{/sha}","git_commits_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/git/commits{/sha}","comments_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/comments{/number}","issue_comment_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/issues/comments{/number}","contents_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/contents/{+path}","compare_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/merges","archive_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/downloads","issues_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/issues{/number}","pulls_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/pulls{/number}","milestones_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/milestones{/number}","notifications_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/labels{/name}","releases_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/releases{/id}","deployments_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/deployments","created_at":"2015-02-04T09:54:16Z","updated_at":"2016-06-10T06:48:04Z","pushed_at":"2016-06-17T14:34:25Z","git_url":"git://github.com/wordpress-mobile/WordPress-Editor-Android.git","ssh_url":"git@github.com:wordpress-mobile/WordPress-Editor-Android.git","clone_url":"https://github.com/wordpress-mobile/WordPress-Editor-Android.git","svn_url":"https://github.com/wordpress-mobile/WordPress-Editor-Android","homepage":"","size":3111,"stargazers_count":65,"watchers_count":65,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":20,"mirror_url":null,"open_issues_count":80,"forks":20,"open_issues":80,"watchers":65,"default_branch":"develop"}},"base":{"label":"wordpress-mobile:develop","ref":"develop","sha":"a53706d36a88d06f8fffbd1006e7858856cb559f","user":{"login":"wordpress-mobile","id":1306301,"avatar_url":"https://avatars.githubusercontent.com/u/1306301?v=3","gravatar_id":"","url":"https://api.github.com/users/wordpress-mobile","html_url":"https://github.com/wordpress-mobile","followers_url":"https://api.github.com/users/wordpress-mobile/followers","following_url":"https://api.github.com/users/wordpress-mobile/following{/other_user}","gists_url":"https://api.github.com/users/wordpress-mobile/gists{/gist_id}","starred_url":"https://api.github.com/users/wordpress-mobile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wordpress-mobile/subscriptions","organizations_url":"https://api.github.com/users/wordpress-mobile/orgs","repos_url":"https://api.github.com/users/wordpress-mobile/repos","events_url":"https://api.github.com/users/wordpress-mobile/events{/privacy}","received_events_url":"https://api.github.com/users/wordpress-mobile/received_events","type":"Organization","site_admin":false},"repo":{"id":30292255,"name":"WordPress-Editor-Android","full_name":"wordpress-mobile/WordPress-Editor-Android","owner":{"login":"wordpress-mobile","id":1306301,"avatar_url":"https://avatars.githubusercontent.com/u/1306301?v=3","gravatar_id":"","url":"https://api.github.com/users/wordpress-mobile","html_url":"https://github.com/wordpress-mobile","followers_url":"https://api.github.com/users/wordpress-mobile/followers","following_url":"https://api.github.com/users/wordpress-mobile/following{/other_user}","gists_url":"https://api.github.com/users/wordpress-mobile/gists{/gist_id}","starred_url":"https://api.github.com/users/wordpress-mobile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wordpress-mobile/subscriptions","organizations_url":"https://api.github.com/users/wordpress-mobile/orgs","repos_url":"https://api.github.com/users/wordpress-mobile/repos","events_url":"https://api.github.com/users/wordpress-mobile/events{/privacy}","received_events_url":"https://api.github.com/users/wordpress-mobile/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/wordpress-mobile/WordPress-Editor-Android","description":"A reusable Android rich text editor component.","fork":false,"url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android","forks_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/forks","keys_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/teams","hooks_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/hooks","issue_events_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/issues/events{/number}","events_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/events","assignees_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/assignees{/user}","branches_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/branches{/branch}","tags_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/tags","blobs_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/git/refs{/sha}","trees_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/statuses/{sha}","languages_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/languages","stargazers_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/stargazers","contributors_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/contributors","subscribers_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/subscribers","subscription_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/subscription","commits_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/commits{/sha}","git_commits_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/git/commits{/sha}","comments_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/comments{/number}","issue_comment_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/issues/comments{/number}","contents_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/contents/{+path}","compare_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/merges","archive_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/downloads","issues_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/issues{/number}","pulls_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/pulls{/number}","milestones_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/milestones{/number}","notifications_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/labels{/name}","releases_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/releases{/id}","deployments_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/deployments","created_at":"2015-02-04T09:54:16Z","updated_at":"2016-06-10T06:48:04Z","pushed_at":"2016-06-17T14:34:25Z","git_url":"git://github.com/wordpress-mobile/WordPress-Editor-Android.git","ssh_url":"git@github.com:wordpress-mobile/WordPress-Editor-Android.git","clone_url":"https://github.com/wordpress-mobile/WordPress-Editor-Android.git","svn_url":"https://github.com/wordpress-mobile/WordPress-Editor-Android","homepage":"","size":3111,"stargazers_count":65,"watchers_count":65,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":20,"mirror_url":null,"open_issues_count":80,"forks":20,"open_issues":80,"watchers":65,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/pulls/418"},"html":{"href":"https://github.com/wordpress-mobile/WordPress-Editor-Android/pull/418"},"issue":{"href":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/issues/418"},"comments":{"href":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/issues/418/comments"},"review_comments":{"href":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/pulls/418/comments"},"review_comment":{"href":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/pulls/418/commits"},"statuses":{"href":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/statuses/aa4bb12527ebb35f4e610a11bc9b2922977eba38"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"maxme","id":40213,"avatar_url":"https://avatars.githubusercontent.com/u/40213?v=3","gravatar_id":"","url":"https://api.github.com/users/maxme","html_url":"https://github.com/maxme","followers_url":"https://api.github.com/users/maxme/followers","following_url":"https://api.github.com/users/maxme/following{/other_user}","gists_url":"https://api.github.com/users/maxme/gists{/gist_id}","starred_url":"https://api.github.com/users/maxme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maxme/subscriptions","organizations_url":"https://api.github.com/users/maxme/orgs","repos_url":"https://api.github.com/users/maxme/repos","events_url":"https://api.github.com/users/maxme/events{/privacy}","received_events_url":"https://api.github.com/users/maxme/received_events","type":"User","site_admin":false},"comments":0,"review_comments":0,"commits":4,"additions":16,"deletions":8,"changed_files":1}}
{"actor":{"display_login":"maxme"}}