kosei-n 2 лет назад
Родитель
Сommit
324a84e54d

+ 2 - 5
apps/app/src/components/PageHeader/PageTitleHeader.tsx

@@ -9,7 +9,6 @@ import { pathUtils } from '@growi/core/dist/utils';
 import { useTranslation } from 'next-i18next';
 
 import { ValidationTarget } from '~/client/util/input-validator';
-import { basePathname } from '~/server/routes/apiv3/page/create-page';
 
 import ClosableTextInput from '../Common/ClosableTextInput';
 import { CopyDropdown } from '../Common/CopyDropdown';
@@ -42,11 +41,9 @@ export const PageTitleHeader: FC<Props> = (props) => {
   const editedPageTitle = nodePath.basename(editedPagePath);
 
   // https://regex101.com/r/Wg2Hh6/1
-  // const untitledPageRegex = /^Untitled-\d+$/;
+  const untitledPageRegex = /^Untitled-\d+$/;
 
-  const untitledPageRegex = new RegExp(`/^${basePathname}-d+$/`);
-
-  const isNewlyCreatedPage = (currentPage.wip && currentPage.ttlTimestamp != null && untitledPageRegex.test(editedPageTitle)) ?? false;
+  const isNewlyCreatedPage = (currentPage.wip && currentPage.latestRevision == null && untitledPageRegex.test(editedPageTitle)) ?? false;
 
   const onRenameFinish = useCallback(() => {
     setRenameInputShown(false);

+ 2 - 3
apps/app/src/server/routes/apiv3/page/create-page.ts

@@ -42,10 +42,9 @@ async function generateUntitledPath(parentPath: string, basePathname: string, in
   return path;
 }
 
-// TODO: i18n
-export const basePathname = 'Untitled';
-
 async function determinePath(_parentPath?: string, _path?: string, optionalParentPath?: string): Promise<string> {
+  // TODO: i18n
+  const basePathname = 'Untitled';
 
   if (_path != null) {
     const path = normalizePath(_path);