Fix: correct typo and adjust indentation in docstring (#3920)

* fix: correct typo and adjust indentation in docstring

Fixed a small typo in the webview_did_inject_style_into_page docstring and adjusted indentation for consistency.

* Update CONTRIBUTORS
This commit is contained in:
babofitos 2025-04-13 03:00:19 -04:00 committed by GitHub
parent 9d167feb8f
commit 066f5fd281
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 19 additions and 18 deletions

View file

@ -220,6 +220,7 @@ Valerie Enfys <val@unidentified.systems>
Julien Chol <https://github.com/chel-ou>
ikkz <ylei.mk@gmail.com>
rreemmii-dev <https://github.com/rreemmii-dev>
babofitos <https://github.com/babofitos>
********************

View file

@ -778,24 +778,24 @@ hooks = [
name="webview_did_inject_style_into_page",
args=["webview: aqt.webview.AnkiWebView"],
doc='''Called after standard styling is injected into an external
html file, such as when loading the new graphs. You can use this hook to
mutate the DOM before the page is revealed.
For example:
def mytest(webview: AnkiWebView):
if webview.kind != AnkiWebViewKind.DECK_STATS:
return
web.eval(
"""
div = document.createElement("div");
div.innerHTML = 'hello';
document.body.appendChild(div);
"""
)
gui_hooks.webview_did_inject_style_into_page.append(mytest)
''',
html file, such as when loading the new graphs. You can use this hook to
mutate the DOM before the page is revealed.
For example:
def mytest(webview: AnkiWebView):
if webview.kind != AnkiWebViewKind.DECK_STATS:
return
webview.eval(
"""
div = document.createElement("div");
div.innerHTML = 'hello';
document.body.appendChild(div);
"""
)
gui_hooks.webview_did_inject_style_into_page.append(mytest)
''',
),
# Main
###################