Taichi Masuyama преди 3 години
родител
ревизия
efcd03ff47
променени са 2 файла, в които са добавени 9 реда и са изтрити 3 реда
  1. 5 0
      packages/app/src/components/PageEditor/CodeMirrorEditor.jsx
  2. 4 3
      packages/app/src/components/PageEditor/EmojiPickerHelper.ts

+ 5 - 0
packages/app/src/components/PageEditor/CodeMirrorEditor.jsx

@@ -660,6 +660,11 @@ class CodeMirrorEditor extends AbstractEditor {
       return;
     }
 
+    // Return not to reset emoji picker state when pressing : many times
+    if (char === ':') {
+      return;
+    }
+
     if (!this.isCharValidForShowingEmojiPicker(char)) {
       this.resetEmojiPickerState();
       return;

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

@@ -2,14 +2,15 @@ import { CSSProperties } from 'react';
 
 import i18n from 'i18next';
 
-// https://regex101.com/r/AXxJK3/1
-const EMOJI_PATTERN = new RegExp('^:[a-z0-9-_+]*');
+// https://regex101.com/r/Gqhor8/1
+// const EMOJI_PATTERN = new RegExp(/\B:[^:\s]+/);
+const EMOJI_PATTERN = ':';
 
 export default class EmojiPickerHelper {
 
   editor;
 
-  pattern: RegExp;
+  pattern: string;
 
   constructor(editor) {
     this.editor = editor;