aboutsummaryrefslogtreecommitdiff
path: root/src/client/util/RichTextSchema.tsx
diff options
context:
space:
mode:
authorBob Zeleznik <zzzman@gmail.com>2020-01-27 23:30:32 -0500
committerBob Zeleznik <zzzman@gmail.com>2020-01-27 23:30:32 -0500
commitdf88c30ec47a2a80c9723f7a6b7ac203dffe34a1 (patch)
tree65433ac358fbff82e58480885debae0c9d2fabe4 /src/client/util/RichTextSchema.tsx
parente864a54e0ef509f540f9be550a853878046b14d3 (diff)
fixed templates for texts
Diffstat (limited to 'src/client/util/RichTextSchema.tsx')
-rw-r--r--src/client/util/RichTextSchema.tsx10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/client/util/RichTextSchema.tsx b/src/client/util/RichTextSchema.tsx
index 0deedbe39..7051ba1c3 100644
--- a/src/client/util/RichTextSchema.tsx
+++ b/src/client/util/RichTextSchema.tsx
@@ -19,6 +19,7 @@ import React = require("react");
import { BoolCast, NumCast, StrCast } from "../../new_fields/Types";
import { FormattedTextBox } from "../views/nodes/FormattedTextBox";
import { ObjectField } from "../../new_fields/ObjectField";
+import { ComputedField } from "../../new_fields/ScriptField";
const blockquoteDOM: DOMOutputSpecArray = ["blockquote", 0], hrDOM: DOMOutputSpecArray = ["hr"],
preDOM: DOMOutputSpecArray = ["pre", ["code", 0]], brDOM: DOMOutputSpecArray = ["br"], ulDOM: DOMOutputSpecArray = ["ul", 0];
@@ -782,14 +783,17 @@ export class DashDocView {
}
doRender(dashDoc: Doc, removeDoc: any) {
const self = this;
- const finalLayout = Doc.expandTemplateLayout(dashDoc, this._textBox.dataDoc);
+ const finalLayout = Doc.expandTemplateLayout(dashDoc, !Doc.AreProtosEqual(this._textBox.dataDoc, this._textBox.Document) ? this._textBox.dataDoc : undefined);
if (!finalLayout) setTimeout(() => self.doRender(dashDoc, removeDoc), 0);
else {
const layoutKey = StrCast(finalLayout.layoutKey);
const finalKey = layoutKey && StrCast(finalLayout[layoutKey]).split("'")?.[1];
if (finalLayout !== dashDoc && finalKey) {
- const finalLayoutField = finalLayout[finalKey]
- finalLayoutField instanceof ObjectField && (finalLayout._textTemplate = ObjectField.MakeCopy(finalLayoutField));
+ const finalLayoutField = finalLayout[finalKey];
+ if (finalLayoutField instanceof ObjectField) {
+ //finalLayout._textTemplate = ObjectField.MakeCopy(finalLayoutField);
+ finalLayout._textTemplate = ComputedField.MakeFunction(`copyField(this.${finalKey})`, { this: Doc.name });
+ }
}
this._reactionDisposer && this._reactionDisposer();
this._reactionDisposer = reaction(() => [finalLayout[WidthSym](), finalLayout[HeightSym]()], (dim) => {