bugfix: hide autocomplete on escape keyup (#2091)

This commit is contained in:
Max Bauer 2024-04-21 20:44:34 +02:00 committed by GitHub
parent 7a3cc4e040
commit eb9862b8f5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -232,7 +232,7 @@ export default class CodeEditor extends React.Component {
let curWord = start != end && currentLine.slice(start, end); let curWord = start != end && currentLine.slice(start, end);
//Qualify if autocomplete will be shown //Qualify if autocomplete will be shown
if ( if (
/^(?!Shift|Tab|Enter|ArrowUp|ArrowDown|ArrowLeft|ArrowRight|\s)\w*/.test(event.key) && /^(?!Shift|Tab|Enter|Escape|ArrowUp|ArrowDown|ArrowLeft|ArrowRight|\s)\w*/.test(event.key) &&
curWord.length > 0 && curWord.length > 0 &&
!/\/\/|\/\*|.*{{|`[^$]*{|`[^{]*$/.test(currentLine.slice(0, end)) && !/\/\/|\/\*|.*{{|`[^$]*{|`[^{]*$/.test(currentLine.slice(0, end)) &&
/(?<!\d)[a-zA-Z\._]$/.test(curWord) /(?<!\d)[a-zA-Z\._]$/.test(curWord)