Fix arrow and delete keys being interpreted as keyboard shortcuts while editing object names
This commit is contained in:
parent
2d9ced4785
commit
dd2c108541
22
src/main.js
22
src/main.js
|
|
@ -2242,8 +2242,8 @@ window.addEventListener("keydown", (e) => {
|
||||||
// shortcut = shortcut.split("+")
|
// shortcut = shortcut.split("+")
|
||||||
// TODO
|
// TODO
|
||||||
// }
|
// }
|
||||||
if (e.target.contentEditable == "plaintext-only") {
|
if (e.target.tagName === "INPUT" || e.target.tagName === "TEXTAREA" || e.target.isContentEditable) {
|
||||||
return;
|
return; // Do nothing if the event target is an input field, textarea, or contenteditable element
|
||||||
}
|
}
|
||||||
console.log(e)
|
console.log(e)
|
||||||
let mod = macOS ? e.metaKey : e.ctrlKey;
|
let mod = macOS ? e.metaKey : e.ctrlKey;
|
||||||
|
|
@ -4311,6 +4311,17 @@ function updateInfopanel() {
|
||||||
setProperty(context, property, e.target.checked)
|
setProperty(context, property, e.target.checked)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case "text":
|
||||||
|
// Do nothing because this event fires for every character typed
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
input.addEventListener("blur", (e) => {
|
||||||
|
// Handle when the input field loses focus
|
||||||
|
console.log("Input lost focus");
|
||||||
|
// Your logic here
|
||||||
|
switch (prop.type) {
|
||||||
case "text":
|
case "text":
|
||||||
if (prop.value) {
|
if (prop.value) {
|
||||||
prop.value.set(e.target.value)
|
prop.value.set(e.target.value)
|
||||||
|
|
@ -4319,8 +4330,13 @@ function updateInfopanel() {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
})
|
input.addEventListener("keydown", (e) => {
|
||||||
|
if (e.key === "Enter") {
|
||||||
|
e.target.blur()
|
||||||
|
}
|
||||||
|
});
|
||||||
label.appendChild(span)
|
label.appendChild(span)
|
||||||
label.appendChild(input)
|
label.appendChild(input)
|
||||||
panel.appendChild(label)
|
panel.appendChild(label)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue