Browse Source

add if editor

reiji-h 1 year ago
parent
commit
a2a801e14a
1 changed files with 3 additions and 1 deletions
  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)