aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorandrewdkim <adkim414@gmail.com>2020-02-11 22:47:23 -0500
committerandrewdkim <adkim414@gmail.com>2020-02-11 22:47:23 -0500
commit864cba561db8e26240b093da7ab524e76c8823d1 (patch)
tree48b38cb97701d5c423abe16dca924d81d7df48e1 /src
parent47b939e9799da2f57047a15113c116d8ba31ce5e (diff)
small fixes for mobile remote upload
Diffstat (limited to 'src')
-rw-r--r--src/client/views/nodes/WebBox.tsx12
-rw-r--r--src/mobile/MobileInkOverlay.scss5
-rw-r--r--src/mobile/MobileInterface.scss2
-rw-r--r--src/mobile/MobileInterface.tsx8
-rw-r--r--src/server/DashSession/DashSessionAgent.ts21
-rw-r--r--src/server/authentication/models/current_user_utils.ts3
-rw-r--r--src/server/index.ts2
7 files changed, 33 insertions, 20 deletions
diff --git a/src/client/views/nodes/WebBox.tsx b/src/client/views/nodes/WebBox.tsx
index d486253b8..6cae4e878 100644
--- a/src/client/views/nodes/WebBox.tsx
+++ b/src/client/views/nodes/WebBox.tsx
@@ -193,9 +193,17 @@ export class WebBox extends DocAnnotatableComponent<FieldViewProps, WebDocument>
const B = this._iframeRef.current.getBoundingClientRect();
const iframeDoc = this._iframeRef.current.contentDocument;
if (B && iframeDoc) {
- // TODO: this only works when scale = 1
+ // check if there is selected text
+ const selectedText = iframeDoc.getSelection();
+ if (selectedText && selectedText.toString.length > -1) {
+
+ }
+ console.log("selectedText", selectedText ? selectedText.toString() : "");
+
+ // TODO: this only works when scale = 1 as it is currently only inteded for mobile upload
const element = iframeDoc.elementFromPoint(this._pressX - B.left, this._pressY - B.top);
- if (element && element.nodeName === "IMG") {
+ console.log("found element", element, element && element.nodeName);
+ if (element && element.nodeName) {//} === "IMG") {
pressedBound = element.getBoundingClientRect();
pressedElement = element.cloneNode(true) as HTMLElement;
}
diff --git a/src/mobile/MobileInkOverlay.scss b/src/mobile/MobileInkOverlay.scss
index 0b4484519..b9c1fb146 100644
--- a/src/mobile/MobileInkOverlay.scss
+++ b/src/mobile/MobileInkOverlay.scss
@@ -1,10 +1,11 @@
.mobileInkOverlay {
- border: 5px dashed red;
+ border: 10px dashed red;
background-color: rgba(0, 0, 0, .05);
}
.mobileInkOverlay-border {
- // background-color: rgba(0, 255, 0, .4); position: absolute;
+ // background-color: rgba(0, 255, 0, .4);
+ position: absolute;
pointer-events: auto;
cursor: pointer;
diff --git a/src/mobile/MobileInterface.scss b/src/mobile/MobileInterface.scss
index 8083e5760..d0849dbc7 100644
--- a/src/mobile/MobileInterface.scss
+++ b/src/mobile/MobileInterface.scss
@@ -13,6 +13,6 @@
}
.mobileInterface-container {
- height: calc(100% - 50px);
+ height: 100%;
position: relative;
} \ No newline at end of file
diff --git a/src/mobile/MobileInterface.tsx b/src/mobile/MobileInterface.tsx
index 07ee611ee..83410b99d 100644
--- a/src/mobile/MobileInterface.tsx
+++ b/src/mobile/MobileInterface.tsx
@@ -3,7 +3,7 @@ import { observer } from 'mobx-react';
import { computed, action, observable } from 'mobx';
import { CurrentUserUtils } from '../server/authentication/models/current_user_utils';
import { FieldValue, Cast, StrCast } from '../new_fields/Types';
-import { Doc } from '../new_fields/Doc';
+import { Doc, DocListCast } from '../new_fields/Doc';
import { Docs } from '../client/documents/Documents';
import { CollectionView } from '../client/views/collections/CollectionView';
import { DocumentView } from '../client/views/nodes/DocumentView';
@@ -220,8 +220,10 @@ export default class MobileInterface extends React.Component {
const data = Cast(this.mainContainer.data, listSpec(Doc));
if (data) {
const collectionDoc = await data[1]; // this should be the collection doc since the positions should be locked
- const children = Cast(collectionDoc.data, listSpec(Doc), []);
- const uploadDoc = children.length === 1 ? await children[0] : collectionDoc;
+ const children = DocListCast(collectionDoc.data);
+ const uploadDoc = children.length === 1 ? children[0] : Docs.Create.StackingDocument(children, {
+ title: "Mobile Upload Collection", backgroundColor: "white", lockedPosition: true, _width: 300, _height: 300
+ });
if (uploadDoc) {
DocServer.Mobile.dispatchMobileDocumentUpload({
docId: uploadDoc[Id],
diff --git a/src/server/DashSession/DashSessionAgent.ts b/src/server/DashSession/DashSessionAgent.ts
index c55e01243..44f77c049 100644
--- a/src/server/DashSession/DashSessionAgent.ts
+++ b/src/server/DashSession/DashSessionAgent.ts
@@ -25,15 +25,18 @@ export class DashSessionAgent extends AppliedSessionAgent {
* The core method invoked when the single master thread is initialized.
* Installs event hooks, repl commands and additional IPC listeners.
*/
- protected async initializeMonitor(monitor: Monitor, sessionKey: string): Promise<void> {
- await this.dispatchSessionPassword(sessionKey);
- monitor.addReplCommand("pull", [], () => monitor.exec("git pull"));
- monitor.addReplCommand("solr", [/start|stop|index/], this.executeSolrCommand);
- monitor.addReplCommand("backup", [], this.backup);
- monitor.addReplCommand("debug", [/\S+\@\S+/], async ([to]) => this.dispatchZippedDebugBackup(to));
- monitor.on("backup", this.backup);
- monitor.on("debug", async ({ to }) => this.dispatchZippedDebugBackup(to));
- monitor.coreHooks.onCrashDetected(this.dispatchCrashReport);
+ // protected async initializeMonitor(monitor: Monitor, sessionKey: string): Promise<void> {
+ protected async initializeMonitor(monitor: Monitor): Promise<string> {
+
+ // await this.dispatchSessionPassword(sessionKey);
+ // monitor.addReplCommand("pull", [], () => monitor.exec("git pull"));
+ // monitor.addReplCommand("solr", [/start|stop|index/], this.executeSolrCommand);
+ // monitor.addReplCommand("backup", [], this.backup);
+ // monitor.addReplCommand("debug", [/\S+\@\S+/], async ([to]) => this.dispatchZippedDebugBackup(to));
+ // monitor.on("backup", this.backup);
+ // monitor.on("debug", async ({ to }) => this.dispatchZippedDebugBackup(to));
+ // monitor.coreHooks.onCrashDetected(this.dispatchCrashReport);
+ return "";
}
/**
diff --git a/src/server/authentication/models/current_user_utils.ts b/src/server/authentication/models/current_user_utils.ts
index aa9f3649e..6c916689a 100644
--- a/src/server/authentication/models/current_user_utils.ts
+++ b/src/server/authentication/models/current_user_utils.ts
@@ -161,9 +161,8 @@ export class CurrentUserUtils {
const uploadDoc = Docs.Create.StackingDocument([], {
title: "Mobile Upload Collection", backgroundColor: "white", lockedPosition: true
});
- console.log(window.innerWidth, screen.width, window.devicePixelRatio);
return Docs.Create.StackingDocument([webDoc, uploadDoc], {
- columnWidth: screen.width - 10, lockedPosition: true, _chromeStatus: "disabled", title: "Upload", _autoHeight: true, _yMargin: 80, backgroundColor: "lightgray"
+ _width: screen.width, lockedPosition: true, _chromeStatus: "disabled", title: "Upload", _autoHeight: true, _yMargin: 80, backgroundColor: "lightgray"
});
}
diff --git a/src/server/index.ts b/src/server/index.ts
index 313a2f0e2..55ba71dba 100644
--- a/src/server/index.ts
+++ b/src/server/index.ts
@@ -141,7 +141,7 @@ export async function launchServer() {
* So, the 'else' clause is exactly what we've always run when executing npm start.
*/
if (process.env.RELEASE) {
- (sessionAgent = new DashSessionAgent()).launch();
+ // (sessionAgent = new DashSessionAgent()).launch();
} else {
launchServer();
}