mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 15:02: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 */
|
* License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html */
|
||||||
|
|
||||||
// prevent backspace key from going back a page
|
// prevent backspace key from going back a page
|
||||||
document.addEventListener("keydown", function (evt) {
|
document.addEventListener("keydown", function (evt: KeyboardEvent) {
|
||||||
if (evt.keyCode !== 8) {
|
if (evt.keyCode !== 8) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var isText = 0;
|
let isText = 0;
|
||||||
var nn = evt.target.nodeName;
|
const node = evt.target as Element;
|
||||||
|
const nn = node.nodeName;
|
||||||
if (nn === "INPUT" || nn === "TEXTAREA") {
|
if (nn === "INPUT" || nn === "TEXTAREA") {
|
||||||
isText = 1;
|
isText = 1;
|
||||||
} else if (nn === "DIV" && evt.target.contentEditable) {
|
} else if (nn === "DIV" && (node as HTMLDivElement).contentEditable) {
|
||||||
isText = 1;
|
isText = 1;
|
||||||
}
|
}
|
||||||
if (!isText) {
|
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