Skip to content

Commit

Permalink
fix: revert the double thing
Browse files Browse the repository at this point in the history
  • Loading branch information
mary-ext committed Mar 1, 2024
1 parent 4a0cf49 commit 1ef76e8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/api/richtext/composer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ const enum CharCode {
const WS_RE = / +(?=\n)/g;
export const EOF_WS_RE = /\s+$| +(?=\n)/g;

const MENTION_RE = /[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*(?:\.[a-zA-Z]{2,})/y;
const HASHTAG_RE = /(?!\ufe0f|\u20e3)[\d]*[^ \n\d\p{P}]+[\d]*/uy;
const MENTION_RE = /[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*(?:\.[a-zA-Z]{2,})(@)?/y;
const HASHTAG_RE = /(?!\ufe0f|\u20e3)[\d]*[^ \n\d\p{P}]+[\d]*(#)?/uy;

const ESCAPE_SEGMENT: EscapeSegment = { type: 'escape', raw: '\\', text: '' };

Expand All @@ -117,7 +117,7 @@ export const parseRt = (source: string): PreliminaryRichText => {
MENTION_RE.lastIndex = idx + 1;
const match = MENTION_RE.exec(source);

if (!match) {
if (!match || match[1]) {
break jump;
}

Expand All @@ -132,7 +132,7 @@ export const parseRt = (source: string): PreliminaryRichText => {
HASHTAG_RE.lastIndex = idx + 1;
const match = HASHTAG_RE.exec(source);

if (!match) {
if (!match || match[1]) {
break jump;
}

Expand Down

0 comments on commit 1ef76e8

Please sign in to comment.