mirror of
https://github.com/ankitects/anki.git
synced 2025-09-21 07:22:23 -04:00
Explicitly execute code deactivating button focus from editor.py
This commit is contained in:
parent
cfc8e34cf0
commit
6262997599
2 changed files with 9 additions and 7 deletions
|
@ -294,6 +294,14 @@ function wrappedExceptForWhitespace(text: string, front: string, back: string):
|
||||||
return match[1] + front + match[2] + back + match[3];
|
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 {
|
function disableButtons(): void {
|
||||||
$("button.linkb:not(.perm)").prop("disabled", true);
|
$("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", () => {
|
window.addEventListener("resize", () => {
|
||||||
adjustFieldsTopMargin();
|
adjustFieldsTopMargin();
|
||||||
});
|
});
|
||||||
|
|
|
@ -222,6 +222,7 @@ class Editor:
|
||||||
js=["js/vendor/jquery.min.js", "js/editor.js"],
|
js=["js/vendor/jquery.min.js", "js/editor.js"],
|
||||||
context=self,
|
context=self,
|
||||||
)
|
)
|
||||||
|
self.web.eval("preventButtonFocus();")
|
||||||
|
|
||||||
# Top buttons
|
# Top buttons
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
Loading…
Reference in a new issue