Taichi Masuyama 4 лет назад
Родитель
Сommit
6a656a58b1
1 измененных файлов с 11 добавлено и 4 удалено
  1. 11 4
      packages/app/src/components/Sidebar/PageTree/ClosableTextInput.tsx

+ 11 - 4
packages/app/src/components/Sidebar/PageTree/ClosableTextInput.tsx

@@ -35,10 +35,7 @@ const ClosableTextInput: FC<ClosableTextInputProps> = memo((props: ClosableTextI
     setAlertInfo(alertInfo);
     setAlertInfo(alertInfo);
   };
   };
 
 
-  const onKeyDownHandler = (e) => {
-    if (e.key !== 'Enter') {
-      return;
-    }
+  const onPressEnter = () => {
     if (props.onPressEnter == null) {
     if (props.onPressEnter == null) {
       return;
       return;
     }
     }
@@ -46,6 +43,16 @@ const ClosableTextInput: FC<ClosableTextInputProps> = memo((props: ClosableTextI
     props.onPressEnter();
     props.onPressEnter();
   };
   };
 
 
+  const onKeyDownHandler = (e) => {
+    switch (e.key) {
+      case 'Enter':
+        onPressEnter();
+        break;
+      default:
+        break;
+    }
+  };
+
   /*
   /*
    * Hide when click outside the ref
    * Hide when click outside the ref
    */
    */