{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla/webmaker-android/pulls/comments/30437140","id":30437140,"diff_hunk":"@@ -9,25 +9,69 @@ var editors = {\n   text: require('./text-editor.jsx')\n };\n \n+var blocks = require('../../blocks/all.jsx');\n+\n var hash = window.location.hash && window.location.hash.replace('#', '');\n-var fakeParams = {project: '123', page: 'foo0', element: 'bar' + hash};\n \n render(React.createClass({\n   mixins: [router],\n   uri: function () {\n-    var params = this.state.params\n-    // for testing\n-    if (!params.element) params = fakeParams;\n-    return `/users/foo/projects/${params.project}/pages/${params.page}/elements/${params.element}`;\n+    var params = this.state.params;\n+    var element = params.element;\n+    if (hash) {\n+      switch(hash) {\n+        case 'image':\n+          element = 1;\n+          break;\n+        case 'text':\n+          element = 2;\n+          break;\n+        case 'link':\n+          element = 3;\n+          break;\n+        default:\n+          element = 2;\n+      }\n+    }\n+    return `/users/1/projects/${params.project}/pages/${params.page}/elements/${element}`;\n   },\n+\n   componentWillMount: function() {\n-    api({uri: this.uri()}, (err, data) => {\n-      this.setState({element: data});\n+    this.load();\n+  },\n+  componentDidUpdate: function (prevProps) {\n+    // resume\n+    if (this.props.isVisible && !prevProps.isVisible) {\n+      this.load();\n+      console.log('restored!');\n+    }\n+    // pause - if there are edits\n+    if (this.edits && !this.props.isVisible && prevProps.isVisible) {\n+      this.save();\n+    }\n+  },\n+  cacheEdits: function (edits) {\n+    this.edits = edits;\n+  },\n+  save: function () {\n+    var edits = this.edits;\n+    var json = blocks[edits.type].spec.expand(edits);\n+    api({method: 'patch', uri: this.uri(), json: {\n+      styles: json.styles,\n+      attributes: json.attributes\n+    }}, (err, data) => {\n+      console.log(err, data);","path":"www_src/pages/element/element.jsx","position":62,"original_position":62,"commit_id":"dbb325ce688437a03086535b037e3fd44d70eb39","original_commit_id":"dbb325ce688437a03086535b037e3fd44d70eb39","user":{"login":"thisandagain","id":747641,"avatar_url":"https://avatars.githubusercontent.com/u/747641?v=3","gravatar_id":"","url":"https://api.github.com/users/thisandagain","html_url":"https://github.com/thisandagain","followers_url":"https://api.github.com/users/thisandagain/followers","following_url":"https://api.github.com/users/thisandagain/following{/other_user}","gists_url":"https://api.github.com/users/thisandagain/gists{/gist_id}","starred_url":"https://api.github.com/users/thisandagain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thisandagain/subscriptions","organizations_url":"https://api.github.com/users/thisandagain/orgs","repos_url":"https://api.github.com/users/thisandagain/repos","events_url":"https://api.github.com/users/thisandagain/events{/privacy}","received_events_url":"https://api.github.com/users/thisandagain/received_events","type":"User","site_admin":false},"body":"Stray `console.log`. Though we probably should log `if (err)`","created_at":"2015-05-15T19:11:58Z","updated_at":"2015-05-15T19:11:58Z","html_url":"https://github.com/mozilla/webmaker-android/pull/1869#discussion_r30437140","pull_request_url":"https://api.github.com/repos/mozilla/webmaker-android/pulls/1869","_links":{"self":{"href":"https://api.github.com/repos/mozilla/webmaker-android/pulls/comments/30437140"},"html":{"href":"https://github.com/mozilla/webmaker-android/pull/1869#discussion_r30437140"},"pull_request":{"href":"https://api.github.com/repos/mozilla/webmaker-android/pulls/1869"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla/webmaker-android/pulls/1869","id":35465997,"html_url":"https://github.com/mozilla/webmaker-android/pull/1869","diff_url":"https://github.com/mozilla/webmaker-android/pull/1869.diff","patch_url":"https://github.com/mozilla/webmaker-android/pull/1869.patch","issue_url":"https://api.github.com/repos/mozilla/webmaker-android/issues/1869","number":1869,"state":"open","locked":false,"title":"API Integration","user":{"login":"k88hudson","id":1455535,"avatar_url":"https://avatars.githubusercontent.com/u/1455535?v=3","gravatar_id":"","url":"https://api.github.com/users/k88hudson","html_url":"https://github.com/k88hudson","followers_url":"https://api.github.com/users/k88hudson/followers","following_url":"https://api.github.com/users/k88hudson/following{/other_user}","gists_url":"https://api.github.com/users/k88hudson/gists{/gist_id}","starred_url":"https://api.github.com/users/k88hudson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/k88hudson/subscriptions","organizations_url":"https://api.github.com/users/k88hudson/orgs","repos_url":"https://api.github.com/users/k88hudson/repos","events_url":"https://api.github.com/users/k88hudson/events{/privacy}","received_events_url":"https://api.github.com/users/k88hudson/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-05-14T21:50:20Z","updated_at":"2015-05-15T19:11:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"24698d407272b5c8f3ddd26326d2dabd428e10d1","assignee":{"login":"thisandagain","id":747641,"avatar_url":"https://avatars.githubusercontent.com/u/747641?v=3","gravatar_id":"","url":"https://api.github.com/users/thisandagain","html_url":"https://github.com/thisandagain","followers_url":"https://api.github.com/users/thisandagain/followers","following_url":"https://api.github.com/users/thisandagain/following{/other_user}","gists_url":"https://api.github.com/users/thisandagain/gists{/gist_id}","starred_url":"https://api.github.com/users/thisandagain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thisandagain/subscriptions","organizations_url":"https://api.github.com/users/thisandagain/orgs","repos_url":"https://api.github.com/users/thisandagain/repos","events_url":"https://api.github.com/users/thisandagain/events{/privacy}","received_events_url":"https://api.github.com/users/thisandagain/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/mozilla/webmaker-android/pulls/1869/commits","review_comments_url":"https://api.github.com/repos/mozilla/webmaker-android/pulls/1869/comments","review_comment_url":"https://api.github.com/repos/mozilla/webmaker-android/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla/webmaker-android/issues/1869/comments","statuses_url":"https://api.github.com/repos/mozilla/webmaker-android/statuses/dbb325ce688437a03086535b037e3fd44d70eb39","head":{"label":"k88hudson:apihookup","ref":"apihookup","sha":"dbb325ce688437a03086535b037e3fd44d70eb39","user":{"login":"k88hudson","id":1455535,"avatar_url":"https://avatars.githubusercontent.com/u/1455535?v=3","gravatar_id":"","url":"https://api.github.com/users/k88hudson","html_url":"https://github.com/k88hudson","followers_url":"https://api.github.com/users/k88hudson/followers","following_url":"https://api.github.com/users/k88hudson/following{/other_user}","gists_url":"https://api.github.com/users/k88hudson/gists{/gist_id}","starred_url":"https://api.github.com/users/k88hudson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/k88hudson/subscriptions","organizations_url":"https://api.github.com/users/k88hudson/orgs","repos_url":"https://api.github.com/users/k88hudson/repos","events_url":"https://api.github.com/users/k88hudson/events{/privacy}","received_events_url":"https://api.github.com/users/k88hudson/received_events","type":"User","site_admin":false},"repo":{"id":22930581,"name":"webmaker-android","full_name":"k88hudson/webmaker-android","owner":{"login":"k88hudson","id":1455535,"avatar_url":"https://avatars.githubusercontent.com/u/1455535?v=3","gravatar_id":"","url":"https://api.github.com/users/k88hudson","html_url":"https://github.com/k88hudson","followers_url":"https://api.github.com/users/k88hudson/followers","following_url":"https://api.github.com/users/k88hudson/following{/other_user}","gists_url":"https://api.github.com/users/k88hudson/gists{/gist_id}","starred_url":"https://api.github.com/users/k88hudson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/k88hudson/subscriptions","organizations_url":"https://api.github.com/users/k88hudson/orgs","repos_url":"https://api.github.com/users/k88hudson/repos","events_url":"https://api.github.com/users/k88hudson/events{/privacy}","received_events_url":"https://api.github.com/users/k88hudson/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/k88hudson/webmaker-android","description":"An app that makes apps","fork":true,"url":"https://api.github.com/repos/k88hudson/webmaker-android","forks_url":"https://api.github.com/repos/k88hudson/webmaker-android/forks","keys_url":"https://api.github.com/repos/k88hudson/webmaker-android/keys{/key_id}","collaborators_url":"https://api.github.com/repos/k88hudson/webmaker-android/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/k88hudson/webmaker-android/teams","hooks_url":"https://api.github.com/repos/k88hudson/webmaker-android/hooks","issue_events_url":"https://api.github.com/repos/k88hudson/webmaker-android/issues/events{/number}","events_url":"https://api.github.com/repos/k88hudson/webmaker-android/events","assignees_url":"https://api.github.com/repos/k88hudson/webmaker-android/assignees{/user}","branches_url":"https://api.github.com/repos/k88hudson/webmaker-android/branches{/branch}","tags_url":"https://api.github.com/repos/k88hudson/webmaker-android/tags","blobs_url":"https://api.github.com/repos/k88hudson/webmaker-android/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/k88hudson/webmaker-android/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/k88hudson/webmaker-android/git/refs{/sha}","trees_url":"https://api.github.com/repos/k88hudson/webmaker-android/git/trees{/sha}","statuses_url":"https://api.github.com/repos/k88hudson/webmaker-android/statuses/{sha}","languages_url":"https://api.github.com/repos/k88hudson/webmaker-android/languages","stargazers_url":"https://api.github.com/repos/k88hudson/webmaker-android/stargazers","contributors_url":"https://api.github.com/repos/k88hudson/webmaker-android/contributors","subscribers_url":"https://api.github.com/repos/k88hudson/webmaker-android/subscribers","subscription_url":"https://api.github.com/repos/k88hudson/webmaker-android/subscription","commits_url":"https://api.github.com/repos/k88hudson/webmaker-android/commits{/sha}","git_commits_url":"https://api.github.com/repos/k88hudson/webmaker-android/git/commits{/sha}","comments_url":"https://api.github.com/repos/k88hudson/webmaker-android/comments{/number}","issue_comment_url":"https://api.github.com/repos/k88hudson/webmaker-android/issues/comments{/number}","contents_url":"https://api.github.com/repos/k88hudson/webmaker-android/contents/{+path}","compare_url":"https://api.github.com/repos/k88hudson/webmaker-android/compare/{base}...{head}","merges_url":"https://api.github.com/repos/k88hudson/webmaker-android/merges","archive_url":"https://api.github.com/repos/k88hudson/webmaker-android/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/k88hudson/webmaker-android/downloads","issues_url":"https://api.github.com/repos/k88hudson/webmaker-android/issues{/number}","pulls_url":"https://api.github.com/repos/k88hudson/webmaker-android/pulls{/number}","milestones_url":"https://api.github.com/repos/k88hudson/webmaker-android/milestones{/number}","notifications_url":"https://api.github.com/repos/k88hudson/webmaker-android/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/k88hudson/webmaker-android/labels{/name}","releases_url":"https://api.github.com/repos/k88hudson/webmaker-android/releases{/id}","created_at":"2014-08-13T20:42:01Z","updated_at":"2015-05-09T18:26:02Z","pushed_at":"2015-05-15T19:09:59Z","git_url":"git://github.com/k88hudson/webmaker-android.git","ssh_url":"git@github.com:k88hudson/webmaker-android.git","clone_url":"https://github.com/k88hudson/webmaker-android.git","svn_url":"https://github.com/k88hudson/webmaker-android","homepage":"","size":22204,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mozilla:develop","ref":"develop","sha":"43282e694ab63b92eb75fd0b36812c9bc44f1de0","user":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"repo":{"id":22361331,"name":"webmaker-android","full_name":"mozilla/webmaker-android","owner":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla/webmaker-android","description":"Webmaker for Android","fork":false,"url":"https://api.github.com/repos/mozilla/webmaker-android","forks_url":"https://api.github.com/repos/mozilla/webmaker-android/forks","keys_url":"https://api.github.com/repos/mozilla/webmaker-android/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/webmaker-android/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/webmaker-android/teams","hooks_url":"https://api.github.com/repos/mozilla/webmaker-android/hooks","issue_events_url":"https://api.github.com/repos/mozilla/webmaker-android/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/webmaker-android/events","assignees_url":"https://api.github.com/repos/mozilla/webmaker-android/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/webmaker-android/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/webmaker-android/tags","blobs_url":"https://api.github.com/repos/mozilla/webmaker-android/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/webmaker-android/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/webmaker-android/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/webmaker-android/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/webmaker-android/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/webmaker-android/languages","stargazers_url":"https://api.github.com/repos/mozilla/webmaker-android/stargazers","contributors_url":"https://api.github.com/repos/mozilla/webmaker-android/contributors","subscribers_url":"https://api.github.com/repos/mozilla/webmaker-android/subscribers","subscription_url":"https://api.github.com/repos/mozilla/webmaker-android/subscription","commits_url":"https://api.github.com/repos/mozilla/webmaker-android/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/webmaker-android/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/webmaker-android/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/webmaker-android/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla/webmaker-android/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/webmaker-android/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/webmaker-android/merges","archive_url":"https://api.github.com/repos/mozilla/webmaker-android/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/webmaker-android/downloads","issues_url":"https://api.github.com/repos/mozilla/webmaker-android/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/webmaker-android/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/webmaker-android/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/webmaker-android/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/webmaker-android/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/webmaker-android/releases{/id}","created_at":"2014-07-28T23:25:53Z","updated_at":"2015-05-09T18:24:16Z","pushed_at":"2015-05-15T19:09:59Z","git_url":"git://github.com/mozilla/webmaker-android.git","ssh_url":"git@github.com:mozilla/webmaker-android.git","clone_url":"https://github.com/mozilla/webmaker-android.git","svn_url":"https://github.com/mozilla/webmaker-android","homepage":"http://webmaker.org","size":26987,"stargazers_count":77,"watchers_count":77,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":69,"mirror_url":null,"open_issues_count":177,"forks":69,"open_issues":177,"watchers":77,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla/webmaker-android/pulls/1869"},"html":{"href":"https://github.com/mozilla/webmaker-android/pull/1869"},"issue":{"href":"https://api.github.com/repos/mozilla/webmaker-android/issues/1869"},"comments":{"href":"https://api.github.com/repos/mozilla/webmaker-android/issues/1869/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla/webmaker-android/pulls/1869/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla/webmaker-android/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla/webmaker-android/pulls/1869/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla/webmaker-android/statuses/dbb325ce688437a03086535b037e3fd44d70eb39"}}}}