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 {
|
&--browser {
|
||||||
padding-left: env(titlebar-area-x, 0);
|
padding-left: env(titlebar-area-x, 0);
|
||||||
padding-right: calc(100% - env(titlebar-area-width, 100%) - 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 {
|
#windowControls {
|
||||||
|
|
|
||||||
|
|
@ -37,9 +37,7 @@ export class App {
|
||||||
public appId: string;
|
public appId: string;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
/// #if BROWSER
|
|
||||||
registerServiceWorker(`${Constants.SERVICE_WORKER_PATH}?v=${Constants.SIYUAN_VERSION}`);
|
registerServiceWorker(`${Constants.SERVICE_WORKER_PATH}?v=${Constants.SIYUAN_VERSION}`);
|
||||||
/// #endif
|
|
||||||
addBaseURL();
|
addBaseURL();
|
||||||
|
|
||||||
this.appId = Constants.SIYUAN_APPID;
|
this.appId = Constants.SIYUAN_APPID;
|
||||||
|
|
|
||||||
|
|
@ -34,9 +34,7 @@ class App {
|
||||||
public appId: string;
|
public appId: string;
|
||||||
|
|
||||||
constructor() {
|
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();
|
addBaseURL();
|
||||||
this.appId = Constants.SIYUAN_APPID;
|
this.appId = Constants.SIYUAN_APPID;
|
||||||
window.siyuan = {
|
window.siyuan = {
|
||||||
|
|
|
||||||
|
|
@ -78,6 +78,13 @@ export const loadAssets = (data: Config.IAppearance) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
/// #endif
|
/// #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();
|
setCodeTheme();
|
||||||
|
|
||||||
const themeScriptElement = document.getElementById("themeScript");
|
const themeScriptElement = document.getElementById("themeScript");
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,9 @@ export const registerServiceWorker = (
|
||||||
updateViaCache: "all",
|
updateViaCache: "all",
|
||||||
},
|
},
|
||||||
) => {
|
) => {
|
||||||
|
/// #if BROWSER
|
||||||
if (!("serviceWorker" in window.navigator)
|
if (window.webkit?.messageHandlers || window.JSAndroid || window.JSHarmony ||
|
||||||
|
!("serviceWorker" in window.navigator)
|
||||||
|| !("caches" in window)
|
|| !("caches" in window)
|
||||||
|| !("fetch" in window)
|
|| !("fetch" in window)
|
||||||
|| navigator.serviceWorker == null
|
|| navigator.serviceWorker == null
|
||||||
|
|
@ -22,6 +23,7 @@ export const registerServiceWorker = (
|
||||||
.then(registration => {
|
.then(registration => {
|
||||||
registration.update();
|
registration.update();
|
||||||
}).catch(e => {
|
}).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