1
0
silverbullet/packages/plugs/markdown/markdown.ts
2022-06-28 14:14:15 +02:00

18 lines
611 B
TypeScript

import { hideRhs } from "@silverbulletmd/plugos-silverbullet-syscall/editor";
import { invokeFunction } from "@silverbulletmd/plugos-silverbullet-syscall/system";
import * as clientStore from "@silverbulletmd/plugos-silverbullet-syscall/clientStore";
export async function togglePreview() {
let currentValue = !!(await clientStore.get("enableMarkdownPreview"));
await clientStore.set("enableMarkdownPreview", !currentValue);
if (!currentValue) {
await invokeFunction("client", "preview");
} else {
await hideMarkdownPreview();
}
}
async function hideMarkdownPreview() {
await hideRhs();
}