CtrlBackspace fixed on Macbook
This commit is contained in:
parent
d0cee2cc09
commit
f1f958a7ae
1 changed files with 10 additions and 19 deletions
|
|
@ -239,27 +239,18 @@ export function handleKeyDown(
|
||||||
inputValue: string | string[] | null,
|
inputValue: string | string[] | null,
|
||||||
block: string
|
block: string
|
||||||
) {
|
) {
|
||||||
|
console.log(e, inputValue, block);
|
||||||
//condition to fix bug control+backspace on Windows/Linux
|
//condition to fix bug control+backspace on Windows/Linux
|
||||||
if (
|
if (
|
||||||
typeof inputValue === "string" &&
|
(typeof inputValue === "string" &&
|
||||||
|
(e.metaKey === true || e.ctrlKey === true) &&
|
||||||
|
e.key === "Backspace" &&
|
||||||
|
(inputValue === block ||
|
||||||
|
inputValue?.charAt(inputValue?.length - 1) === " " ||
|
||||||
|
specialCharsRegex.test(inputValue?.charAt(inputValue?.length - 1)))) ||
|
||||||
|
(navigator.userAgent.toUpperCase().includes("MAC") &&
|
||||||
e.ctrlKey === true &&
|
e.ctrlKey === true &&
|
||||||
e.key === "Backspace" &&
|
e.key === "Backspace")
|
||||||
(inputValue === block ||
|
|
||||||
inputValue?.charAt(inputValue?.length - 1) === " " ||
|
|
||||||
specialCharsRegex.test(inputValue?.charAt(inputValue?.length - 1)))
|
|
||||||
) {
|
|
||||||
e.preventDefault();
|
|
||||||
e.stopPropagation();
|
|
||||||
}
|
|
||||||
|
|
||||||
//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.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue