mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 06:52:21 -04:00
webview.ts
This commit is contained in:
parent
9b04a92df2
commit
f080616eed
2 changed files with 6 additions and 4 deletions
|
@ -2,15 +2,16 @@
|
|||
* License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html */
|
||||
|
||||
// prevent backspace key from going back a page
|
||||
document.addEventListener("keydown", function (evt) {
|
||||
document.addEventListener("keydown", function (evt: KeyboardEvent) {
|
||||
if (evt.keyCode !== 8) {
|
||||
return;
|
||||
}
|
||||
var isText = 0;
|
||||
var nn = evt.target.nodeName;
|
||||
let isText = 0;
|
||||
const node = evt.target as Element;
|
||||
const nn = node.nodeName;
|
||||
if (nn === "INPUT" || nn === "TEXTAREA") {
|
||||
isText = 1;
|
||||
} else if (nn === "DIV" && evt.target.contentEditable) {
|
||||
} else if (nn === "DIV" && (node as HTMLDivElement).contentEditable) {
|
||||
isText = 1;
|
||||
}
|
||||
if (!isText) {
|
1
web/.gitignore
vendored
Normal file
1
web/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
webview.js
|
Loading…
Reference in a new issue