aboutsummaryrefslogtreecommitdiff
path: root/src/client/views
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views')
-rw-r--r--src/client/views/MainView.tsx12
-rw-r--r--src/client/views/nodes/FormattedTextBox.tsx20
2 files changed, 11 insertions, 21 deletions
diff --git a/src/client/views/MainView.tsx b/src/client/views/MainView.tsx
index 7b15e9624..77f0e3d60 100644
--- a/src/client/views/MainView.tsx
+++ b/src/client/views/MainView.tsx
@@ -149,18 +149,6 @@ export class MainView extends React.Component {
}, { fireImmediately: true });
}
- componentDidMount() {
- reaction(() => this.mainContainer, () => {
- let main = this.mainContainer, documentId;
- if (main && (documentId = StrCast(main.googleDocId))) {
- let options = { documentId, removeNewlines: true };
- GoogleApiClientUtils.Docs.ReadLines(options).then(lines => {
- console.log(lines);
- });
- }
- });
- }
-
componentWillUnMount() {
window.removeEventListener("keydown", KeyManager.Instance.handle);
window.removeEventListener("pointerdown", this.globalPointerDown);
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() {