aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/DocumentView.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/nodes/DocumentView.tsx')
-rw-r--r--src/client/views/nodes/DocumentView.tsx18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx
index d7ecc6d9d..3be8afda3 100644
--- a/src/client/views/nodes/DocumentView.tsx
+++ b/src/client/views/nodes/DocumentView.tsx
@@ -16,6 +16,7 @@ import { ImageBox } from "../nodes/ImageBox";
import "./NodeView.scss";
import React = require("react");
import { Transform } from "../../util/Transform";
+import { DocumentManager } from "../DocumentManager";
const JsxParser = require('react-jsx-parser').default;//TODO Why does this need to be imported like this?
export interface DocumentViewProps {
@@ -32,6 +33,9 @@ export interface DocumentViewProps {
@observer
export class DocumentView extends React.Component<DocumentViewProps> {
+ public Id: string = Utils.GenerateGuid();
+ public tempTitle: string = "hello there"
+
protected _mainCont = React.createRef<any>();
get MainContent() {
return this._mainCont;
@@ -69,6 +73,20 @@ export class DocumentView extends React.Component<DocumentViewProps> {
return 1;
}
+ //adds doc to global list
+ componentDidMount: () => void = () => {
+ DocumentManager.Instance.DocumentViews.push(this);
+ }
+
+ //removes doc from global list
+ componentWillUnmount: () => void = () => {
+ for (let node of DocumentManager.Instance.DocumentViews) {
+ if (Object.is(node, this)) {
+ DocumentManager.Instance.DocumentViews.splice(DocumentManager.Instance.DocumentViews.indexOf(this), 1);
+ }
+ }
+ }
+
render() {
let bindings = { ...this.props } as any;