Load page script after body created (#1802)

document.body must exist by the time the top level Svelte component
initializes.

https://forums.ankiweb.net/t/2-1-50-editor-wont-show-when-addons-load-many-js-files/19036
This commit is contained in:
Damien Elmes 2022-04-19 17:16:56 +10:00 committed by GitHub
parent a7cb5e210e
commit adbe96ca00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View File

@ -499,7 +499,7 @@ html {{ {font} }}
from aqt import mw
head = mw.baseHTML() + csstxt + jstxt + web_content.head
head = mw.baseHTML() + csstxt + web_content.head
body_class = theme_manager.body_class()
if theme_manager.night_mode:
@ -520,7 +520,9 @@ html {{ {font} }}
{head}
</head>
<body class="{body_class}">{web_content.body}</body>
<body class="{body_class}">
{jstxt}
{web_content.body}</body>
</html>"""
# print(html)
self.setHtml(html)

View File

@ -4,7 +4,7 @@
<meta charset="utf-8" />
<meta name="viewport" id="viewport" content="width=device-width" />
<link href="{PAGE}.css" rel="stylesheet" />
<script src="{PAGE}.js"></script>
<script src="{PAGE}.js" defer></script>
</head>
<body></body>
</html>