1
0
silverbullet/plugs/core/editor.ts
2023-01-23 18:52:17 +01:00

19 lines
543 B
TypeScript

import { clientStore, editor } from "$sb/silverbullet-syscall/mod.ts";
// Run on "editor:init"
export async function setEditorMode() {
if (await clientStore.get("vimMode")) {
await editor.setUiOption("vimMode", true);
}
if (await clientStore.get("darkMode")) {
await editor.setUiOption("darkMode", true);
}
}
export async function toggleDarkMode() {
let darkMode = await clientStore.get("darkMode");
darkMode = !darkMode;
await editor.setUiOption("darkMode", darkMode);
await clientStore.set("darkMode", darkMode);
}