Yuki Takei 3 년 전
부모
커밋
8d52067948
1개의 변경된 파일4개의 추가작업 그리고 4개의 파일을 삭제
  1. 4 4
      packages/app/src/components/PageEditor/EmojiPickerHelper.ts

+ 4 - 4
packages/app/src/components/PageEditor/EmojiPickerHelper.ts

@@ -3,8 +3,8 @@ import { CSSProperties } from 'react';
 import { Position } from 'codemirror';
 import i18n from 'i18next';
 
-// https://regex101.com/r/bMLnjG/1
-const EMOJI_PATTERN = new RegExp(/\B:[^:\s]+/);
+// https://regex101.com/r/x5LbOZ/1
+const EMOJI_PATTERN = new RegExp(/^:[a-z0-9-+_]+$/);
 
 export default class EmojiPickerHelper {
 
@@ -42,9 +42,9 @@ export default class EmojiPickerHelper {
     }
 
     const currentPos = this.editor.getCursor();
-    const sc = this.editor.getSearchCursor(':', currentPos, { multiline: false }).pos;
+    const sc = this.editor.getSearchCursor(':', currentPos, { multiline: false });
     if (sc.findPrevious()) {
-      return sc.pos;
+      return sc.pos.from;
     }
   }