2022-04-13 12:46:52 +00:00
|
|
|
import { hideRhs } from "plugos-silverbullet-syscall/editor";
|
|
|
|
import { invokeFunction } from "plugos-silverbullet-syscall/system";
|
2022-04-04 13:25:07 +00:00
|
|
|
import * as clientStore from "plugos-silverbullet-syscall/clientStore";
|
2022-03-28 13:25:05 +00:00
|
|
|
|
2022-04-04 13:25:07 +00:00
|
|
|
export async function togglePreview() {
|
|
|
|
let currentValue = !!(await clientStore.get("enableMarkdownPreview"));
|
|
|
|
await clientStore.set("enableMarkdownPreview", !currentValue);
|
|
|
|
if (!currentValue) {
|
2022-04-13 12:46:52 +00:00
|
|
|
await invokeFunction("client", "preview");
|
|
|
|
// updateMarkdownPreview();
|
2022-04-04 13:25:07 +00:00
|
|
|
} else {
|
2022-04-13 12:46:52 +00:00
|
|
|
await hideMarkdownPreview();
|
2022-04-09 12:57:59 +00:00
|
|
|
}
|
2022-03-28 13:25:05 +00:00
|
|
|
}
|
2022-04-04 13:25:07 +00:00
|
|
|
|
|
|
|
async function hideMarkdownPreview() {
|
|
|
|
await hideRhs();
|
|
|
|
}
|