diff --git a/package.json b/package.json
index 7251579..061dddc 100644
--- a/package.json
+++ b/package.json
@@ -5,7 +5,7 @@
"icon": "./icon.svg"
},
"name": "logseq-mermaid-plugin",
- "version": "1.0.7",
+ "version": "1.0.8",
"description": "",
"main": "dist/index.html",
"targets": {
diff --git a/src/convert.ts b/src/convert.ts
index 9f25044..70f5358 100644
--- a/src/convert.ts
+++ b/src/convert.ts
@@ -19,32 +19,32 @@ export const renderMermaid = async (type, payload, colour, mermaidUUID) => {
);
};
- // const handleEvent = async (e) => {
- // if (e.currentTarget.response !== 'invalid encoded code') {
- if (colour === undefined) {
- renderBlock(``);
- } else if (colour.startsWith('#')) {
- renderBlock(
- `
`
- );
- } else if (!colour.startsWith('#')) {
- renderBlock(
- `
`
- );
- } else {
- renderBlock(`
`);
- }
- // } else {
- // renderBlock(
- // '
There is an error with your mermaid syntax. Please rectify and render again.
' - // ); - // } - // }; + const handleEvent = async () => { + if (colour === undefined) { + renderBlock(`There is an error with your mermaid syntax. Please rectify and render again.
' + ); + }; + + const image = new Image(); + image.onload = handleEvent; + image.onerror = handleError; + image.src = `https://mermaid.ink/img/${jsonString}`; };