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/CollectionFreeFormDocumentView.tsx5
-rw-r--r--src/client/views/nodes/DocumentView.tsx14
-rw-r--r--src/client/views/nodes/FieldView.tsx1
3 files changed, 10 insertions, 10 deletions
diff --git a/src/client/views/nodes/CollectionFreeFormDocumentView.tsx b/src/client/views/nodes/CollectionFreeFormDocumentView.tsx
index d68184da6..ff37847df 100644
--- a/src/client/views/nodes/CollectionFreeFormDocumentView.tsx
+++ b/src/client/views/nodes/CollectionFreeFormDocumentView.tsx
@@ -140,6 +140,7 @@ export class CollectionFreeFormDocumentView extends DocComponent<CollectionFreeF
opacity = () => this.Opacity;
NativeWidth = () => this.nativeWidth;
NativeHeight = () => this.nativeHeight;
+ returnThis = () => this;
@computed get pointerEvents() {
if (this.props.pointerEvents === "none") return "none";
return this.props.styleProvider?.(this.Document, this.props, !this._contentView?.docView?.isSelected() ? "pointerEvents:selected" : "pointerEvents");
@@ -149,9 +150,9 @@ export class CollectionFreeFormDocumentView extends DocComponent<CollectionFreeF
const backgroundColor = this.props.styleProvider?.(this.Document, this.props, "backgroundColor");
const borderRounding = StrCast(Doc.Layout(this.layoutDoc).borderRounding) || StrCast(this.layoutDoc.borderRounding) || StrCast(this.Document.borderRounding) || undefined;
- const divProps = {
+ const divProps: DocumentViewProps = {
...this.props,
- nudge: this.nudge,
+ CollectionFreeFormDocumentView: this.returnThis,
dragDivName: "collectionFreeFormDocumentView-container",
opacity: this.opacity,
ScreenToLocalTransform: this.getTransform,
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx
index 595c3a950..591859737 100644
--- a/src/client/views/nodes/DocumentView.tsx
+++ b/src/client/views/nodes/DocumentView.tsx
@@ -41,6 +41,7 @@ import { PresBox } from './PresBox';
import { RadialMenu } from './RadialMenu';
import { TaskCompletionBox } from './TaskCompletedBox';
import React = require("react");
+import { CollectionFreeFormDocumentView } from "./CollectionFreeFormDocumentView";
export type DocAfterFocusFunc = (notFocused: boolean) => boolean;
export type DocFocusFunc = (doc: Doc, willZoom?: boolean, scale?: number, afterFocus?: DocAfterFocusFunc, dontCenter?: boolean, focused?: boolean) => void;
@@ -48,6 +49,7 @@ export type DocFocusFunc = (doc: Doc, willZoom?: boolean, scale?: number, afterF
export interface DocumentViewSharedProps {
ContainingCollectionView: Opt<CollectionView>;
ContainingCollectionDoc: Opt<Doc>;
+ CollectionFreeFormDocumentView?: () => CollectionFreeFormDocumentView;
Document: Doc;
DataDoc?: Doc;
contentsActive?: (setActive: () => boolean) => void;
@@ -81,29 +83,27 @@ export interface DocumentViewSharedProps {
ContentScaling: () => number;
ChromeHeight?: () => number;
pointerEvents?: string;
+ scriptContext?: any; // can be assigned anything and will be passed as 'scriptContext' to any OnClick script that executes on this document
}
export interface DocumentViewProps extends DocumentViewSharedProps {
// properties specific to DocumentViews but not to FieldView
+ layoutKey?: string;
freezeDimensions?: boolean;
fitToBox?: boolean;
treeViewDoc?: Doc;
dragDivName?: string;
contentsPointerEvents?: string;
- getView?: (view: DocumentView) => any;
+ radialMenu?: String[];
+ display?: string;
+ relative?: boolean;
LayoutTemplate?: () => Opt<Doc>;
contextMenuItems?: () => { script: ScriptField, label: string }[];
onDoubleClick?: () => ScriptField;
onPointerDown?: () => ScriptField;
onPointerUp?: () => ScriptField;
- nudge?: (x: number, y: number) => void;
setupDragLines?: (snapToDraggedDoc: boolean) => void;
forceHideLinkButton?: () => boolean;
opacity?: () => number | undefined;
- layoutKey?: string;
- radialMenu?: String[];
- display?: string;
- relative?: boolean;
- scriptContext?: any;
}
@observer
diff --git a/src/client/views/nodes/FieldView.tsx b/src/client/views/nodes/FieldView.tsx
index 1d58893ae..057c7afae 100644
--- a/src/client/views/nodes/FieldView.tsx
+++ b/src/client/views/nodes/FieldView.tsx
@@ -31,7 +31,6 @@ export interface FieldViewProps extends DocumentViewSharedProps {
color?: string;
xMargin?: number;
yMargin?: number;
- scriptContext?: any;
}
@observer