fix: protyle

This commit is contained in:
frostime 2023-06-28 21:28:38 +08:00
parent 34e3646add
commit ddca3e0e24
2 changed files with 12 additions and 5 deletions

View file

@ -3,6 +3,8 @@
import { version, sql as query } from "@/api";
import { showMessage, fetchPost, Protyle } from "siyuan";
export let app;
let time: string = "";
let ver: string;
@ -15,7 +17,7 @@
fetchPost("/api/system/currentTime", {}, (response) => {
time = new Date(response.data).toString();
});
await initProtyle();
protyle = await initProtyle();
});
onDestroy(() => {
@ -27,9 +29,8 @@
let sql = "SELECT * FROM blocks ORDER BY RANDOM () LIMIT 1;";
let blocks: Block[] = await query(sql);
blockID = blocks[0].id;
protyle = new Protyle(this.app, divProtyle, {
blockId: blockID,
mode: "preview"
return new Protyle(app, divProtyle, {
blockId: blockID
});
}
</script>

View file

@ -83,7 +83,10 @@ export default class PluginSample extends Plugin {
let tabDiv = document.createElement("div");
new HelloExample({
target: tabDiv
target: tabDiv,
props: {
app: this.app,
}
});
this.customTab = this.addTab({
type: TAB_TYPE,
@ -234,6 +237,9 @@ export default class PluginSample extends Plugin {
});
new HelloExample({
target: dialog.element.querySelector("#helloPanel"),
props: {
app: this.app,
}
});
}