Skip to content

Commit

Permalink
fix: protyle
Browse files Browse the repository at this point in the history
  • Loading branch information
frostime committed Jun 28, 2023
1 parent 34e3646 commit ddca3e0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
9 changes: 5 additions & 4 deletions src/hello.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -15,7 +17,7 @@
fetchPost("/api/system/currentTime", {}, (response) => {
time = new Date(response.data).toString();
});
await initProtyle();
protyle = await initProtyle();
});
onDestroy(() => {
Expand All @@ -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>
Expand Down
8 changes: 7 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -234,6 +237,9 @@ export default class PluginSample extends Plugin {
});
new HelloExample({
target: dialog.element.querySelector("#helloPanel"),
props: {
app: this.app,
}
});
}

Expand Down

0 comments on commit ddca3e0

Please sign in to comment.