Explicitly execute code deactivating button focus from editor.py

This commit is contained in:
Henrik Giesel 2021-01-20 17:01:16 +01:00
parent cfc8e34cf0
commit 6262997599
2 changed files with 9 additions and 7 deletions

View file

@ -294,6 +294,14 @@ function wrappedExceptForWhitespace(text: string, front: string, back: string):
return match[1] + front + match[2] + back + match[3];
}
function preventButtonFocus(): void {
for (const element of document.querySelectorAll("button.linkb")) {
element.addEventListener("mousedown", (evt: Event) => {
evt.preventDefault();
});
}
}
function disableButtons(): void {
$("button.linkb:not(.perm)").prop("disabled", true);
}
@ -619,13 +627,6 @@ document.addEventListener("click", (evt: MouseEvent): void => {
}
});
// prevent editor buttons from taking focus
for (const element of document.querySelectorAll("button.linkb")) {
element.addEventListener("mousedown", (evt: Event) => {
evt.preventDefault();
});
}
window.addEventListener("resize", () => {
adjustFieldsTopMargin();
});

View file

@ -222,6 +222,7 @@ class Editor:
js=["js/vendor/jquery.min.js", "js/editor.js"],
context=self,
)
self.web.eval("preventButtonFocus();")
# Top buttons
######################################################################