From 871d2bad17e5060c3d970b3dab3cb5434abccee6 Mon Sep 17 00:00:00 2001
From: syuilo <syuilotan@yahoo.co.jp>
Date: Sun, 7 Feb 2021 00:11:16 +0900
Subject: Improve contextmenu handling

---
 src/client/ui/default.vue | 7 +++++++
 1 file changed, 7 insertions(+)

(limited to 'src/client/ui/default.vue')

diff --git a/src/client/ui/default.vue b/src/client/ui/default.vue
index 7626ddaa58..220dee9d6d 100644
--- a/src/client/ui/default.vue
+++ b/src/client/ui/default.vue
@@ -187,6 +187,13 @@ export default defineComponent({
 		},
 
 		onContextmenu(e) {
+			const isLink = (el: HTMLElement) => {
+				if (el.tagName === 'A') return true;
+				if (el.parentElement) {
+					return isLink(el.parentElement);
+				}
+			};
+			if (isLink(e.target)) return;
 			if (['INPUT', 'TEXTAREA'].includes(e.target.tagName) || e.target.attributes['contenteditable']) return;
 			if (window.getSelection().toString() !== '') return;
 			const path = this.$route.path;
-- 
cgit v1.2.3-freya

