From f61df308ea72296a4da695a04efb413ebf50cf58 Mon Sep 17 00:00:00 2001 From: Bojan Mojsilovic Date: Tue, 6 Feb 2024 14:39:10 +0100 Subject: [PATCH] Allow only a single line break before embedded note --- src/components/ParsedNote/ParsedNote.tsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/components/ParsedNote/ParsedNote.tsx b/src/components/ParsedNote/ParsedNote.tsx index 19addfc..a9b53f8 100644 --- a/src/components/ParsedNote/ParsedNote.tsx +++ b/src/components/ParsedNote/ParsedNote.tsx @@ -326,6 +326,18 @@ const ParsedNote: Component<{ } if (isNoteMention(token)) { + if (lastSignificantContent === 'LB') { + const lastIndex = content.length - 1; + const lastGroup = content[lastIndex]; + + + setContent(lastIndex, () => ({ + type: lastGroup.type, + tokens: lastGroup.tokens.slice(0, Math.min(1, lastGroup.tokens.length)), + meta: lastGroup.meta, + })); + + } lastSignificantContent = 'notemention'; updateContent(content, 'notemention', token); return;