Fix #1185 - add blacklistkeys setting

This commit is contained in:
Oliver Blanthorn 2019-05-27 18:57:36 +01:00
parent 233a94cd80
commit 7b6508a3e1
No known key found for this signature in database
GPG key ID: 2BB8C36BB504BFF3
2 changed files with 13 additions and 4 deletions

View file

@ -319,10 +319,14 @@ config.getAsync("modeindicator").then(mode => {
})
function protectSlash(e) {
if ("/".indexOf(e.key) !== -1 && contentState.mode === "normal") {
e.cancelBubble = true
e.stopImmediatePropagation()
}
config.get("blacklistkeys").map(
protkey => {
if (protkey.indexOf(e.key) !== -1 && contentState.mode === "normal") {
e.cancelBubble = true
e.stopImmediatePropagation()
}
}
)
}
// Some sites like to prevent firefox's `/` from working so we need to protect

View file

@ -309,6 +309,11 @@ class default_config {
*/
leavegithubalone: "true" | "false" = "false"
/**
* Which keys to protect from pages that try to override them. Requires [[leavegithubalone]] to be set to false.
*/
blacklistkeys: string[] = ["/"]
/**
* Autocommands that run when certain events happen, and other conditions are met.
*