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