reiji-h пре 2 година
родитељ
комит
ca13bf27e2
1 измењених фајлова са 2 додато и 18 уклоњено
  1. 2 18
      apps/app/src/components/PageEditor/PageEditor.tsx

+ 2 - 18
apps/app/src/components/PageEditor/PageEditor.tsx

@@ -273,26 +273,10 @@ export const PageEditor = React.memo((props: Props): JSX.Element => {
     };
   }, [saveAndReturnToViewHandler]);
 
-
-  // TODO: https://redmine.weseek.co.jp/issues/142729
-  // https://regex101.com/r/Wg2Hh6/1
-  // initial caret line
-  useEffect(() => {
-    const untitledPageRegex = /^Untitled-\d+$/;
-    const isNewlyCreatedPage = (
-      currentPage?.wip && currentPage?.latestRevision == null && untitledPageRegex.test(nodePath.basename(currentPage?.path ?? ''))
-    ) ?? false;
-    if (!isNewlyCreatedPage) {
-      codeMirrorEditor?.setCaretLine();
-    }
-  }, [codeMirrorEditor, currentPage]);
-
   // set handler to focus
   useLayoutEffect(() => {
-    if (editorMode === EditorMode.Editor) {
-      codeMirrorEditor?.focus();
-    }
-  }, [codeMirrorEditor, editorMode]);
+    codeMirrorEditor?.focus();
+  }, [codeMirrorEditor, currentPage, editorMode]);
 
   // Detect indent size from contents (only when users are allowed to change it)
   useEffect(() => {