silverbullet/packages/plugs/markdown/markdown.ts

19 lines
643 B
TypeScript
Raw Normal View History

2022-04-25 17:24:13 +08:00
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";
2022-03-28 21:25:05 +08:00
2022-04-04 21:25:07 +08:00
export async function togglePreview() {
let currentValue = !!(await clientStore.get("enableMarkdownPreview"));
await clientStore.set("enableMarkdownPreview", !currentValue);
if (!currentValue) {
await invokeFunction("client", "preview");
// updateMarkdownPreview();
2022-04-04 21:25:07 +08:00
} else {
await hideMarkdownPreview();
2022-04-09 20:57:59 +08:00
}
2022-03-28 21:25:05 +08:00
}
2022-04-04 21:25:07 +08:00
async function hideMarkdownPreview() {
await hideRhs();
}