kosei-n 2 лет назад
Родитель
Сommit
9a59262fb5
1 измененных файлов с 3 добавлено и 2 удалено
  1. 3 2
      apps/app/src/components/PageHeader/PageTitleHeader.tsx

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

@@ -37,8 +37,9 @@ export const PageTitleHeader: FC<Props> = (props) => {
   }, []);
 
   const onInputChange = useCallback((inputText: string) => {
+    const newPageTitle = pathUtils.removeHeadingSlash(inputText);
     const parentPagePath = pathUtils.addTrailingSlash(nodePath.dirname(currentPage.path));
-    const newPagePath = nodePath.resolve(parentPagePath, inputText);
+    const newPagePath = nodePath.resolve(parentPagePath, newPageTitle);
 
     setEditedPagePath(newPagePath);
   }, [currentPage?.path, setEditedPagePath]);
@@ -71,7 +72,7 @@ export const PageTitleHeader: FC<Props> = (props) => {
         {isRenameInputShown ? (
           <div className="flex-fill">
             <ClosableTextInput
-              value={pageTitle}
+              value={`/${pageTitle}`}
               placeholder={t('Input page name')}
               onPressEnter={onPressEnter}
               onPressEscape={onPressEscape}