aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/MainView.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/MainView.tsx')
-rw-r--r--src/client/views/MainView.tsx24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/client/views/MainView.tsx b/src/client/views/MainView.tsx
index 0a987de4a..3a5285a66 100644
--- a/src/client/views/MainView.tsx
+++ b/src/client/views/MainView.tsx
@@ -87,6 +87,11 @@ export class MainView extends React.Component {
if (!("presentationView" in doc)) {
doc.presentationView = new List<Doc>([Docs.Create.TreeDocument([], { title: "Presentation" })]);
}
+ if (!("googleDocId" in doc)) {
+ GoogleApiClientUtils.Docs.Create().then(id => {
+ id && (doc.googleDocId = id);
+ });
+ }
CurrentUserUtils.UserDocument.activeWorkspace = doc;
}
}
@@ -132,8 +137,6 @@ export class MainView extends React.Component {
window.removeEventListener("keydown", KeyManager.Instance.handle);
window.addEventListener("keydown", KeyManager.Instance.handle);
- GoogleApiClientUtils.Docs.Create().then(id => console.log(id));
-
reaction(() => {
let workspaces = CurrentUserUtils.UserDocument.workspaces;
let recent = CurrentUserUtils.UserDocument.recentlyClosed;
@@ -151,6 +154,18 @@ export class MainView extends React.Component {
}, { fireImmediately: true });
}
+ componentDidMount() {
+ reaction(() => this.mainContainer, () => {
+ let main = this.mainContainer, googleDocId;
+ if (main && (googleDocId = StrCast(main.googleDocId))) {
+ GoogleApiClientUtils.Docs.Read(googleDocId, true).then(text => {
+ text && Utils.CopyText(text);
+ console.log(text);
+ });
+ }
+ });
+ }
+
componentWillUnMount() {
window.removeEventListener("keydown", KeyManager.Instance.handle);
window.removeEventListener("pointerdown", this.globalPointerDown);
@@ -573,11 +588,6 @@ export class MainView extends React.Component {
render() {
return (
<div id="main-div">
- <input style={{ position: "absolute", zIndex: 100000 }} onKeyPress={e => {
- if (e.which === 13) {
- GoogleApiClientUtils.Docs.Retrieve(e.currentTarget.value.trim()).then((res: any) => console.log(res));
- }
- }} />
{this.dictationOverlay}
<DocumentDecorations />
{this.mainContent}