diff options
author | Hannah Chow <hannah_chow@brown.edu> | 2019-03-07 01:56:46 -0500 |
---|---|---|
committer | Hannah Chow <hannah_chow@brown.edu> | 2019-03-07 01:56:46 -0500 |
commit | 69d42193bf187a8a61e475a0587d55e29b644394 (patch) | |
tree | 3b2808529448a5775cff1299e572137b920961e7 /src/client/views/nodes/DocumentView.tsx | |
parent | 6bd826932b3c749c89581debe3eed0380ede9e4e (diff) |
following the link
Diffstat (limited to 'src/client/views/nodes/DocumentView.tsx')
-rw-r--r-- | src/client/views/nodes/DocumentView.tsx | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx index c9afbb150..d80abb460 100644 --- a/src/client/views/nodes/DocumentView.tsx +++ b/src/client/views/nodes/DocumentView.tsx @@ -1,4 +1,4 @@ -import { action, computed } from "mobx"; +import { action, computed, runInAction } from "mobx"; import { observer } from "mobx-react"; import { Document } from "../../../fields/Document"; import { Field, FieldWaiting, Opt } from "../../../fields/Field"; @@ -21,6 +21,7 @@ import { WebBox } from "../nodes/WebBox"; import "./DocumentView.scss"; import React = require("react"); import { TextField } from "../../../fields/TextField"; +import { DocumentManager } from "../../util/DocumentManager"; const JsxParser = require('react-jsx-parser').default; //TODO Why does this need to be imported like this? @@ -120,6 +121,9 @@ export class DocumentView extends React.Component<DocumentViewProps> { if (this._mainCont.current) { this.dropDisposer = DragManager.MakeDropTarget(this._mainCont.current, { handlers: { drop: this.drop.bind(this) } }); } + runInAction(() => { + DocumentManager.Instance.DocumentViews.push(this); + }) } componentDidUpdate() { @@ -135,6 +139,10 @@ export class DocumentView extends React.Component<DocumentViewProps> { if (this.dropDisposer) { this.dropDisposer(); } + runInAction(() => { + DocumentManager.Instance.DocumentViews.splice(DocumentManager.Instance.DocumentViews.indexOf(this), 1); + + }) } onPointerMove = (e: PointerEvent): void => { |