WNomunomu 1 год назад
Родитель
Сommit
33992536dc
1 измененных файлов с 0 добавлено и 32 удалено
  1. 0 32
      apps/app/src/components/PageHeader/untitled-page-utils.ts

+ 0 - 32
apps/app/src/components/PageHeader/untitled-page-utils.ts

@@ -1,32 +0,0 @@
-import type { IPagePopulatedToShowRevision } from '@growi/core';
-import { AllLang } from '@growi/core';
-import { useTranslation } from 'next-i18next';
-
-
-export const useIsUntitledPage = (currentPage?: IPagePopulatedToShowRevision | null, editedPageTitle?: string): boolean => {
-
-  const { i18n } = useTranslation();
-
-  if (currentPage == null || editedPageTitle == null) {
-    return false;
-  }
-
-  const determineIsUntitledPageTitle = () => {
-    return AllLang.some((lng) => {
-      const untitledPageTitle = i18n.getFixedT(lng, 'translation')('create_page.untitled');
-
-      // https://regex101.com/r/Wg2Hh6/1
-      // https://regex101.com/r/E0X8b7/1
-      const untitledPageRegex = new RegExp(`^${untitledPageTitle}-\\d+$`);
-
-      return untitledPageRegex.test(editedPageTitle);
-    });
-  };
-
-  const isUntitledPageTitle = determineIsUntitledPageTitle();
-
-  const isNewlyCreatedPage = (currentPage.wip && currentPage.latestRevision == null && isUntitledPageTitle) ?? false;
-
-  return isNewlyCreatedPage;
-
-};