瀏覽代碼

add if editor

reiji-h 2 年之前
父節點
當前提交
a2a801e14a
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      apps/app/src/components/PageEditor/PageEditor.tsx

+ 3 - 1
apps/app/src/components/PageEditor/PageEditor.tsx

@@ -275,7 +275,9 @@ export const PageEditor = React.memo((props: Props): JSX.Element => {
 
   // set handler to focus
   useLayoutEffect(() => {
-    codeMirrorEditor?.focus();
+    if (editorMode === EditorMode.Editor) {
+      codeMirrorEditor?.focus();
+    }
   }, [codeMirrorEditor, currentPage, editorMode]);
 
   // Detect indent size from contents (only when users are allowed to change it)