anki/web/webview.js

17 lines
420 B
JavaScript
Raw Normal View History

2017-08-01 09:04:55 +02:00
// prevent backspace key from going back a page
document.addEventListener("keydown", function (evt) {
if (evt.keyCode !== 8) {
return;
}
var isText = 0;
var nn = evt.target.nodeName;
if (nn === "INPUT" || nn === "TEXTAREA") {
isText = 1;
} else if (nn === "DIV" && evt.target.contentEditable) {
isText = 1;
}
if (!isText) {
evt.preventDefault();
}
});