🐛 fix(reactflowUtils.ts): prevent default behavior and stop propagation of keyboard event when pressing Ctrl + Backspace on input value that matches block or ends with a space character to improve user experience
This commit is contained in:
parent
75e25ad67f
commit
e2f0f2069e
1 changed files with 6 additions and 1 deletions
|
|
@ -235,7 +235,12 @@ export function addVersionToDuplicates(flow: FlowType, flows: FlowType[]) {
|
||||||
|
|
||||||
export function handleKeyDown(e: React.KeyboardEvent<HTMLInputElement>, inputValue: string | string[] | null, block: string)
|
export function handleKeyDown(e: React.KeyboardEvent<HTMLInputElement>, inputValue: string | string[] | null, block: string)
|
||||||
{
|
{
|
||||||
if (e.ctrlKey && inputValue === block && e.key === "Backspace") {
|
if (typeof inputValue === "string" && e.ctrlKey && e.key === "Backspace" && (inputValue === block || inputValue?.charAt(inputValue?.length - 1) === ' ')) {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (e.ctrlKey && e.key === "Backspace" && inputValue === block) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue