webview.ts

This commit is contained in:
Damien Elmes 2019-12-18 13:02:11 +10:00
parent 9b04a92df2
commit f080616eed
2 changed files with 6 additions and 4 deletions

View file

@ -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
View file

@ -0,0 +1 @@
webview.js