aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/WebBox.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/nodes/WebBox.tsx')
-rw-r--r--src/client/views/nodes/WebBox.tsx26
1 files changed, 12 insertions, 14 deletions
diff --git a/src/client/views/nodes/WebBox.tsx b/src/client/views/nodes/WebBox.tsx
index acccccfb4..9dafaadcb 100644
--- a/src/client/views/nodes/WebBox.tsx
+++ b/src/client/views/nodes/WebBox.tsx
@@ -247,20 +247,10 @@ export class WebBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProps
}
// bcz: hack - iframe grabs all events which messes up how we handle contextMenus. So this super naively simulates the event stack to get the specific menu items and the doc view menu items.
- if (e.button === 2) {
+ if (e.button === 2 || (e.button === 0 && e.ctrlKey)) {
e.preventDefault();
e.stopPropagation();
- const where = this.props.ScreenToLocalTransform().inverse().transformPoint(e.pageX, e.pageY);
- if (ContextMenu.Instance.getItems().length) {
- ContextMenu.Instance.displayMenu(where[0], where[1]);
- }
- else {
- ContextMenu.Instance.closeMenu();
- this.specificContextMenu(e);
- this.props.docViewPath().lastElement().docView?.onContextMenu(undefined, where[0], where[1]);
- }
- } else {
- ContextMenu.Instance.closeMenu();
+ ContextMenu.Instance.setIgnoreEvents(true);
}
}
@@ -457,11 +447,19 @@ export class WebBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProps
}), returnFalse, () => MarqueeAnnotator.clearAnnotations(this._savedAnnotations), false);
}
}
- @action finishMarquee = (x?: number, y?: number) => {
+ @action finishMarquee = (x?: number, y?: number, e?: PointerEvent) => {
this._marqueeing = undefined;
this._isAnnotating = false;
this._iframeClick = undefined;
- x !== undefined && y !== undefined && this._setPreviewCursor?.(x, y, false, false);
+ if (x !== undefined && y !== undefined) {
+ this._setPreviewCursor?.(x, y, false, false);
+ ContextMenu.Instance.closeMenu();
+ ContextMenu.Instance.setIgnoreEvents(false);
+ if (e?.button === 2 || e?.ctrlKey) {
+ this.specificContextMenu(undefined as any);
+ this.props.docViewPath().lastElement().docView?.onContextMenu(undefined, x, y);
+ }
+ }
}
@computed get urlContent() {