{"action":"created","comment":{"url":"https://api.github.com/repos/jupyter/jupyter-js-notebook/pulls/comments/64925252","id":64925252,"diff_hunk":"@@ -111,153 +75,62 @@ interface IBaseCellModel extends IDisposable {\n  * The definition of a code cell.\n  */\n export\n-interface ICodeCellModel extends IBaseCellModel {\n-  /**\n-   * Execution, display, or stream outputs.\n-   */\n-  output: IOutputAreaModel;\n-\n+interface ICodeCellModel extends ICellModel {\n   /**\n    * The code cell's prompt number. Will be null if the cell has not been run.\n    */\n   executionCount: number;\n \n   /**\n-   * Whether the cell is collapsed/expanded.\n-   */\n-  collapsed?: boolean;\n-\n-  /**\n-   * Whether the cell's output is scrolled, unscrolled, or autoscrolled.\n-   */\n-  scrolled?: ScrollSetting;\n-\n-  /**\n-   * Clear the cell state.\n-   */\n-  clear(): void;\n-}\n-\n-\n-/**\n- * The definition of a raw cell.\n- */\n-export\n-interface IRawCellModel extends IBaseCellModel {\n-  /**\n-   * Raw cell metadata format for nbconvert.\n-   */\n-  format?: string;\n-}\n-\n-\n-/**\n- * The definition of a markdown cell.\n- */\n-export\n-interface IMarkdownCellModel extends IBaseCellModel {\n-  /**\n-   * Whether the cell is rendered.\n+   * The cell outputs.\n    */\n-  rendered: boolean;\n+  outputs: ObservableOutputs;\n }\n \n \n-\n-/**\n- * A model consisting of any valid cell type.\n- */\n-export\n-type ICellModel =  (\n-  IRawCellModel | IMarkdownCellModel | ICodeCellModel\n-);\n-\n-\n /**\n- * An implemention of the base cell Model.\n+ * An implementation of the cell model.\n  */\n export\n-class BaseCellModel implements IBaseCellModel {\n-  /**\n-   * Construct a new base cell model.\n-   */\n-  constructor(input: IInputAreaModel) {\n-    this._input = input;\n-  }\n-\n-  /**\n-   * A signal emitted when the state of the model changes.\n-   */\n-  get stateChanged(): ISignal<IBaseCellModel, IChangedArgs<any>> {\n-    return CellModelPrivate.stateChangedSignal.bind(this);\n-  }\n-\n-  /**\n-   * A signal emitted when a user metadata state changes.\n-   *\n-   * #### Notes\n-   * The signal argument is the namespace of the metadata that changed.\n-   */\n-  get metadataChanged(): ISignal<IBaseCellModel, string> {\n-    return CellModelPrivate.metadataChangedSignal.bind(this);\n-  }\n-\n-  /**\n-   * Get the input area model.\n-   */\n-  get input(): IInputAreaModel {\n-    return this._input;\n-  }\n-\n+class CellModel implements ICellModel {\n   /**\n-   * The trusted state of the cell.\n-   *\n-   * See http://jupyter-notebook.readthedocs.org/en/latest/security.html.\n+   * Construct a cell model from optional cell content.\n    */\n-  get trusted(): boolean {\n-    return this._trusted;\n-  }\n-  set trusted(newValue: boolean) {\n-    if (newValue === this._trusted) {\n+  constructor(cell?: IBaseCell) {\n+    if (!cell) {\n       return;\n     }\n-    let oldValue = this._trusted;\n-    this._trusted = newValue;\n-    this.onTrustChanged(newValue);\n-    let name = 'trusted';\n-    this.stateChanged.emit({ name, oldValue, newValue });\n+    this.source = cell.source;\n+    let metadata = utils.copy(cell.metadata);\n+    if (this.type !== 'raw') {\n+      delete metadata['format'];\n+    }\n+    if (this.type !== 'code') {\n+      delete metadata['collapsed'];\n+      delete metadata['scrolled'];\n+    }","path":"src/cells/model.ts","position":241,"original_position":241,"commit_id":"5cc1f84b7dccc90b9d8b767bbf3f462f5277c75e","original_commit_id":"5cc1f84b7dccc90b9d8b767bbf3f462f5277c75e","user":{"login":"jasongrout","id":192614,"avatar_url":"https://avatars.githubusercontent.com/u/192614?v=3","gravatar_id":"","url":"https://api.github.com/users/jasongrout","html_url":"https://github.com/jasongrout","followers_url":"https://api.github.com/users/jasongrout/followers","following_url":"https://api.github.com/users/jasongrout/following{/other_user}","gists_url":"https://api.github.com/users/jasongrout/gists{/gist_id}","starred_url":"https://api.github.com/users/jasongrout/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasongrout/subscriptions","organizations_url":"https://api.github.com/users/jasongrout/orgs","repos_url":"https://api.github.com/users/jasongrout/repos","events_url":"https://api.github.com/users/jasongrout/events{/privacy}","received_events_url":"https://api.github.com/users/jasongrout/received_events","type":"User","site_admin":false},"body":"This is a bit weird that the base class is doing things that rely on `this.type` and an understanding of how subclasses use metadata. And arguably if a markdown cell happens to have metadata with key 'collapsed', and gets converted to a code cell, the metadata key should now means something and maybe should be reset anyway. I experimented with some other implementations where the base class just copies the metadata and then the subclasses take care of the extra metadata fields, and concluded that the problem here really is about mixing a user metadata bag with metadata fields in the standard. If those were separated, we could copy the user metadata in the base class and in subclasses decide how to deal with cell-type-specific metadata.","created_at":"2016-05-27T15:45:51Z","updated_at":"2016-05-27T15:45:51Z","html_url":"https://github.com/jupyter/jupyter-js-notebook/pull/213#discussion_r64925252","pull_request_url":"https://api.github.com/repos/jupyter/jupyter-js-notebook/pulls/213","_links":{"self":{"href":"https://api.github.com/repos/jupyter/jupyter-js-notebook/pulls/comments/64925252"},"html":{"href":"https://github.com/jupyter/jupyter-js-notebook/pull/213#discussion_r64925252"},"pull_request":{"href":"https://api.github.com/repos/jupyter/jupyter-js-notebook/pulls/213"}}},"pull_request":{"url":"https://api.github.com/repos/jupyter/jupyter-js-notebook/pulls/213","id":70264863,"html_url":"https://github.com/jupyter/jupyter-js-notebook/pull/213","diff_url":"https://github.com/jupyter/jupyter-js-notebook/pull/213.diff","patch_url":"https://github.com/jupyter/jupyter-js-notebook/pull/213.patch","issue_url":"https://api.github.com/repos/jupyter/jupyter-js-notebook/issues/213","number":213,"state":"open","locked":false,"title":"[WIP] Clean up architecture","user":{"login":"blink1073","id":2096628,"avatar_url":"https://avatars.githubusercontent.com/u/2096628?v=3","gravatar_id":"","url":"https://api.github.com/users/blink1073","html_url":"https://github.com/blink1073","followers_url":"https://api.github.com/users/blink1073/followers","following_url":"https://api.github.com/users/blink1073/following{/other_user}","gists_url":"https://api.github.com/users/blink1073/gists{/gist_id}","starred_url":"https://api.github.com/users/blink1073/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blink1073/subscriptions","organizations_url":"https://api.github.com/users/blink1073/orgs","repos_url":"https://api.github.com/users/blink1073/repos","events_url":"https://api.github.com/users/blink1073/events{/privacy}","received_events_url":"https://api.github.com/users/blink1073/received_events","type":"User","site_admin":false},"body":"Fixes #166.","created_at":"2016-05-16T21:30:24Z","updated_at":"2016-05-27T15:45:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5daf2385c05a71bf24756b93b282eaf5622796f6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/jupyter/jupyter-js-notebook/pulls/213/commits","review_comments_url":"https://api.github.com/repos/jupyter/jupyter-js-notebook/pulls/213/comments","review_comment_url":"https://api.github.com/repos/jupyter/jupyter-js-notebook/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jupyter/jupyter-js-notebook/issues/213/comments","statuses_url":"https://api.github.com/repos/jupyter/jupyter-js-notebook/statuses/5cc1f84b7dccc90b9d8b767bbf3f462f5277c75e","head":{"label":"blink1073:doc-manager","ref":"doc-manager","sha":"5cc1f84b7dccc90b9d8b767bbf3f462f5277c75e","user":{"login":"blink1073","id":2096628,"avatar_url":"https://avatars.githubusercontent.com/u/2096628?v=3","gravatar_id":"","url":"https://api.github.com/users/blink1073","html_url":"https://github.com/blink1073","followers_url":"https://api.github.com/users/blink1073/followers","following_url":"https://api.github.com/users/blink1073/following{/other_user}","gists_url":"https://api.github.com/users/blink1073/gists{/gist_id}","starred_url":"https://api.github.com/users/blink1073/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blink1073/subscriptions","organizations_url":"https://api.github.com/users/blink1073/orgs","repos_url":"https://api.github.com/users/blink1073/repos","events_url":"https://api.github.com/users/blink1073/events{/privacy}","received_events_url":"https://api.github.com/users/blink1073/received_events","type":"User","site_admin":false},"repo":{"id":45501260,"name":"jupyter-js-notebook","full_name":"blink1073/jupyter-js-notebook","owner":{"login":"blink1073","id":2096628,"avatar_url":"https://avatars.githubusercontent.com/u/2096628?v=3","gravatar_id":"","url":"https://api.github.com/users/blink1073","html_url":"https://github.com/blink1073","followers_url":"https://api.github.com/users/blink1073/followers","following_url":"https://api.github.com/users/blink1073/following{/other_user}","gists_url":"https://api.github.com/users/blink1073/gists{/gist_id}","starred_url":"https://api.github.com/users/blink1073/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blink1073/subscriptions","organizations_url":"https://api.github.com/users/blink1073/orgs","repos_url":"https://api.github.com/users/blink1073/repos","events_url":"https://api.github.com/users/blink1073/events{/privacy}","received_events_url":"https://api.github.com/users/blink1073/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/blink1073/jupyter-js-notebook","description":"Javascript APIs for Jupyter notebooks","fork":true,"url":"https://api.github.com/repos/blink1073/jupyter-js-notebook","forks_url":"https://api.github.com/repos/blink1073/jupyter-js-notebook/forks","keys_url":"https://api.github.com/repos/blink1073/jupyter-js-notebook/keys{/key_id}","collaborators_url":"https://api.github.com/repos/blink1073/jupyter-js-notebook/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/blink1073/jupyter-js-notebook/teams","hooks_url":"https://api.github.com/repos/blink1073/jupyter-js-notebook/hooks","issue_events_url":"https://api.github.com/repos/blink1073/jupyter-js-notebook/issues/events{/number}","events_url":"https://api.github.com/repos/blink1073/jupyter-js-notebook/events","assignees_url":"https://api.github.com/repos/blink1073/jupyter-js-notebook/assignees{/user}","branches_url":"https://api.github.com/repos/blink1073/jupyter-js-notebook/branches{/branch}","tags_url":"https://api.github.com/repos/blink1073/jupyter-js-notebook/tags","blobs_url":"https://api.github.com/repos/blink1073/jupyter-js-notebook/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/blink1073/jupyter-js-notebook/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/blink1073/jupyter-js-notebook/git/refs{/sha}","trees_url":"https://api.github.com/repos/blink1073/jupyter-js-notebook/git/trees{/sha}","statuses_url":"https://api.github.com/repos/blink1073/jupyter-js-notebook/statuses/{sha}","languages_url":"https://api.github.com/repos/blink1073/jupyter-js-notebook/languages","stargazers_url":"https://api.github.com/repos/blink1073/jupyter-js-notebook/stargazers","contributors_url":"https://api.github.com/repos/blink1073/jupyter-js-notebook/contributors","subscribers_url":"https://api.github.com/repos/blink1073/jupyter-js-notebook/subscribers","subscription_url":"https://api.github.com/repos/blink1073/jupyter-js-notebook/subscription","commits_url":"https://api.github.com/repos/blink1073/jupyter-js-notebook/commits{/sha}","git_commits_url":"https://api.github.com/repos/blink1073/jupyter-js-notebook/git/commits{/sha}","comments_url":"https://api.github.com/repos/blink1073/jupyter-js-notebook/comments{/number}","issue_comment_url":"https://api.github.com/repos/blink1073/jupyter-js-notebook/issues/comments{/number}","contents_url":"https://api.github.com/repos/blink1073/jupyter-js-notebook/contents/{+path}","compare_url":"https://api.github.com/repos/blink1073/jupyter-js-notebook/compare/{base}...{head}","merges_url":"https://api.github.com/repos/blink1073/jupyter-js-notebook/merges","archive_url":"https://api.github.com/repos/blink1073/jupyter-js-notebook/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/blink1073/jupyter-js-notebook/downloads","issues_url":"https://api.github.com/repos/blink1073/jupyter-js-notebook/issues{/number}","pulls_url":"https://api.github.com/repos/blink1073/jupyter-js-notebook/pulls{/number}","milestones_url":"https://api.github.com/repos/blink1073/jupyter-js-notebook/milestones{/number}","notifications_url":"https://api.github.com/repos/blink1073/jupyter-js-notebook/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/blink1073/jupyter-js-notebook/labels{/name}","releases_url":"https://api.github.com/repos/blink1073/jupyter-js-notebook/releases{/id}","deployments_url":"https://api.github.com/repos/blink1073/jupyter-js-notebook/deployments","created_at":"2015-11-03T22:57:27Z","updated_at":"2016-02-03T16:23:48Z","pushed_at":"2016-05-25T20:15:33Z","git_url":"git://github.com/blink1073/jupyter-js-notebook.git","ssh_url":"git@github.com:blink1073/jupyter-js-notebook.git","clone_url":"https://github.com/blink1073/jupyter-js-notebook.git","svn_url":"https://github.com/blink1073/jupyter-js-notebook","homepage":null,"size":1477,"stargazers_count":0,"watchers_count":0,"language":"TypeScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"jupyter:master","ref":"master","sha":"542ac88c9b1cd2688abd598b2cec1b08cfee3a0b","user":{"login":"jupyter","id":7388996,"avatar_url":"https://avatars.githubusercontent.com/u/7388996?v=3","gravatar_id":"","url":"https://api.github.com/users/jupyter","html_url":"https://github.com/jupyter","followers_url":"https://api.github.com/users/jupyter/followers","following_url":"https://api.github.com/users/jupyter/following{/other_user}","gists_url":"https://api.github.com/users/jupyter/gists{/gist_id}","starred_url":"https://api.github.com/users/jupyter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jupyter/subscriptions","organizations_url":"https://api.github.com/users/jupyter/orgs","repos_url":"https://api.github.com/users/jupyter/repos","events_url":"https://api.github.com/users/jupyter/events{/privacy}","received_events_url":"https://api.github.com/users/jupyter/received_events","type":"Organization","site_admin":false},"repo":{"id":39586616,"name":"jupyter-js-notebook","full_name":"jupyter/jupyter-js-notebook","owner":{"login":"jupyter","id":7388996,"avatar_url":"https://avatars.githubusercontent.com/u/7388996?v=3","gravatar_id":"","url":"https://api.github.com/users/jupyter","html_url":"https://github.com/jupyter","followers_url":"https://api.github.com/users/jupyter/followers","following_url":"https://api.github.com/users/jupyter/following{/other_user}","gists_url":"https://api.github.com/users/jupyter/gists{/gist_id}","starred_url":"https://api.github.com/users/jupyter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jupyter/subscriptions","organizations_url":"https://api.github.com/users/jupyter/orgs","repos_url":"https://api.github.com/users/jupyter/repos","events_url":"https://api.github.com/users/jupyter/events{/privacy}","received_events_url":"https://api.github.com/users/jupyter/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/jupyter/jupyter-js-notebook","description":"JupyterLab notebook","fork":false,"url":"https://api.github.com/repos/jupyter/jupyter-js-notebook","forks_url":"https://api.github.com/repos/jupyter/jupyter-js-notebook/forks","keys_url":"https://api.github.com/repos/jupyter/jupyter-js-notebook/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jupyter/jupyter-js-notebook/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jupyter/jupyter-js-notebook/teams","hooks_url":"https://api.github.com/repos/jupyter/jupyter-js-notebook/hooks","issue_events_url":"https://api.github.com/repos/jupyter/jupyter-js-notebook/issues/events{/number}","events_url":"https://api.github.com/repos/jupyter/jupyter-js-notebook/events","assignees_url":"https://api.github.com/repos/jupyter/jupyter-js-notebook/assignees{/user}","branches_url":"https://api.github.com/repos/jupyter/jupyter-js-notebook/branches{/branch}","tags_url":"https://api.github.com/repos/jupyter/jupyter-js-notebook/tags","blobs_url":"https://api.github.com/repos/jupyter/jupyter-js-notebook/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jupyter/jupyter-js-notebook/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jupyter/jupyter-js-notebook/git/refs{/sha}","trees_url":"https://api.github.com/repos/jupyter/jupyter-js-notebook/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jupyter/jupyter-js-notebook/statuses/{sha}","languages_url":"https://api.github.com/repos/jupyter/jupyter-js-notebook/languages","stargazers_url":"https://api.github.com/repos/jupyter/jupyter-js-notebook/stargazers","contributors_url":"https://api.github.com/repos/jupyter/jupyter-js-notebook/contributors","subscribers_url":"https://api.github.com/repos/jupyter/jupyter-js-notebook/subscribers","subscription_url":"https://api.github.com/repos/jupyter/jupyter-js-notebook/subscription","commits_url":"https://api.github.com/repos/jupyter/jupyter-js-notebook/commits{/sha}","git_commits_url":"https://api.github.com/repos/jupyter/jupyter-js-notebook/git/commits{/sha}","comments_url":"https://api.github.com/repos/jupyter/jupyter-js-notebook/comments{/number}","issue_comment_url":"https://api.github.com/repos/jupyter/jupyter-js-notebook/issues/comments{/number}","contents_url":"https://api.github.com/repos/jupyter/jupyter-js-notebook/contents/{+path}","compare_url":"https://api.github.com/repos/jupyter/jupyter-js-notebook/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jupyter/jupyter-js-notebook/merges","archive_url":"https://api.github.com/repos/jupyter/jupyter-js-notebook/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jupyter/jupyter-js-notebook/downloads","issues_url":"https://api.github.com/repos/jupyter/jupyter-js-notebook/issues{/number}","pulls_url":"https://api.github.com/repos/jupyter/jupyter-js-notebook/pulls{/number}","milestones_url":"https://api.github.com/repos/jupyter/jupyter-js-notebook/milestones{/number}","notifications_url":"https://api.github.com/repos/jupyter/jupyter-js-notebook/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jupyter/jupyter-js-notebook/labels{/name}","releases_url":"https://api.github.com/repos/jupyter/jupyter-js-notebook/releases{/id}","deployments_url":"https://api.github.com/repos/jupyter/jupyter-js-notebook/deployments","created_at":"2015-07-23T19:07:31Z","updated_at":"2016-05-27T15:32:33Z","pushed_at":"2016-05-27T13:40:39Z","git_url":"git://github.com/jupyter/jupyter-js-notebook.git","ssh_url":"git@github.com:jupyter/jupyter-js-notebook.git","clone_url":"https://github.com/jupyter/jupyter-js-notebook.git","svn_url":"https://github.com/jupyter/jupyter-js-notebook","homepage":"","size":1705,"stargazers_count":28,"watchers_count":28,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":11,"mirror_url":null,"open_issues_count":18,"forks":11,"open_issues":18,"watchers":28,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jupyter/jupyter-js-notebook/pulls/213"},"html":{"href":"https://github.com/jupyter/jupyter-js-notebook/pull/213"},"issue":{"href":"https://api.github.com/repos/jupyter/jupyter-js-notebook/issues/213"},"comments":{"href":"https://api.github.com/repos/jupyter/jupyter-js-notebook/issues/213/comments"},"review_comments":{"href":"https://api.github.com/repos/jupyter/jupyter-js-notebook/pulls/213/comments"},"review_comment":{"href":"https://api.github.com/repos/jupyter/jupyter-js-notebook/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jupyter/jupyter-js-notebook/pulls/213/commits"},"statuses":{"href":"https://api.github.com/repos/jupyter/jupyter-js-notebook/statuses/5cc1f84b7dccc90b9d8b767bbf3f462f5277c75e"}}}}
{"actor":{"display_login":"jasongrout"}}