Skip to content

Commit

Permalink
fix: include quotes as punctuation
Browse files Browse the repository at this point in the history
  • Loading branch information
mary-ext committed Mar 1, 2024
1 parent 9d9ca79 commit f949393
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions app/api/richtext/composer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ const enum CharCode {
COMMA = 0x2c,
DOT = 0x2e,
SEMICOLON = 0x3b,
DQUOTE = 0x22,
SQUOTE = 0x27,

H = 0x68,
P = 0x70,
Expand Down Expand Up @@ -334,8 +336,14 @@ export const parseRt = (source: string): PreliminaryRichText => {
for (; end >= start; end--) {
const char = c(end - 1);

// If we encounter a dot, comma, or a semicolon, save it and continue
if (char === CharCode.DOT || char === CharCode.COMMA || char === CharCode.SEMICOLON) {
// If we encounter any of these punctuations, save it and continue
if (
char === CharCode.DOT ||
char === CharCode.COMMA ||
char === CharCode.SEMICOLON ||
char === CharCode.DQUOTE ||
char === CharCode.SQUOTE
) {
continue;
}

Expand Down

0 comments on commit f949393

Please sign in to comment.