Просмотр исходного кода

annot be renamed to a title with only blank spaces

Shun Miyazawa 4 лет назад
Родитель
Сommit
52615ec21c

+ 1 - 0
packages/app/resource/locales/en_US/translation.json

@@ -973,6 +973,7 @@
   },
   },
   "pagetree": {
   "pagetree": {
     "private_legacy_pages": "Private Legacy Pages",
     "private_legacy_pages": "Private Legacy Pages",
+    "this_title_cannot_be_renamed": "This title cannot be renamed",
     "cannot_rename_a_title_that_contains_slash": "Cannot rename a title that contains '/'"
     "cannot_rename_a_title_that_contains_slash": "Cannot rename a title that contains '/'"
   },
   },
   "duplicated_page_alert" : {
   "duplicated_page_alert" : {

+ 1 - 0
packages/app/resource/locales/ja_JP/translation.json

@@ -966,6 +966,7 @@
   },
   },
   "pagetree": {
   "pagetree": {
     "private_legacy_pages": "待避所",
     "private_legacy_pages": "待避所",
+    "this_title_cannot_be_renamed": "このタイトルにはリネームできません",
     "cannot_rename_a_title_that_contains_slash": "`/` が含まれているタイトルにリネームできません"
     "cannot_rename_a_title_that_contains_slash": "`/` が含まれているタイトルにリネームできません"
   },
   },
   "duplicated_page_alert" : {
   "duplicated_page_alert" : {

+ 1 - 0
packages/app/resource/locales/zh_CN/translation.json

@@ -976,6 +976,7 @@
   },
   },
   "pagetree": {
   "pagetree": {
     "private_legacy_pages": "私人遗留页面",
     "private_legacy_pages": "私人遗留页面",
+    "this_title_cannot_be_renamed": "This title cannot be renamed",
     "cannot_rename_a_title_that_contains_slash": "不能重命名包含 ’/' 的标题"
     "cannot_rename_a_title_that_contains_slash": "不能重命名包含 ’/' 的标题"
   },
   },
   "duplicated_page_alert" : {
   "duplicated_page_alert" : {

+ 5 - 0
packages/app/src/components/Sidebar/PageTree/Item.tsx

@@ -197,6 +197,11 @@ const Item: FC<ItemProps> = (props: ItemProps) => {
   }, []);
   }, []);
 
 
   const onPressEnterForRenameHandler = async(inputText: string) => {
   const onPressEnterForRenameHandler = async(inputText: string) => {
+    if (inputText === '') {
+      toastWarning(t('pagetree.this_title_cannot_be_renamed'));
+      return;
+    }
+
     if (inputText.includes('/')) {
     if (inputText.includes('/')) {
       toastWarning(t('pagetree.cannot_rename_a_title_that_contains_slash'));
       toastWarning(t('pagetree.cannot_rename_a_title_that_contains_slash'));
       return;
       return;