diff --git a/src/frontend/src/utils/reactflowUtils.ts b/src/frontend/src/utils/reactflowUtils.ts index 6f18520c4..f26c42d83 100644 --- a/src/frontend/src/utils/reactflowUtils.ts +++ b/src/frontend/src/utils/reactflowUtils.ts @@ -236,9 +236,9 @@ export function addVersionToDuplicates(flow: FlowType, flows: FlowType[]) { export function handleKeyDown(e: React.KeyboardEvent, inputValue: string | string[] | null, block: string) { - console.log("check key: ", e); - if (typeof inputValue === "string" && e.ctrlKey && e.key === "Backspace" && + //condition to fix bug control+backspace on Windows/Linux + if (typeof inputValue === "string" && e.ctrlKey === true && e.key === "Backspace" && (inputValue === block || inputValue?.charAt(inputValue?.length - 1) === ' ' || specialCharsRegex.test(inputValue?.charAt(inputValue?.length - 1)) )) { @@ -246,7 +246,17 @@ export function handleKeyDown(e: React.KeyboardEvent, inputVal e.stopPropagation(); } - if (e.ctrlKey && e.key === "Backspace" && inputValue === block) { + //condition to fix bug control+backspace on Mac + if (typeof inputValue === "string" && e.metaKey === true && e.key === "Backspace" && + (inputValue === block || inputValue?.charAt(inputValue?.length - 1) === ' ' + || specialCharsRegex.test(inputValue?.charAt(inputValue?.length - 1)) + )) { + e.preventDefault(); + e.stopPropagation(); + } + + + if (e.ctrlKey === true && e.key === "Backspace" && inputValue === block) { e.preventDefault(); e.stopPropagation(); }