aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/nodes')
-rw-r--r--src/client/views/nodes/DocumentView.tsx15
-rw-r--r--src/client/views/nodes/QueryBox.tsx61
2 files changed, 69 insertions, 7 deletions
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx
index aa07db2a0..c359be090 100644
--- a/src/client/views/nodes/DocumentView.tsx
+++ b/src/client/views/nodes/DocumentView.tsx
@@ -277,8 +277,16 @@ export class DocumentView extends DocComponent<DocumentViewProps, Document>(Docu
}
onClick = async (e: React.MouseEvent | React.PointerEvent) => {
+ console.log(this.props.Document[Id])
+ console.log(e.nativeEvent.cancelBubble);
+ console.log(CurrentUserUtils.MainDocId !== this.props.Document[Id]);
+ console.log(Math.abs(e.clientX - this._downX) < Utils.DRAG_THRESHOLD);
+ console.log(Math.abs(e.clientY - this._downY) < Utils.DRAG_THRESHOLD);
+
if (!e.nativeEvent.cancelBubble && !this.Document.ignoreClick && CurrentUserUtils.MainDocId !== this.props.Document[Id] &&
(Math.abs(e.clientX - this._downX) < Utils.DRAG_THRESHOLD && Math.abs(e.clientY - this._downY) < Utils.DRAG_THRESHOLD)) {
+ console.log("click");
+
e.stopPropagation();
let preventDefault = true;
if (this._doubleTap && this.props.renderDepth && !this.onClickHandler?.script) { // disable double-click to show full screen for things that have an on click behavior since clicking them twice can be misinterpreted as a double click
@@ -292,11 +300,17 @@ export class DocumentView extends DocComponent<DocumentViewProps, Document>(Docu
} else if (this.onClickHandler && this.onClickHandler.script) {
this.onClickHandler.script.run({ this: this.Document.isTemplateForField && this.props.DataDoc ? this.props.DataDoc : this.props.Document, containingCollection: this.props.ContainingCollectionDoc }, console.log);
} else if (this.Document.type === DocumentType.BUTTON) {
+ console.log("button");
+
ScriptBox.EditButtonScript("On Button Clicked ...", this.props.Document, "onClick", e.clientX, e.clientY);
} else if (this.props.Document.isButton === "Selector") { // this should be moved to an OnClick script
FormattedTextBoxComment.Hide();
+ console.log("button2");
+
this.Document.links?.[0] instanceof Doc && (Doc.UserDoc().SelectedDocs = new List([Doc.LinkOtherAnchor(this.Document.links[0], this.props.Document)]));
} else if (this.Document.isButton) {
+ console.log("button3");
+
SelectionManager.SelectDoc(this, e.ctrlKey); // don't think this should happen if a button action is actually triggered.
this.buttonClick(e.altKey, e.ctrlKey);
} else {
@@ -465,6 +479,7 @@ export class DocumentView extends DocComponent<DocumentViewProps, Document>(Docu
}
onPointerDown = (e: React.PointerEvent): void => {
+ console.log("ting");
if (this.onPointerDownHandler && this.onPointerDownHandler.script) {
this.onPointerDownHandler.script.run({ this: this.Document.isTemplateForField && this.props.DataDoc ? this.props.DataDoc : this.props.Document }, console.log);
document.removeEventListener("pointerup", this.onPointerUp);
diff --git a/src/client/views/nodes/QueryBox.tsx b/src/client/views/nodes/QueryBox.tsx
index b2f9ca8fe..995effd1b 100644
--- a/src/client/views/nodes/QueryBox.tsx
+++ b/src/client/views/nodes/QueryBox.tsx
@@ -1,12 +1,22 @@
import React = require("react");
import { library } from '@fortawesome/fontawesome-svg-core';
import { faArrowLeft, faArrowRight, faEdit, faMinus, faPlay, faPlus, faStop, faTimes } from '@fortawesome/free-solid-svg-icons';
-import { IReactionDisposer } from "mobx";
+import { IReactionDisposer, computed } from "mobx";
import { observer } from "mobx-react";
import { FilterBox } from "../search/FilterBox";
import { FieldView, FieldViewProps } from './FieldView';
import "./PresBox.scss";
import { SearchBox } from "../search/SearchBox";
+import { SelectionManager } from "../../util/SelectionManager";
+import { CollectionFreeFormView } from "../collections/collectionFreeForm/CollectionFreeFormView";
+import { emptyFunction, returnOne } from "../../../Utils";
+import { DocAnnotatableComponent } from '../DocComponent';
+import { makeInterface, createSchema } from "../../../new_fields/Schema";
+import { documentSchema } from "../../../new_fields/documentSchemas";
+import { TraceMobx } from "../../../new_fields/util";
+import { Id } from '../../../new_fields/FieldSymbols';
+
+
library.add(faArrowLeft);
library.add(faArrowRight);
@@ -17,8 +27,19 @@ library.add(faTimes);
library.add(faMinus);
library.add(faEdit);
+export const pageSchema = createSchema({
+ curPage: "number",
+ fitWidth: "boolean",
+ googlePhotosUrl: "string",
+ googlePhotosTags: "string"
+});
+
+
+type QueryDocument = makeInterface<[typeof pageSchema, typeof documentSchema]>;
+const QueryDocument = makeInterface(pageSchema, documentSchema);
+
@observer
-export class QueryBox extends React.Component<FieldViewProps> {
+export class QueryBox extends DocAnnotatableComponent<FieldViewProps, QueryDocument>(QueryDocument) {
public static LayoutString(fieldKey: string) { return FieldView.LayoutString(QueryBox, fieldKey); }
_docListChangedReaction: IReactionDisposer | undefined;
componentDidMount() {
@@ -28,12 +49,38 @@ export class QueryBox extends React.Component<FieldViewProps> {
this._docListChangedReaction && this._docListChangedReaction();
}
- render() {
- return <div style={{ width: "100%", height: "100%", position: "absolute", pointerEvents: "all" }}>
- <div style={{ display: "flex", flexDirection: "row-reverse" }}>
- <SearchBox />
- </div>
+ @computed get content() {
+ let key = this.props.Document[Id];
+ return <SearchBox id={key}/>
+ }
+ contentFunc = () => [this.content];
+
+ render() {
+ const dragging = !SelectionManager.GetIsDragging() ? "" : "-dragging";
+ return <div className={`queryBox${dragging}`} style={{ width: "100%", height: "100%", position: "absolute", pointerEvents: "all" }} >
+ {/* <CollectionFreeFormView {...this.props}
+ PanelHeight={this.props.PanelHeight}
+ PanelWidth={this.props.PanelWidth}
+ annotationsKey={this.annotationKey}
+ isAnnotationOverlay={true}
+ focus={this.props.focus}
+ isSelected={this.props.isSelected}
+ select={emptyFunction}
+ active={this.active}
+ ContentScaling={returnOne}
+ whenActiveChanged={this.whenActiveChanged}
+ removeDocument={this.removeDocument}
+ moveDocument={this.moveDocument}
+ addDocument={this.addDocument}
+ CollectionView={undefined}
+ ScreenToLocalTransform={this.props.ScreenToLocalTransform}
+ renderDepth={this.props.renderDepth + 1}
+ ContainingCollectionDoc={this.props.ContainingCollectionDoc}
+ chromeCollapsed={true}>
+ {this.contentFunc}
+ </CollectionFreeFormView> */}
+ {this.contentFunc()}
</div >;
}
} \ No newline at end of file