2022-10-14 13:11:33 +00:00
|
|
|
import { clientStore, editor } from "$sb/silverbullet-syscall/mod.ts";
|
2022-09-16 12:26:47 +00:00
|
|
|
|
2022-12-16 11:44:04 +00:00
|
|
|
// Run on "editor:init"
|
|
|
|
export async function setEditorMode() {
|
|
|
|
if (await clientStore.get("vimMode")) {
|
2022-12-21 13:55:24 +00:00
|
|
|
await editor.setUiOption("vimMode", true);
|
|
|
|
}
|
|
|
|
if (await clientStore.get("darkMode")) {
|
|
|
|
await editor.setUiOption("darkMode", true);
|
2022-12-16 11:44:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-21 13:55:24 +00:00
|
|
|
export async function toggleDarkMode() {
|
|
|
|
let darkMode = await clientStore.get("darkMode");
|
|
|
|
darkMode = !darkMode;
|
|
|
|
await editor.setUiOption("darkMode", darkMode);
|
|
|
|
await clientStore.set("darkMode", darkMode);
|
|
|
|
}
|