From 3d0b754332192533b166f8aa20ec87f1808edfe8 Mon Sep 17 00:00:00 2001 From: Mar0xy Date: Mon, 27 Nov 2023 22:06:25 +0100 Subject: [PATCH] fix: selecting text in a note causing it to open Closes transfem-org/Sharkey#175 --- packages/frontend/src/components/MkNote.vue | 5 ++++- packages/frontend/src/components/MkSubNoteContent.vue | 7 +++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/frontend/src/components/MkNote.vue b/packages/frontend/src/components/MkNote.vue index 6dedf4702b..80fd4fc45c 100644 --- a/packages/frontend/src/components/MkNote.vue +++ b/packages/frontend/src/components/MkNote.vue @@ -226,7 +226,10 @@ const currentClip = inject | null>('currentClip', nul let note = $ref(deepClone(props.note)); function noteclick(id: string) { - router.push(`/notes/${id}`); + const selection = document.getSelection(); + if (selection?.toString().length === 0) { + router.push(`/notes/${id}`); + } } // plugin diff --git a/packages/frontend/src/components/MkSubNoteContent.vue b/packages/frontend/src/components/MkSubNoteContent.vue index 110644947f..8a306d172f 100644 --- a/packages/frontend/src/components/MkSubNoteContent.vue +++ b/packages/frontend/src/components/MkSubNoteContent.vue @@ -16,7 +16,7 @@ SPDX-License-Identifier: AGPL-3.0-only
{{ i18n.t('translatedFrom', { x: translation.sourceLang }) }}: - +
RN: ... @@ -63,7 +63,10 @@ const props = defineProps<{ const router = useRouter(); function noteclick(id: string) { - router.push(`/notes/${id}`); + const selection = document.getSelection(); + if (selection?.toString().length === 0) { + router.push(`/notes/${id}`); + } } const parsed = $computed(() => props.note.text ? mfm.parse(props.note.text) : null);