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.tsx32
1 files changed, 6 insertions, 26 deletions
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx
index ae2d3af13..e83f3fcba 100644
--- a/src/client/views/nodes/DocumentView.tsx
+++ b/src/client/views/nodes/DocumentView.tsx
@@ -243,42 +243,22 @@ export class DocumentView extends DocComponent<DocumentViewProps, Document>(Docu
}
}
- updateLayout = async () => {
- const baseLayout = await StrCast(this.props.Document.baseLayout);
- if (baseLayout) {
- let base = baseLayout;
- let layout = baseLayout;
-
- this.templates.forEach(template => {
- layout = template.replace("{layout}", base);
- base = layout;
- });
-
- this.props.Document.layout = layout;
- }
- }
@action
addTemplate = (template: Template) => {
- let templates = this.templates;
- templates.push(template.Layout);
- this.templates = new List<string>(templates.map(t => t));
- this.updateLayout();
+ this.templates.push(template.Layout);
+ this.templates = this.templates;
}
@action
removeTemplate = (template: Template) => {
- let templates = this.templates;
- for (let i = 0; i < templates.length; i++) {
- let temp = templates[i];
- if (temp === template.Layout) {
- templates.splice(i, 1);
+ for (let i = 0; i < this.templates.length; i++) {
+ if (this.templates[i] === template.Layout) {
+ this.templates.splice(i, 1);
break;
}
}
- templates = new List<string>(templates.splice(0, templates.length));
- this.templates = templates;
- this.updateLayout();
+ this.templates = this.templates;
}
@action