1
0
silverbullet/plugs/core/editor.ts
Zef Hemel 561aa6891f
Migrate to Deno (#86)
Big bang migration to Deno 🤯
2022-10-10 14:50:21 +02:00

17 lines
564 B
TypeScript

import * as clientStore from "../../syscall/silverbullet-syscall/clientStore.ts";
import { enableReadOnlyMode } from "../../syscall/silverbullet-syscall/editor.ts";
export async function editorLoad() {
let readOnlyMode = await clientStore.get("readOnlyMode");
if (readOnlyMode) {
await enableReadOnlyMode(true);
}
}
export async function toggleReadOnlyMode() {
let readOnlyMode = await clientStore.get("readOnlyMode");
readOnlyMode = !readOnlyMode;
await enableReadOnlyMode(readOnlyMode);
await clientStore.set("readOnlyMode", readOnlyMode);
}