Further iteration

This commit is contained in:
Zef Hemel
2023-08-30 17:25:54 +02:00
parent cbc00b73a0
commit 75da8e7ca9
18 changed files with 128 additions and 147 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
import { safeRun } from "../common/util.ts";
import { Client } from "./client.ts";
const syncMode = window.silverBulletConfig.supportOnlineMode !== "true" ||
const syncMode = window.silverBulletConfig.syncOnly ||
!!localStorage.getItem("syncMode");
safeRun(async () => {
+1 -1
View File
@@ -52,7 +52,7 @@ declare global {
// Injected via index.html
silverBulletConfig: {
spaceFolderPath: string;
supportOnlineMode: string;
syncOnly: boolean;
};
client: Client;
}
+1 -3
View File
@@ -46,8 +46,6 @@ export function TopBar({
lhs?: ComponentChildren;
rhs?: ComponentChildren;
}) {
const inputRef = useRef<HTMLInputElement>(null);
// Another one of my less proud moments:
// Somehow I cannot seem to proerply limit the width of the page name, so I'm doing
// it this way. If you have a better way to do this, please let me know!
@@ -66,7 +64,7 @@ export function TopBar({
// Then calculate a new width
currentPageElement.style.width = `${
Math.min(editorWidth - 150, innerDiv.clientWidth - 150)
Math.min(editorWidth - 170, innerDiv.clientWidth - 170)
}px`;
}
}
+2 -1
View File
@@ -204,7 +204,8 @@ export class MainUI {
editor.focus();
}}
actionButtons={[
...window.silverBulletConfig.supportOnlineMode === "true"
...!window.silverBulletConfig.syncOnly
// If we support syncOnly, don't show this toggle button
? [{
icon: RefreshCwIcon,
description: this.editor.syncMode
+3 -3
View File
@@ -35,13 +35,13 @@
window.silverBulletConfig = {
// These {{VARIABLES}} are replaced by http_server.ts
spaceFolderPath: "{{SPACE_PATH}}",
supportOnlineMode: "{{SUPPORT_ONLINE_MODE}}",
syncOnly: "{{SYNC_ONLY}}" === "true",
};
// But in case these variables aren't replaced by the server, fall back fully static mode (no sync)
// But in case these variables aren't replaced by the server, fall back sync only mode
if (window.silverBulletConfig.spaceFolderPath.includes("{{")) {
window.silverBulletConfig = {
spaceFolderPath: "",
supportOnlineMode: false,
syncOnly: true,
};
}
</script>
+3 -1
View File
@@ -121,7 +121,9 @@ body {
display: inline-block;
position: relative;
top: -6px;
padding-right: 6px;
padding: 4px;
background-color: var(--top-background-color);
margin-right: -2px;
}
.progress-bar {