Compare commits

...
Author SHA1 Message Date
Sidharth Vinod ace89a4f28 feat: Add renderer url config 2021-10-02 13:43:29 +05:30
Sidharth Vinod aadf4ec8dc feat: Add renderer url config 2021-10-02 13:39:07 +05:30
Sidharth Vinod ffdaaa3c5d Merge pull request #384 from Yash-Singh1/patch-1
Add actor support
2021-10-01 19:47:45 +05:30
Sidharth Vinod e4d4feaf65 Merge pull request #411 from mermaid-js/fix/build
Fix/build
2021-10-01 19:42:33 +05:30
Yash Singh bcad69e2d0 Add actor support on sequence diagram 2021-09-23 19:09:27 -07:00
5 changed files with 12 additions and 3 deletions
+5
View File
@@ -27,6 +27,11 @@ You can try out a live version [here](https://mermaid.live/).
docker run --publish 8000:80 ghcr.io/mermaid-js/mermaid-live-editor docker run --publish 8000:80 ghcr.io/mermaid-js/mermaid-live-editor
``` ```
### To configure renderer URL
When building, Set the Environment variable MERMAID_RENDERER_URL to the rendering service.
Default is `https://mermaid.ink`
### Development ### Development
```bash ```bash
+3 -2
View File
@@ -2,6 +2,7 @@
import { browser } from '$app/env'; import { browser } from '$app/env';
import Card from '$lib/components/card/card.svelte'; import Card from '$lib/components/card/card.svelte';
import { rendererUrl } from '$lib/util/env';
import { base64State, codeStore } from '$lib/util/state'; import { base64State, codeStore } from '$lib/util/state';
import { toBase64 } from 'js-base64'; import { toBase64 } from 'js-base64';
import moment from 'moment'; import moment from 'moment';
@@ -142,8 +143,8 @@
stateCopy.mermaid = JSON.parse(stateCopy.mermaid); stateCopy.mermaid = JSON.parse(stateCopy.mermaid);
} }
const b64Code = toBase64(JSON.stringify(stateCopy), true); const b64Code = toBase64(JSON.stringify(stateCopy), true);
iUrl = `https://mermaid.ink/img/${b64Code}`; iUrl = `${rendererUrl}/img/${b64Code}`;
svgUrl = `https://mermaid.ink/svg/${b64Code}`; svgUrl = `${rendererUrl}/svg/${b64Code}`;
mdCode = `[![](${iUrl})](${window.location.protocol}//${window.location.host}${window.location.pathname}#${encodedState})`; mdCode = `[![](${iUrl})](${window.location.protocol}//${window.location.host}${window.location.pathname}#${encodedState})`;
}); });
</script> </script>
+2 -1
View File
@@ -59,7 +59,8 @@ export const initEditor = (monacoEditor): void => {
'activate', 'activate',
'deactivate', 'deactivate',
'autonumber', 'autonumber',
'title' 'title',
'actor'
] ]
}, },
classDiagram: { classDiagram: {
+1
View File
@@ -0,0 +1 @@
export const rendererUrl = import.meta.env.MERMAID_RENDERER_URL ?? 'https://mermaid.ink';
+1
View File
@@ -24,6 +24,7 @@ const config = {
target: '#svelte', target: '#svelte',
trailingSlash: 'ignore', trailingSlash: 'ignore',
vite: { vite: {
envPrefix: 'MERMAID_',
optimizeDeps: { include: ['mermaid'] } optimizeDeps: { include: ['mermaid'] }
} }
} }