diff options
author | Bob Zeleznik <zzzman@gmail.com> | 2020-04-06 00:27:13 -0400 |
---|---|---|
committer | Bob Zeleznik <zzzman@gmail.com> | 2020-04-06 00:27:13 -0400 |
commit | 9aea1fa2e735aa485d698f374292ffd133eb76f3 (patch) | |
tree | 11758ed5f65e65cbabbe3ffe486204b3cb93aabd /src/client/views/nodes/DocumentView.tsx | |
parent | bc23e69a88234c213e444b1aa3c5eb895c35aca9 (diff) | |
parent | 43b241a496d446e7b613ad65fb016405009dd532 (diff) |
Merge branch 'master' into nativeWidthProps
Diffstat (limited to 'src/client/views/nodes/DocumentView.tsx')
-rw-r--r-- | src/client/views/nodes/DocumentView.tsx | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx index 32c5a02e5..9ca914bbe 100644 --- a/src/client/views/nodes/DocumentView.tsx +++ b/src/client/views/nodes/DocumentView.tsx @@ -674,20 +674,23 @@ export class DocumentView extends DocComponent<DocumentViewProps, Document>(Docu } @action - onContextMenu = async (e: React.MouseEvent): Promise<void> => { + onContextMenu = async (e: React.MouseEvent | Touch): Promise<void> => { // the touch onContextMenu is button 0, the pointer onContextMenu is button 2 - if (e.button === 0 && !e.ctrlKey) { - e.preventDefault(); - return; - } - e.persist(); - e?.stopPropagation(); - if (Math.abs(this._downX - e.clientX) > 3 || Math.abs(this._downY - e.clientY) > 3 || - e.isDefaultPrevented()) { + if (!(e instanceof Touch)) { + if (e.button === 0 && !e.ctrlKey) { + e.preventDefault(); + return; + } + e.persist(); + e?.stopPropagation(); + + if (Math.abs(this._downX - e.clientX) > 3 || Math.abs(this._downY - e.clientY) > 3 || + e.isDefaultPrevented()) { + e.preventDefault(); + return; + } e.preventDefault(); - return; } - e.preventDefault(); const cm = ContextMenu.Instance; const templateDoc = Cast(this.props.Document[StrCast(this.props.Document.layoutKey)], Doc, null); @@ -768,7 +771,7 @@ export class DocumentView extends DocComponent<DocumentViewProps, Document>(Docu recommender_subitems.push({ description: "Internal recommendations", - event: () => this.recommender(e), + event: () => this.recommender(), icon: "brain" }); @@ -829,7 +832,7 @@ export class DocumentView extends DocComponent<DocumentViewProps, Document>(Docu icon: "external-link-alt" }); - if (!this.topMost) { + if (!this.topMost && !(e instanceof Touch)) { // DocumentViews should stop propagation of this event e.stopPropagation(); } @@ -847,7 +850,7 @@ export class DocumentView extends DocComponent<DocumentViewProps, Document>(Docu }); } - recommender = async (e: React.MouseEvent) => { + recommender = async () => { if (!ClientRecommender.Instance) new ClientRecommender({ title: "Client Recommender" }); const documents: Doc[] = []; const allDocs = await SearchUtil.GetAllDocs(); |