Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
sidharthv96 committed Jun 2, 2021
1 parent 93e4e53 commit c6d8848
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/lib/components/actions.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,11 @@
let userimagesize = 1080;
codeStore.subscribe((state: State) => {
state.mermaid = JSON.parse(state.mermaid);
const b64Code = toBase64(JSON.stringify(state), true);
const stateCopy = JSON.parse(JSON.stringify(state));
if (typeof stateCopy.mermaid === 'string') {
stateCopy.mermaid = JSON.parse(stateCopy.mermaid);
}
const b64Code = toBase64(JSON.stringify(stateCopy), true);
iUrl = `https://mermaid.ink/img/${b64Code}`;
svgUrl = `https://mermaid.ink/svg/${b64Code}`;
mdCode = `[![](${iUrl})](${window.location.protocol}//${window.location.host}${window.location.pathname}#${window.location.hash})`;
Expand Down
1 change: 1 addition & 0 deletions src/lib/components/view.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
mermaid.init(container);
mermaid.render('graph-div', code);
container.parentElement.parentElement.parentElement.scrollTop = scroll;
error = false;
} else if (manualUpdate) {
manualUpdate = false;
} else {
Expand Down

0 comments on commit c6d8848

Please sign in to comment.