Allow only a single line break before embedded note

This commit is contained in:
Bojan Mojsilovic 2024-02-06 14:39:10 +01:00
parent 47a38df7e0
commit f61df308ea

View File

@ -326,6 +326,18 @@ const ParsedNote: Component<{
} }
if (isNoteMention(token)) { 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'; lastSignificantContent = 'notemention';
updateContent(content, 'notemention', token); updateContent(content, 'notemention', token);
return; return;