{"action":"created","issue":{"url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/issues/236","labels_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/issues/236/labels{/name}","comments_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/issues/236/comments","events_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/issues/236/events","html_url":"https://github.com/wordpress-mobile/WordPress-Editor-Android/pull/236","id":103204104,"number":236,"title":"Feature #187: Insert media","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},"labels":[{"url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/labels/media","name":"media","color":"0052cc"}],"state":"open","locked":false,"assignee":{"login":"bummytime","id":154014,"avatar_url":"https://avatars.githubusercontent.com/u/154014?v=3","gravatar_id":"","url":"https://api.github.com/users/bummytime","html_url":"https://github.com/bummytime","followers_url":"https://api.github.com/users/bummytime/followers","following_url":"https://api.github.com/users/bummytime/following{/other_user}","gists_url":"https://api.github.com/users/bummytime/gists{/gist_id}","starred_url":"https://api.github.com/users/bummytime/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bummytime/subscriptions","organizations_url":"https://api.github.com/users/bummytime/orgs","repos_url":"https://api.github.com/users/bummytime/repos","events_url":"https://api.github.com/users/bummytime/events{/privacy}","received_events_url":"https://api.github.com/users/bummytime/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/milestones/5","html_url":"https://github.com/wordpress-mobile/WordPress-Editor-Android/milestones/0.4","labels_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/milestones/5/labels","id":1211571,"number":5,"title":"0.4","description":"","creator":{"login":"bummytime","id":154014,"avatar_url":"https://avatars.githubusercontent.com/u/154014?v=3","gravatar_id":"","url":"https://api.github.com/users/bummytime","html_url":"https://github.com/bummytime","followers_url":"https://api.github.com/users/bummytime/followers","following_url":"https://api.github.com/users/bummytime/following{/other_user}","gists_url":"https://api.github.com/users/bummytime/gists{/gist_id}","starred_url":"https://api.github.com/users/bummytime/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bummytime/subscriptions","organizations_url":"https://api.github.com/users/bummytime/orgs","repos_url":"https://api.github.com/users/bummytime/repos","events_url":"https://api.github.com/users/bummytime/events{/privacy}","received_events_url":"https://api.github.com/users/bummytime/received_events","type":"User","site_admin":false},"open_issues":23,"closed_issues":0,"state":"open","created_at":"2015-07-16T17:12:50Z","updated_at":"2015-08-26T08:19:40Z","due_on":"2015-08-29T05:00:00Z","closed_at":null},"comments":8,"created_at":"2015-08-26T08:04:24Z","updated_at":"2015-08-26T20:34:32Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/pulls/236","html_url":"https://github.com/wordpress-mobile/WordPress-Editor-Android/pull/236","diff_url":"https://github.com/wordpress-mobile/WordPress-Editor-Android/pull/236.diff","patch_url":"https://github.com/wordpress-mobile/WordPress-Editor-Android/pull/236.patch"},"body":"Addresses #187. Adds basic support for inserting images into the visual editor. Doesn't include editing image settings - that will be addressed in a separate PR (issue #13).\r\n\r\nThis PR also adds some demo functionality to the example app, to simulate handling uploads and making appropriate calls back to the editor fragment. Integration with WPAndroid will be introduced in a future PR.\r\n\r\n![187-media-uploading](https://cloud.githubusercontent.com/assets/9613966/9488177/a56a2530-4be0-11e5-9540-d4bdd4c55a88.png)\r\n\r\nTapping an uploading image shows a prompt allowing the user to cancel the upload:\r\n\r\n![187-media-stop-upload-dialog](https://cloud.githubusercontent.com/assets/9613966/9488165/90315b7a-4be0-11e5-8e1d-e583dfb57b53.png)\r\n\r\nAn overlay is shown when an upload fails. Tapping the image in this state restarts the upload:\r\n\r\n![187-media-upload-fail-overlay](https://cloud.githubusercontent.com/assets/9613966/9488169/97196c5c-4be0-11e5-8d86-0e15810089ed.png)\r\n\r\nHTML mode is disabled during upload\r\n\r\n![187-media-upload-html-toast](https://cloud.githubusercontent.com/assets/9613966/9488175/9f312a4c-4be0-11e5-946f-23ffbd591d6e.png)\r\n\r\n<h2>Known issues:</h2>\r\n\r\n<h3>1: Samsung S3 image spacing issue</h3>\r\n\r\nThere is currently a bug occurring on the Samsung S3 (`API 18`). It ignores the space and you're stuck with the cursor on the left side of the image - no way to keep typing under the image without going into HTML mode. This didn't happen on emulators (`API 14-22`), but I trust physical devices more - we might need some testing on older devices to figure out the extent of the issue.\r\n\r\nThe S3 issue can be fixed by using a zero-width space character (`U+200B`) instead of `<br>` as a separator [here](https://github.com/wordpress-mobile/WordPress-Editor-Android/blob/ddb5454bd7a6a932eaf0bbb5ea0ddb531a16233b/libs/editor-common/assets/ZSSRichTextEditor.js#L834). This works on all devices, but messes up autocorrect - the ZW space character is treated as a real character, so the keyboard switches to lowercase under the image (as if a sentence had already started). There might be a different solution for the spacing that will work everywhere with no issues, or we might be able to force the autocapitalization back on after images.\r\n\r\n<h3>2: Missing upload progress bar (`API < 19`)</h3>\r\n\r\nOn all `API < 19` devices, the progress bar doesn't show up when uploading images. It seems that Android didn't support the `<progress>` tag we're using until the Chromium WebView (`API 19`).  One possibility here is to use an upload notification instead. The WPAndroid app uses those for post uploads and gallery uploads, so we might want to use it for individual image uploads anyway (on all APIs, even ones where the progress bar inside the WebView is shown). Here's a demo of what that would look like on an API 18 device (the notification isn't included in this PR, just looking for feedback):\r\n\r\nhttps://cloudup.com/cqzRAsg_CeE\r\n\r\n<h3>3: Uploading image container is sometimes very small (`API < 19`)</h3>\r\n\r\nSometimes (probably when uploading media in a blank document, still testing) the image container is very small while uploading. Once the container is removed at the end of the upload, the normal-sized image is shown:\r\n\r\nhttps://cloudup.com/c2HhsInzXsW\r\n\r\nThe problem is resolved by removing [this](https://github.com/wordpress-mobile/WordPress-Editor-Android/blob/244a51315e24eddc0510b422a75e6483c6c0f6f3/libs/editor-common/assets/editor.css#L141) line from the CSS. However, this probably isn't the root cause, and it also breaks the progress bar on `API > 18`.\r\n\r\nIf we can't fix issue #2 above, we might as well drop the container entirely (and load a different CSS file for API > 18` and for `API <= 18`).\r\n\r\n<h3>4: Bugginess with the edit overlay on some API levels</h3>\r\n\r\nI'll address this one as part of the future PR for #13."},"comment":{"url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/issues/comments/135162541","html_url":"https://github.com/wordpress-mobile/WordPress-Editor-Android/pull/236#issuecomment-135162541","issue_url":"https://api.github.com/repos/wordpress-mobile/WordPress-Editor-Android/issues/236","id":135162541,"user":{"login":"bummytime","id":154014,"avatar_url":"https://avatars.githubusercontent.com/u/154014?v=3","gravatar_id":"","url":"https://api.github.com/users/bummytime","html_url":"https://github.com/bummytime","followers_url":"https://api.github.com/users/bummytime/followers","following_url":"https://api.github.com/users/bummytime/following{/other_user}","gists_url":"https://api.github.com/users/bummytime/gists{/gist_id}","starred_url":"https://api.github.com/users/bummytime/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bummytime/subscriptions","organizations_url":"https://api.github.com/users/bummytime/orgs","repos_url":"https://api.github.com/users/bummytime/repos","events_url":"https://api.github.com/users/bummytime/events{/privacy}","received_events_url":"https://api.github.com/users/bummytime/received_events","type":"User","site_admin":false},"created_at":"2015-08-26T20:34:32Z","updated_at":"2015-08-26T20:34:32Z","body":"@thianhlu @aforcier Oooooook. Ignore my comment above. The stop upload is working, however I needed to tap twice (once for webview focus and once to trigger the dialog)."}}