Explorar o código

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

Dominik Prokop %!s(int64=6) %!d(string=hai) anos
pai
achega
c66a23ea31

+ 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;
     }
   };