{"action":"created","comment":{"url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/comments/94517993","pull_request_review_id":15045623,"id":94517993,"diff_hunk":"@@ -86,6 +88,10 @@ const ImageEditor = React.createClass( {\n \t\t\tmedia: currentMedia\n \t\t} = this.props;\n \n+\t\tif (newProps.isEscPressed) {","path":"client/blocks/image-editor/index.jsx","position":24,"original_position":24,"commit_id":"cf290829358220f2101db68bcb5f279859db7c9a","original_commit_id":"cf290829358220f2101db68bcb5f279859db7c9a","user":{"login":"aduth","id":1779930,"avatar_url":"https://avatars.githubusercontent.com/u/1779930?v=3","gravatar_id":"","url":"https://api.github.com/users/aduth","html_url":"https://github.com/aduth","followers_url":"https://api.github.com/users/aduth/followers","following_url":"https://api.github.com/users/aduth/following{/other_user}","gists_url":"https://api.github.com/users/aduth/gists{/gist_id}","starred_url":"https://api.github.com/users/aduth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aduth/subscriptions","organizations_url":"https://api.github.com/users/aduth/orgs","repos_url":"https://api.github.com/users/aduth/repos","events_url":"https://api.github.com/users/aduth/events{/privacy}","received_events_url":"https://api.github.com/users/aduth/received_events","type":"User","site_admin":false},"body":"Need spaces between parens ([reference](https://github.com/Automattic/wp-calypso/blob/2490b4cb4f22ee87fd050e14124137cd42d4d381/docs/coding-guidelines/javascript.md#examples-of-good-spacing)).","created_at":"2017-01-04T01:32:13Z","updated_at":"2017-01-04T01:36:11Z","html_url":"https://github.com/Automattic/wp-calypso/pull/10268#discussion_r94517993","pull_request_url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/10268","_links":{"self":{"href":"https://api.github.com/repos/Automattic/wp-calypso/pulls/comments/94517993"},"html":{"href":"https://github.com/Automattic/wp-calypso/pull/10268#discussion_r94517993"},"pull_request":{"href":"https://api.github.com/repos/Automattic/wp-calypso/pulls/10268"}}},"pull_request":{"url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/10268","id":99346342,"html_url":"https://github.com/Automattic/wp-calypso/pull/10268","diff_url":"https://github.com/Automattic/wp-calypso/pull/10268.diff","patch_url":"https://github.com/Automattic/wp-calypso/pull/10268.patch","issue_url":"https://api.github.com/repos/Automattic/wp-calypso/issues/10268","number":10268,"state":"open","locked":false,"title":"close-on-escape proposition","user":{"login":"spen","id":4335450,"avatar_url":"https://avatars.githubusercontent.com/u/4335450?v=3","gravatar_id":"","url":"https://api.github.com/users/spen","html_url":"https://github.com/spen","followers_url":"https://api.github.com/users/spen/followers","following_url":"https://api.github.com/users/spen/following{/other_user}","gists_url":"https://api.github.com/users/spen/gists{/gist_id}","starred_url":"https://api.github.com/users/spen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spen/subscriptions","organizations_url":"https://api.github.com/users/spen/orgs","repos_url":"https://api.github.com/users/spen/repos","events_url":"https://api.github.com/users/spen/events{/privacy}","received_events_url":"https://api.github.com/users/spen/received_events","type":"User","site_admin":false},"body":"**Hi All!** 🎅\r\n\r\nI've been tinkering with some of the mixins lately and looking at converting them to higher order components...  \r\nI noticed that some don't convert in a straight forward way - including this one.\r\n\r\nI've come up with 2 quite different ways to achieve the mixin functionality with a HoC:\r\n\r\n- **Method 1**\r\n  Register a method of the wrapped component with the HoC and have the HoC call that component when `esc` is pressed.\r\n\r\n- **Method 2**\r\n  Pass the pressed state of the esc key (true or false) to the wrapped component and let it handle it's own closing.\r\n\r\n**Method 2** seems like it could allow for more bugs but feels more like idiomatic to React, we're passing a prop - the two components here are otherwise dumb to each other.\r\n**Method 1** is essentially giving the child a way to pass up to the parent, which goes against Reacts principles.\r\n\r\n## Motivation\r\n\r\nI'm hoping that the dependancy on mixins can be completely removed by replacing their usage with HoCs. That would allow for the usage of `React.createClass` to be fully replaced with ES6 syntax & `extends component` / `extends pureComponent`.\r\n\r\n## Testing\r\n\r\nTo test these changes I've been doing the following (for both methods):\r\n\r\n- Go to a blog post\r\n- Select 'Featured Image' > 'Set Featured Image' from the side-bar\r\n  <img width=\"228\" alt=\"featured-image\" src=\"https://cloud.githubusercontent.com/assets/4335450/21477448/20ec2d3a-cb96-11e6-9094-50eb2c8dba78.png\">\r\n- Upload or select an image from your media library\r\n- follow through to the image editor for that image\r\n  ![image-editor](https://cloud.githubusercontent.com/assets/4335450/21477547/f941f87c-cb96-11e6-896d-221121b5ce22.gif)\r\n- There's now a 'stack' of escapable components, `dialog-base` and `image-editor`\r\n- Press esc once, the image editor should close.\r\n- Press esc again, the media library (uses dialog-base) should now close too.\r\n- Repeat this process but hold 'esc' down.\r\n- Both components should close in succession.\r\n\r\n\r\nThis is a rough draft, at least for now, so for now I'm really just interested in getting some feedback on the approach. If we reach some sort of agreement I'll clean this up properly and rebase 😉.","created_at":"2016-12-26T07:18:47Z","updated_at":"2017-01-04T01:36:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"980832fa97b96e9385014ff6db28e510c0f41b39","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/10268/commits","review_comments_url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/10268/comments","review_comment_url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Automattic/wp-calypso/issues/10268/comments","statuses_url":"https://api.github.com/repos/Automattic/wp-calypso/statuses/cf290829358220f2101db68bcb5f279859db7c9a","head":{"label":"spen:try/port-closeOnEsc-mixin-to-hoc","ref":"try/port-closeOnEsc-mixin-to-hoc","sha":"cf290829358220f2101db68bcb5f279859db7c9a","user":{"login":"spen","id":4335450,"avatar_url":"https://avatars.githubusercontent.com/u/4335450?v=3","gravatar_id":"","url":"https://api.github.com/users/spen","html_url":"https://github.com/spen","followers_url":"https://api.github.com/users/spen/followers","following_url":"https://api.github.com/users/spen/following{/other_user}","gists_url":"https://api.github.com/users/spen/gists{/gist_id}","starred_url":"https://api.github.com/users/spen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spen/subscriptions","organizations_url":"https://api.github.com/users/spen/orgs","repos_url":"https://api.github.com/users/spen/repos","events_url":"https://api.github.com/users/spen/events{/privacy}","received_events_url":"https://api.github.com/users/spen/received_events","type":"User","site_admin":false},"repo":{"id":69190490,"name":"wp-calypso","full_name":"spen/wp-calypso","owner":{"login":"spen","id":4335450,"avatar_url":"https://avatars.githubusercontent.com/u/4335450?v=3","gravatar_id":"","url":"https://api.github.com/users/spen","html_url":"https://github.com/spen","followers_url":"https://api.github.com/users/spen/followers","following_url":"https://api.github.com/users/spen/following{/other_user}","gists_url":"https://api.github.com/users/spen/gists{/gist_id}","starred_url":"https://api.github.com/users/spen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spen/subscriptions","organizations_url":"https://api.github.com/users/spen/orgs","repos_url":"https://api.github.com/users/spen/repos","events_url":"https://api.github.com/users/spen/events{/privacy}","received_events_url":"https://api.github.com/users/spen/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/spen/wp-calypso","description":"The new JavaScript- and API-powered WordPress.com","fork":true,"url":"https://api.github.com/repos/spen/wp-calypso","forks_url":"https://api.github.com/repos/spen/wp-calypso/forks","keys_url":"https://api.github.com/repos/spen/wp-calypso/keys{/key_id}","collaborators_url":"https://api.github.com/repos/spen/wp-calypso/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/spen/wp-calypso/teams","hooks_url":"https://api.github.com/repos/spen/wp-calypso/hooks","issue_events_url":"https://api.github.com/repos/spen/wp-calypso/issues/events{/number}","events_url":"https://api.github.com/repos/spen/wp-calypso/events","assignees_url":"https://api.github.com/repos/spen/wp-calypso/assignees{/user}","branches_url":"https://api.github.com/repos/spen/wp-calypso/branches{/branch}","tags_url":"https://api.github.com/repos/spen/wp-calypso/tags","blobs_url":"https://api.github.com/repos/spen/wp-calypso/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/spen/wp-calypso/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/spen/wp-calypso/git/refs{/sha}","trees_url":"https://api.github.com/repos/spen/wp-calypso/git/trees{/sha}","statuses_url":"https://api.github.com/repos/spen/wp-calypso/statuses/{sha}","languages_url":"https://api.github.com/repos/spen/wp-calypso/languages","stargazers_url":"https://api.github.com/repos/spen/wp-calypso/stargazers","contributors_url":"https://api.github.com/repos/spen/wp-calypso/contributors","subscribers_url":"https://api.github.com/repos/spen/wp-calypso/subscribers","subscription_url":"https://api.github.com/repos/spen/wp-calypso/subscription","commits_url":"https://api.github.com/repos/spen/wp-calypso/commits{/sha}","git_commits_url":"https://api.github.com/repos/spen/wp-calypso/git/commits{/sha}","comments_url":"https://api.github.com/repos/spen/wp-calypso/comments{/number}","issue_comment_url":"https://api.github.com/repos/spen/wp-calypso/issues/comments{/number}","contents_url":"https://api.github.com/repos/spen/wp-calypso/contents/{+path}","compare_url":"https://api.github.com/repos/spen/wp-calypso/compare/{base}...{head}","merges_url":"https://api.github.com/repos/spen/wp-calypso/merges","archive_url":"https://api.github.com/repos/spen/wp-calypso/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/spen/wp-calypso/downloads","issues_url":"https://api.github.com/repos/spen/wp-calypso/issues{/number}","pulls_url":"https://api.github.com/repos/spen/wp-calypso/pulls{/number}","milestones_url":"https://api.github.com/repos/spen/wp-calypso/milestones{/number}","notifications_url":"https://api.github.com/repos/spen/wp-calypso/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/spen/wp-calypso/labels{/name}","releases_url":"https://api.github.com/repos/spen/wp-calypso/releases{/id}","deployments_url":"https://api.github.com/repos/spen/wp-calypso/deployments","created_at":"2016-09-25T21:04:20Z","updated_at":"2016-09-25T21:04:29Z","pushed_at":"2017-01-04T01:05:21Z","git_url":"git://github.com/spen/wp-calypso.git","ssh_url":"git@github.com:spen/wp-calypso.git","clone_url":"https://github.com/spen/wp-calypso.git","svn_url":"https://github.com/spen/wp-calypso","homepage":"https://developer.wordpress.com/calypso/","size":38964,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Automattic:master","ref":"master","sha":"96ed8a92ee72764cad64edd5de25b575be148ca2","user":{"login":"Automattic","id":887802,"avatar_url":"https://avatars.githubusercontent.com/u/887802?v=3","gravatar_id":"","url":"https://api.github.com/users/Automattic","html_url":"https://github.com/Automattic","followers_url":"https://api.github.com/users/Automattic/followers","following_url":"https://api.github.com/users/Automattic/following{/other_user}","gists_url":"https://api.github.com/users/Automattic/gists{/gist_id}","starred_url":"https://api.github.com/users/Automattic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Automattic/subscriptions","organizations_url":"https://api.github.com/users/Automattic/orgs","repos_url":"https://api.github.com/users/Automattic/repos","events_url":"https://api.github.com/users/Automattic/events{/privacy}","received_events_url":"https://api.github.com/users/Automattic/received_events","type":"Organization","site_admin":false},"repo":{"id":45936895,"name":"wp-calypso","full_name":"Automattic/wp-calypso","owner":{"login":"Automattic","id":887802,"avatar_url":"https://avatars.githubusercontent.com/u/887802?v=3","gravatar_id":"","url":"https://api.github.com/users/Automattic","html_url":"https://github.com/Automattic","followers_url":"https://api.github.com/users/Automattic/followers","following_url":"https://api.github.com/users/Automattic/following{/other_user}","gists_url":"https://api.github.com/users/Automattic/gists{/gist_id}","starred_url":"https://api.github.com/users/Automattic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Automattic/subscriptions","organizations_url":"https://api.github.com/users/Automattic/orgs","repos_url":"https://api.github.com/users/Automattic/repos","events_url":"https://api.github.com/users/Automattic/events{/privacy}","received_events_url":"https://api.github.com/users/Automattic/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Automattic/wp-calypso","description":"The new JavaScript- and API-powered WordPress.com","fork":false,"url":"https://api.github.com/repos/Automattic/wp-calypso","forks_url":"https://api.github.com/repos/Automattic/wp-calypso/forks","keys_url":"https://api.github.com/repos/Automattic/wp-calypso/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Automattic/wp-calypso/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Automattic/wp-calypso/teams","hooks_url":"https://api.github.com/repos/Automattic/wp-calypso/hooks","issue_events_url":"https://api.github.com/repos/Automattic/wp-calypso/issues/events{/number}","events_url":"https://api.github.com/repos/Automattic/wp-calypso/events","assignees_url":"https://api.github.com/repos/Automattic/wp-calypso/assignees{/user}","branches_url":"https://api.github.com/repos/Automattic/wp-calypso/branches{/branch}","tags_url":"https://api.github.com/repos/Automattic/wp-calypso/tags","blobs_url":"https://api.github.com/repos/Automattic/wp-calypso/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Automattic/wp-calypso/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Automattic/wp-calypso/git/refs{/sha}","trees_url":"https://api.github.com/repos/Automattic/wp-calypso/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Automattic/wp-calypso/statuses/{sha}","languages_url":"https://api.github.com/repos/Automattic/wp-calypso/languages","stargazers_url":"https://api.github.com/repos/Automattic/wp-calypso/stargazers","contributors_url":"https://api.github.com/repos/Automattic/wp-calypso/contributors","subscribers_url":"https://api.github.com/repos/Automattic/wp-calypso/subscribers","subscription_url":"https://api.github.com/repos/Automattic/wp-calypso/subscription","commits_url":"https://api.github.com/repos/Automattic/wp-calypso/commits{/sha}","git_commits_url":"https://api.github.com/repos/Automattic/wp-calypso/git/commits{/sha}","comments_url":"https://api.github.com/repos/Automattic/wp-calypso/comments{/number}","issue_comment_url":"https://api.github.com/repos/Automattic/wp-calypso/issues/comments{/number}","contents_url":"https://api.github.com/repos/Automattic/wp-calypso/contents/{+path}","compare_url":"https://api.github.com/repos/Automattic/wp-calypso/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Automattic/wp-calypso/merges","archive_url":"https://api.github.com/repos/Automattic/wp-calypso/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Automattic/wp-calypso/downloads","issues_url":"https://api.github.com/repos/Automattic/wp-calypso/issues{/number}","pulls_url":"https://api.github.com/repos/Automattic/wp-calypso/pulls{/number}","milestones_url":"https://api.github.com/repos/Automattic/wp-calypso/milestones{/number}","notifications_url":"https://api.github.com/repos/Automattic/wp-calypso/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Automattic/wp-calypso/labels{/name}","releases_url":"https://api.github.com/repos/Automattic/wp-calypso/releases{/id}","deployments_url":"https://api.github.com/repos/Automattic/wp-calypso/deployments","created_at":"2015-11-10T20:00:16Z","updated_at":"2017-01-03T23:03:29Z","pushed_at":"2017-01-04T01:16:21Z","git_url":"git://github.com/Automattic/wp-calypso.git","ssh_url":"git@github.com:Automattic/wp-calypso.git","clone_url":"https://github.com/Automattic/wp-calypso.git","svn_url":"https://github.com/Automattic/wp-calypso","homepage":"https://developer.wordpress.com/calypso/","size":38607,"stargazers_count":8274,"watchers_count":8274,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1050,"mirror_url":null,"open_issues_count":1601,"forks":1050,"open_issues":1601,"watchers":8274,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Automattic/wp-calypso/pulls/10268"},"html":{"href":"https://github.com/Automattic/wp-calypso/pull/10268"},"issue":{"href":"https://api.github.com/repos/Automattic/wp-calypso/issues/10268"},"comments":{"href":"https://api.github.com/repos/Automattic/wp-calypso/issues/10268/comments"},"review_comments":{"href":"https://api.github.com/repos/Automattic/wp-calypso/pulls/10268/comments"},"review_comment":{"href":"https://api.github.com/repos/Automattic/wp-calypso/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Automattic/wp-calypso/pulls/10268/commits"},"statuses":{"href":"https://api.github.com/repos/Automattic/wp-calypso/statuses/cf290829358220f2101db68bcb5f279859db7c9a"}}}}
{"actor":{"display_login":"aduth"}}