فهرست منبع

warning for empty string after trimming in inputValidator method

Shun Miyazawa 4 سال پیش
والد
کامیت
87391b64b1

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

@@ -973,7 +973,6 @@
   },
   "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 '/'"
   },
   "duplicated_page_alert" : {

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

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

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

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

+ 1 - 6
packages/app/src/components/Sidebar/PageTree/Item.tsx

@@ -197,11 +197,6 @@ const Item: FC<ItemProps> = (props: ItemProps) => {
   }, []);
 
   const onPressEnterForRenameHandler = async(inputText: string) => {
-    if (inputText === '') {
-      toastWarning(t('pagetree.this_title_cannot_be_renamed'));
-      return;
-    }
-
     if (inputText.includes('/')) {
       toastWarning(t('pagetree.cannot_rename_a_title_that_contains_slash'));
       return;
@@ -229,7 +224,7 @@ const Item: FC<ItemProps> = (props: ItemProps) => {
   };
 
   const inputValidator = (title: string | null): AlertInfo | null => {
-    if (title == null || title === '') {
+    if (title == null || title === '' || title.trim() === '') {
       return {
         type: AlertType.WARNING,
         message: t('form_validation.title_required'),