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