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.tsx17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx
index cb080c08e..bc27c424c 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";
import { SelectionManager } from "../../util/SelectionManager";
import { DragManager } from "../../util/DragManager";
import { ContextMenu } from "../ContextMenu";
@@ -36,6 +37,9 @@ export interface DocumentViewProps {
@observer
export class DocumentView extends React.Component<DocumentViewProps> {
+ public Id: string = Utils.GenerateGuid();
+ public tempTitle: string = "hello there"
+
private _mainCont = React.createRef<HTMLDivElement>();
get MainContent() {
return this._mainCont;
@@ -210,6 +214,19 @@ 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);
+ }
+ }
+ }
isSelected = () => {
return SelectionManager.IsSelected(this);
}