mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
fix: Passed stylesheets are 'unloaded' after some time
This commit is contained in:
parent
2d6e2deb3d
commit
5f19bb8699
1 changed files with 19 additions and 5 deletions
|
|
@ -16,12 +16,26 @@ document.onreadystatechange = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
passThemes();
|
const iframe = document.getElementById('rliframe');
|
||||||
|
if (!iframe) return;
|
||||||
|
|
||||||
|
let firstLoad = true;
|
||||||
|
|
||||||
|
iframe.addEventListener('load', event => {
|
||||||
|
// repass theme styles when iframe is reloaded
|
||||||
|
if (!firstLoad) {
|
||||||
|
passThemes(event.target);
|
||||||
|
}
|
||||||
|
firstLoad = false;
|
||||||
|
});
|
||||||
|
|
||||||
|
passThemes(iframe);
|
||||||
|
|
||||||
|
// TODO: add initial stylesheets without primary colors to improve loading experience
|
||||||
});
|
});
|
||||||
|
|
||||||
// Pass nextcloud themes and theme attributes to SnappyMail.
|
// Pass nextcloud themes and theme attributes to SnappyMail.
|
||||||
function passThemes() {
|
function passThemes(iframe) {
|
||||||
const iframe = document.getElementById('rliframe');
|
|
||||||
if (!iframe) return;
|
if (!iframe) return;
|
||||||
|
|
||||||
const target = iframe.contentWindow.document;
|
const target = iframe.contentWindow.document;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue