mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-29 11:02:28 +08:00
fix(client): loading app CSS no longer working
This commit is contained in:
parent
8a1f05cd26
commit
cad6417c4d
@ -62,7 +62,7 @@ function setupGlobs() {
|
||||
});
|
||||
|
||||
for (const appCssNoteId of glob.appCssNoteIds || []) {
|
||||
libraryLoader.requireCss(`api/notes/download/${appCssNoteId}`, false);
|
||||
requireCss(`api/notes/download/${appCssNoteId}`, false);
|
||||
}
|
||||
|
||||
utils.initHelpButtons($(window));
|
||||
@ -74,6 +74,18 @@ function setupGlobs() {
|
||||
});
|
||||
}
|
||||
|
||||
async function requireCss(url: string, prependAssetPath = true) {
|
||||
const cssLinks = Array.from(document.querySelectorAll("link")).map((el) => el.href);
|
||||
|
||||
if (!cssLinks.some((l) => l.endsWith(url))) {
|
||||
if (prependAssetPath) {
|
||||
url = `${window.glob.assetPath}/${url}`;
|
||||
}
|
||||
|
||||
$("head").append($('<link rel="stylesheet" type="text/css" />').attr("href", url));
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
setupGlobs
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user