Update markdown plug, removing switch side because it's silly
This commit is contained in:
parent
7c0a03a272
commit
de254ac4f6
@ -14,7 +14,3 @@ functions:
|
||||
- editor:updated
|
||||
- editor:pageLoaded
|
||||
- editor:pageReloaded
|
||||
switchSide:
|
||||
path: "./preview.ts:switchSide"
|
||||
command:
|
||||
name: "Markdown Preview: Switch Side"
|
||||
|
@ -1,14 +1,14 @@
|
||||
import MarkdownIt from "markdown-it";
|
||||
import {
|
||||
getText,
|
||||
showLhs,
|
||||
showRhs,
|
||||
hideRhs,
|
||||
hideLhs,
|
||||
showPanel,
|
||||
} from "@silverbulletmd/plugos-silverbullet-syscall/editor";
|
||||
import * as clientStore from "@silverbulletmd/plugos-silverbullet-syscall/clientStore";
|
||||
import { cleanMarkdown } from "./util";
|
||||
import { readSettings, writeSettings } from "@silverbulletmd/plugs/lib/settings_page";
|
||||
import {
|
||||
readSettings,
|
||||
writeSettings,
|
||||
} from "@silverbulletmd/plugs/lib/settings_page";
|
||||
|
||||
const css = `
|
||||
<style>
|
||||
@ -80,27 +80,9 @@ export async function updateMarkdownPreview() {
|
||||
}
|
||||
let text = await getText();
|
||||
let cleanMd = await cleanMarkdown(text);
|
||||
const setting = await readSettings({previewOnRHS: true});
|
||||
const show = setting.previewOnRHS ? showRhs : showLhs;
|
||||
await show(
|
||||
`<html><head>${css}</head><body>${md.render(cleanMd)}</body></html>`,
|
||||
undefined,
|
||||
2
|
||||
await showPanel(
|
||||
"rhs",
|
||||
2,
|
||||
`<html><head>${css}</head><body>${md.render(cleanMd)}</body></html>`
|
||||
);
|
||||
}
|
||||
|
||||
export async function switchSide() {
|
||||
const {previewOnRHS} = await readSettings({previewOnRHS: true});
|
||||
const isVisible = await clientStore.get("enableMarkdownPreview");
|
||||
if (isVisible) {
|
||||
if (previewOnRHS){
|
||||
hideRhs();
|
||||
} else {
|
||||
hideLhs();
|
||||
}
|
||||
}
|
||||
await writeSettings({previewOnRHS: !previewOnRHS});
|
||||
if (isVisible) {
|
||||
updateMarkdownPreview();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user