mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 17:10:12 +01:00
This commit is contained in:
parent
25054e137c
commit
5143121ac4
5 changed files with 15 additions and 10 deletions
|
|
@ -106,7 +106,7 @@ html {
|
|||
&--browser {
|
||||
padding-left: env(titlebar-area-x, 0);
|
||||
padding-right: calc(100% - env(titlebar-area-width, 100%) - env(titlebar-area-x, 0));
|
||||
height: env(titlebar-area-height, 32px);
|
||||
height: calc(env(titlebar-area-height, 31px) + 1px);
|
||||
}
|
||||
|
||||
#windowControls {
|
||||
|
|
|
|||
|
|
@ -37,9 +37,7 @@ export class App {
|
|||
public appId: string;
|
||||
|
||||
constructor() {
|
||||
/// #if BROWSER
|
||||
registerServiceWorker(`${Constants.SERVICE_WORKER_PATH}?v=${Constants.SIYUAN_VERSION}`);
|
||||
/// #endif
|
||||
addBaseURL();
|
||||
|
||||
this.appId = Constants.SIYUAN_APPID;
|
||||
|
|
|
|||
|
|
@ -34,9 +34,7 @@ class App {
|
|||
public appId: string;
|
||||
|
||||
constructor() {
|
||||
if (!window.webkit?.messageHandlers && !window.JSAndroid && !window.JSHarmony) {
|
||||
registerServiceWorker(`${Constants.SERVICE_WORKER_PATH}?v=${Constants.SIYUAN_VERSION}`);
|
||||
}
|
||||
registerServiceWorker(`${Constants.SERVICE_WORKER_PATH}?v=${Constants.SIYUAN_VERSION}`);
|
||||
addBaseURL();
|
||||
this.appId = Constants.SIYUAN_APPID;
|
||||
window.siyuan = {
|
||||
|
|
|
|||
|
|
@ -78,6 +78,13 @@ export const loadAssets = (data: Config.IAppearance) => {
|
|||
}
|
||||
});
|
||||
/// #endif
|
||||
|
||||
/// #if BROWSER
|
||||
if (!window.webkit?.messageHandlers && !window.JSAndroid && !window.JSHarmony &&
|
||||
("serviceWorker" in window.navigator) && ("caches" in window) && ("fetch" in window) && navigator.serviceWorker) {
|
||||
document.head.insertAdjacentHTML("afterbegin", `<meta name="theme-color" content="${getComputedStyle(document.body).getPropertyValue("--b3-toolbar-background").trim()}">`)
|
||||
}
|
||||
/// #endif
|
||||
setCodeTheme();
|
||||
|
||||
const themeScriptElement = document.getElementById("themeScript");
|
||||
|
|
|
|||
|
|
@ -7,8 +7,9 @@ export const registerServiceWorker = (
|
|||
updateViaCache: "all",
|
||||
},
|
||||
) => {
|
||||
|
||||
if (!("serviceWorker" in window.navigator)
|
||||
/// #if BROWSER
|
||||
if (window.webkit?.messageHandlers || window.JSAndroid || window.JSHarmony ||
|
||||
!("serviceWorker" in window.navigator)
|
||||
|| !("caches" in window)
|
||||
|| !("fetch" in window)
|
||||
|| navigator.serviceWorker == null
|
||||
|
|
@ -22,6 +23,7 @@ export const registerServiceWorker = (
|
|||
.then(registration => {
|
||||
registration.update();
|
||||
}).catch(e => {
|
||||
console.debug(`Registration failed with ${e}`);
|
||||
});
|
||||
console.debug(`Registration failed with ${e}`);
|
||||
});
|
||||
/// #endif
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue