Skip to content
This repository has been archived by the owner on Jan 31, 2024. It is now read-only.

Commit

Permalink
fix: selecting text in a note causing it to open
Browse files Browse the repository at this point in the history
Closes #175
  • Loading branch information
Mar0xy committed Nov 27, 2023
1 parent 51ec675 commit 3d0b754
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 4 additions & 1 deletion packages/frontend/src/components/MkNote.vue
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,10 @@ const currentClip = inject<Ref<Misskey.entities.Clip> | 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
Expand Down
7 changes: 5 additions & 2 deletions packages/frontend/src/components/MkSubNoteContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkLoading v-if="translating" mini/>
<div v-else>
<b>{{ i18n.t('translatedFrom', { x: translation.sourceLang }) }}: </b>
<Mfm :text="translation.text" :author="note.user" :nyaize="'account'" :emojiUrls="note.emojis"/>
<Mfm :text="translation.text" :author="note.user" :nyaize="'respect'" :emojiUrls="note.emojis"/>
</div>
</div>
<MkA v-if="note.renoteId" :class="$style.rp" :to="`/notes/${note.renoteId}`" v-on:click.stop>RN: ...</MkA>
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 3d0b754

Please sign in to comment.