aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Zeleznik <zzzman@gmail.com>2019-08-04 13:34:29 -0400
committerBob Zeleznik <zzzman@gmail.com>2019-08-04 13:34:29 -0400
commit0b2d0cc563755c7b5899bc25a791359306166d9b (patch)
treea38e71da8c69be3222302a2955a144cf0031c39e
parentfd047fa87334b948a4a0b00ccf9bd02ded03ea36 (diff)
fixed up backend for titles and captions.
-rw-r--r--src/client/views/nodes/DocumentView.tsx4
-rw-r--r--src/client/views/nodes/FormattedTextBox.tsx8
2 files changed, 2 insertions, 10 deletions
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx
index 4528cf94d..a7b4f33db 100644
--- a/src/client/views/nodes/DocumentView.tsx
+++ b/src/client/views/nodes/DocumentView.tsx
@@ -690,8 +690,8 @@ export class DocumentView extends DocComponent<DocumentViewProps, Document>(Docu
let templates = Cast(this.layoutDoc.templates, listSpec("string"));
if (!showOverlays && templates instanceof List) {
templates.map(str => {
- if (str.indexOf("{props.Document.title}") !== -1) showTitle = "title";
- if (str.indexOf("fieldKey={\"caption\"}") !== -1) showCaption = "caption";
+ if (!showTitle && str.indexOf("{props.Document.title}") !== -1) showTitle = "title";
+ if (!showCaption && str.indexOf("fieldKey={\"caption\"}") !== -1) showCaption = "caption";
});
}
let showTextTitle = showTitle && StrCast(this.layoutDoc.layout).startsWith("<FormattedTextBox") ? showTitle : undefined;
diff --git a/src/client/views/nodes/FormattedTextBox.tsx b/src/client/views/nodes/FormattedTextBox.tsx
index 6c97add76..9dd0643df 100644
--- a/src/client/views/nodes/FormattedTextBox.tsx
+++ b/src/client/views/nodes/FormattedTextBox.tsx
@@ -180,14 +180,6 @@ export class FormattedTextBox extends DocComponent<(FieldViewProps & FormattedTe
}
this._applyingChange = true;
const fieldkey = "preview";
- if (Object.keys(this.dataDoc).indexOf(fieldkey) !== -1) {
- this.dataDoc[this.props.fieldKey] = new RichTextField(JSON.stringify(state.toJSON()));
- this.dataDoc[this.props.fieldKey + "_text"] = state.doc.textBetween(0, state.doc.content.size, "\n\n");
- }
- else {
- Doc.GetProto(this.dataDoc)[this.props.fieldKey] = new RichTextField(JSON.stringify(state.toJSON()));
- Doc.GetProto(this.dataDoc)[this.props.fieldKey + "_text"] = state.doc.textBetween(0, state.doc.content.size, "\n\n");
- }
if (this.extensionDoc) this.extensionDoc.text = state.doc.textBetween(0, state.doc.content.size, "\n\n");
if (this.extensionDoc) this.extensionDoc.lastModified = new DateField(new Date(Date.now()));
this.dataDoc[this.props.fieldKey] = new RichTextField(JSON.stringify(state.toJSON()));