From b42ee44fa99b97f9b5a82d18e1f291270d119a49 Mon Sep 17 00:00:00 2001 From: Bojan Mojsilovic Date: Mon, 9 Oct 2023 13:40:47 +0200 Subject: [PATCH] Fix apostrophe after mention --- src/components/ParsedNote/ParsedNote.tsx | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/components/ParsedNote/ParsedNote.tsx b/src/components/ParsedNote/ParsedNote.tsx index 02ae5533..d10ffb25 100644 --- a/src/components/ParsedNote/ParsedNote.tsx +++ b/src/components/ParsedNote/ParsedNote.tsx @@ -41,6 +41,7 @@ import NoteImage from '../NoteImage/NoteImage'; import { createStore } from 'solid-js/store'; import { linebreakRegex } from '../../constants'; +const specialChars = [",", "?", ";", "!", "'"]; const ParsedNote: Component<{ note: PrimalNote, @@ -351,12 +352,18 @@ const ParsedNote: Component<{ return token; } - let end = id[id.length - 1]; + let end = ''; - if ([',', '?', ';', '!'].some(x => end === x)) { - id = id.slice(0, -1); - } else { - end = ''; + for (let i=0; i= 0) { + end = id.slice(index); + id = id.slice(0, index); + break; + } } try {