aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/util/RichTextRules.ts4
-rw-r--r--src/client/util/RichTextSchema.tsx10
2 files changed, 9 insertions, 5 deletions
diff --git a/src/client/util/RichTextRules.ts b/src/client/util/RichTextRules.ts
index 389c84c54..1de8e7175 100644
--- a/src/client/util/RichTextRules.ts
+++ b/src/client/util/RichTextRules.ts
@@ -207,11 +207,11 @@ export const inpRules = {
const textDocInline = Docs.Create.TextDocument("", { _width: 75, _height: 35, backgroundColor: "yellow", annotationOn: textDoc, _autoHeight: true, fontSize: 9, title: "inline comment" });
textDocInline.layoutKey = "layout_" + inlineFieldKey;
textDocInline.customTitle = true;
- textDocInline.title = inlineFieldKey;
textDocInline.isTemplateForField = inlineFieldKey;
+ textDocInline.title = inlineFieldKey;
textDocInline.proto = textDoc;
textDoc[textDocInline.layoutKey] = FormattedTextBox.LayoutString(inlineFieldKey);
- textDoc[inlineFieldKey] = "-inline-";
+ textDoc[inlineFieldKey] = "";
const node = (state.doc.resolve(start) as any).nodeAfter;
const newNode = schema.nodes.dashComment.create({ docid: textDocInline[Id] });
const dashDoc = schema.nodes.dashDoc.create({ width: 75, height: 35, title: "dashDoc", docid: textDocInline[Id], float: "right" });
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) => {