소스 검색

DataLinksInput - change the way enter key is handled (#18985)

Dominik Prokop 6 년 전
부모
커밋
c66a23ea31
1개의 변경된 파일5개의 추가작업 그리고 3개의 파일을 삭제
  1. 5 3
      packages/grafana-ui/src/components/DataLinks/DataLinkInput.tsx

+ 5 - 3
packages/grafana-ui/src/components/DataLinks/DataLinkInput.tsx

@@ -111,11 +111,13 @@ export const DataLinkInput: React.FC<DataLinkInputProps> = ({ value, onChange, s
       setShowingSuggestions(true);
     }
 
-    if (event.key === 'Backspace') {
+    if (event.key === 'Enter') {
+      // Preventing entering a new line
+      // As of https://github.com/ianstormtaylor/slate/issues/1345#issuecomment-340508289
+      return false;
+    } else {
       // @ts-ignore
       return;
-    } else {
-      return true;
     }
   };