Prechádzať zdrojové kódy

Merge branch 'support/apply-nextjs-2' into support/refactor-drawio-modal

Yuki Takei 3 rokov pred
rodič
commit
aa8178da19

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

@@ -16,24 +16,24 @@ export default class EmojiPickerHelper {
     this.editor = editor;
     this.editor = editor;
   }
   }
 
 
-    setStyle = ():  CSSProperties => {
-      const offset = 20;
-      const emojiPickerHeight = 420;
-      const cursorPos = this.editor.cursorCoords(true);
-      const editorPos = this.editor.getWrapperElement().getBoundingClientRect();
-      // Emoji Picker bottom position exceed editor's bottom position
-      if (cursorPos.bottom + emojiPickerHeight > editorPos.bottom) {
-        return {
-          top: editorPos.bottom - emojiPickerHeight,
-          left: cursorPos.left + offset,
-          position: 'fixed',
-        };
-      }
+  setStyle = (): CSSProperties => {
+    const offset = 20;
+    const emojiPickerHeight = 420;
+    const cursorPos = this.editor.cursorCoords(true);
+    const editorPos = this.editor.getWrapperElement().getBoundingClientRect();
+    // Emoji Picker bottom position exceed editor's bottom position
+    if (cursorPos.bottom + emojiPickerHeight > editorPos.bottom) {
       return {
       return {
-        top: cursorPos.top + offset,
+        top: editorPos.bottom - emojiPickerHeight,
         left: cursorPos.left + offset,
         left: cursorPos.left + offset,
         position: 'fixed',
         position: 'fixed',
       };
       };
+    }
+    return {
+      top: cursorPos.top + offset,
+      left: cursorPos.left + offset,
+      position: 'fixed',
+    };
   };
   };
 
 
   shouldModeTurnOn = (char: string): Position | null | undefined => {
   shouldModeTurnOn = (char: string): Position | null | undefined => {
@@ -46,21 +46,21 @@ export default class EmojiPickerHelper {
     if (sc.findPrevious()) {
     if (sc.findPrevious()) {
       return sc.pos.from;
       return sc.pos.from;
     }
     }
-  }
+  };
 
 
   shouldOpen = (startPos: Position): boolean => {
   shouldOpen = (startPos: Position): boolean => {
     const currentPos = this.editor.getCursor();
     const currentPos = this.editor.getCursor();
     const rangeStr = this.editor.getRange(startPos, currentPos);
     const rangeStr = this.editor.getRange(startPos, currentPos);
 
 
     return EMOJI_PATTERN.test(rangeStr);
     return EMOJI_PATTERN.test(rangeStr);
-  }
+  };
 
 
   getInitialSearchingText = (startPos: Position): void => {
   getInitialSearchingText = (startPos: Position): void => {
     const currentPos = this.editor.getCursor();
     const currentPos = this.editor.getCursor();
     const rangeStr = this.editor.getRange(startPos, currentPos);
     const rangeStr = this.editor.getRange(startPos, currentPos);
 
 
     return rangeStr.slice(1); // return without the heading ':'
     return rangeStr.slice(1); // return without the heading ':'
-  }
+  };
 
 
   addEmoji = (emoji: { colons: string }, startPosToReplace: Position|null): void => {
   addEmoji = (emoji: { colons: string }, startPosToReplace: Position|null): void => {
     const currentPos = this.editor.getCursor();
     const currentPos = this.editor.getCursor();