From c5afa9d579f91edf01267708eddae9060b4c0074 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8A=B1=E6=9E=9C=E5=B1=B1=E5=A4=A7=E5=9C=A3?= <316783812@qq.com> Date: Tue, 29 Nov 2022 00:31:09 +0800 Subject: [PATCH] feat: prevent page navigation when user select text (#203) --- components/status/StatusCard.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/status/StatusCard.vue b/components/status/StatusCard.vue index 88a9a6d3..3ac14fc8 100644 --- a/components/status/StatusCard.vue +++ b/components/status/StatusCard.vue @@ -24,7 +24,8 @@ const router = useRouter() function onclick(evt: MouseEvent | KeyboardEvent) { const path = evt.composedPath() as HTMLElement[] const el = path.find(el => ['A', 'BUTTON', 'IMG', 'VIDEO'].includes(el.tagName?.toUpperCase())) - if (!el) + const text = window.getSelection()?.toString() + if (!el && !text) go(evt) }