Inline editing

This commit is contained in:
2017-06-30 23:52:42 +02:00
parent df01fb891b
commit 633b5942f5
8 changed files with 78 additions and 26 deletions

View File

@ -265,13 +265,26 @@ export class AnimeNotifier {
}
onKeyDown(e: KeyboardEvent) {
let activeElement = document.activeElement
// Ignore hotkeys on input elements
switch(document.activeElement.tagName) {
switch(activeElement.tagName) {
case "INPUT":
case "TEXTAREA":
return
}
// Disallow Enter key in contenteditables
if(activeElement.getAttribute("contenteditable") === "true" && e.keyCode == 13) {
if("blur" in activeElement) {
activeElement["blur"]()
}
e.preventDefault()
e.stopPropagation()
return
}
// F = Search
if(e.keyCode == 70) {
let search = this.app.find("search") as HTMLInputElement
@ -281,6 +294,7 @@ export class AnimeNotifier {
e.preventDefault()
e.stopPropagation()
return
}
}
}