aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/FormattedTextBox.tsx
diff options
context:
space:
mode:
authorBob Zeleznik <zzzman@gmail.com>2019-10-19 13:49:20 -0400
committerBob Zeleznik <zzzman@gmail.com>2019-10-19 13:49:20 -0400
commit3d910bae8771e67cabc1500c49b77d425fdf62e9 (patch)
tree49448397feaacfed75be0e45ab4d9c254d3d5cf6 /src/client/views/nodes/FormattedTextBox.tsx
parent1a3f820a38a12b13e947f58b4b7459ed84c4f70b (diff)
cleaned up a bunch layout vs doc issues related to templates
Diffstat (limited to 'src/client/views/nodes/FormattedTextBox.tsx')
-rw-r--r--src/client/views/nodes/FormattedTextBox.tsx6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/client/views/nodes/FormattedTextBox.tsx b/src/client/views/nodes/FormattedTextBox.tsx
index 6f4ced7f3..ac10d729a 100644
--- a/src/client/views/nodes/FormattedTextBox.tsx
+++ b/src/client/views/nodes/FormattedTextBox.tsx
@@ -149,9 +149,7 @@ export class FormattedTextBox extends DocComponent<(FieldViewProps & FormattedTe
// the document containing the view layout information - will be the Document itself unless the Document has
// a layout field. In that case, all layout information comes from there unless overriden by Document
- @computed get layoutDoc(): Doc {
- return this.props.Document.layout instanceof Doc ? this.props.Document.layout : this.props.Document;
- }
+ @computed get layoutDoc(): Doc { return Doc.Layout(this.props.Document); }
linkOnDeselect: Map<string, string> = new Map();
@@ -268,7 +266,7 @@ export class FormattedTextBox extends DocComponent<(FieldViewProps & FormattedTe
// apply as template when dragging with Meta
} else if (draggedDoc && draggedDoc.type === DocumentType.TEXT && !Doc.AreProtosEqual(draggedDoc, this.props.Document) && de.mods === "MetaKey") {
draggedDoc.isTemplateDoc = true;
- let newLayout = draggedDoc.layout instanceof Doc ? draggedDoc.layout : draggedDoc;
+ let newLayout = Doc.Layout(draggedDoc);
if (typeof (draggedDoc.layout) === "string") {
newLayout = Doc.MakeDelegate(draggedDoc);
newLayout.layout = StrCast(newLayout.layout).replace(/fieldKey={"[^"]*"}/, `fieldKey={"${this.props.fieldKey}"}`);