Jelajahi Sumber

Fixed emoji picker

Taichi Masuyama 3 tahun lalu
induk
melakukan
efcd03ff47

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

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

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

@@ -2,14 +2,15 @@ import { CSSProperties } from 'react';
 
 
 import i18n from 'i18next';
 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 {
 export default class EmojiPickerHelper {
 
 
   editor;
   editor;
 
 
-  pattern: RegExp;
+  pattern: string;
 
 
   constructor(editor) {
   constructor(editor) {
     this.editor = editor;
     this.editor = editor;