aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/FormattedTextBox.tsx
diff options
context:
space:
mode:
authorSam Wilkins <samwilkins333@gmail.com>2019-08-14 01:00:29 -0400
committerSam Wilkins <samwilkins333@gmail.com>2019-08-14 01:00:29 -0400
commitdc766185075b5861686c68a704a8e49213eacbc6 (patch)
treeb883fd60d3997aee5ee8e4fe00cda69127777e6c /src/client/views/nodes/FormattedTextBox.tsx
parent2b829d1028a61869858ecd48e2f1801819e17488 (diff)
cleanup and streamlined / robust type requirements
Diffstat (limited to 'src/client/views/nodes/FormattedTextBox.tsx')
-rw-r--r--src/client/views/nodes/FormattedTextBox.tsx20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/client/views/nodes/FormattedTextBox.tsx b/src/client/views/nodes/FormattedTextBox.tsx
index 8c2af7c9e..50ec27259 100644
--- a/src/client/views/nodes/FormattedTextBox.tsx
+++ b/src/client/views/nodes/FormattedTextBox.tsx
@@ -670,16 +670,18 @@ export class FormattedTextBox extends DocComponent<(FieldViewProps & FormattedTe
}
exportToGoogleDoc = () => {
- let dataDoc = Doc.GetProto(this.props.Document);
- let data = Cast(dataDoc.data, RichTextField);
- let content: string | undefined;
- if (data && (content = data.plainText())) {
- GoogleApiClientUtils.Docs.Write({
- title: StrCast(dataDoc.title),
- store: { receiver: dataDoc, key: googleDocKey },
- content
- });
+ const dataDoc = Doc.GetProto(this.props.Document);
+ const data = Cast(dataDoc.data, RichTextField);
+ if (!data) {
+ return;
}
+ GoogleApiClientUtils.Docs.Write({
+ reference: {
+ title: StrCast(dataDoc.title),
+ handler: id => dataDoc[googleDocKey] = id
+ },
+ content: data.plainText()
+ });
}
render() {