Yuki Takei 3 лет назад
Родитель
Сommit
c750fc5844
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;
     }
   }