diff --git a/.vscode/settings.json b/.vscode/settings.json
index b2a443e0..0076002f 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -47,5 +47,9 @@
"tailwindCSS.experimental.classRegex": [
["([\"'`][^\"'`]*.*?[\"'`])", "[\"'`]([^\"'`]*).*?[\"'`]"]
],
- "tailwindCSS.emmetCompletions": true
+ "tailwindCSS.emmetCompletions": true,
+ "editor.codeActionsOnSave": {
+ "source.fixAll.eslint": "explicit",
+ "source.organizeImports": "explicit"
+ }
}
diff --git a/src/lib/components/Actions.svelte b/src/lib/components/Actions.svelte
index 8c91ab5f..578c98c4 100644
--- a/src/lib/components/Actions.svelte
+++ b/src/lib/components/Actions.svelte
@@ -2,12 +2,13 @@
import Card from '$/components/Card/Card.svelte';
import CopyButton from '$/components/CopyButton.svelte';
import CopyInput from '$/components/CopyInput.svelte';
+ import ExternalLinkWrapper from '$/components/ExternalLinkWrapper.svelte';
import { Button } from '$/components/ui/button';
import { Input } from '$/components/ui/input';
import { Separator } from '$/components/ui/separator';
import * as ToggleGroup from '$/components/ui/toggle-group';
import { TID } from '$/constants';
- import { env } from '$/util/env';
+ import { getDomain } from '$/util/util';
import { browser } from '$app/environment';
import { waitForRender } from '$lib/util/autoSync';
import { inputStateStore, stateStore, urlsStore } from '$lib/util/state';
@@ -204,11 +205,11 @@ ${svgString}`);
{text}
- {#if url}
+
- {/if}
+
{/snippet}
@@ -235,22 +236,24 @@ ${svgString}`);
{@render dualActionButton('PNG', onDownloadPNG, $urlsStore.png)}
{@render dualActionButton('SVG', onDownloadSVG, $urlsStore.svg)}
- {#if env.krokiRendererUrl}
+
Kroki
- {/if}
+
{#if isClipboardAvailable()}
{/if}
- {#if $urlsStore.mdCode}
+
- {/if}
-
+
Load Gist
diff --git a/src/lib/components/ExternalLinkWrapper.svelte b/src/lib/components/ExternalLinkWrapper.svelte
new file mode 100644
index 00000000..be0c885c
--- /dev/null
+++ b/src/lib/components/ExternalLinkWrapper.svelte
@@ -0,0 +1,59 @@
+
+
+{#if isVisible}
+
+
+
+
+ {@render children()}
+
+
+
+
+ {#if shouldDisableComponent}
+
+ This diagram type is not supported in {domain}
+
+ {:else}
+
+
+ {labelPrefix}
+ {domain}
+
+ {/if}
+
+
+
+
+{/if}
diff --git a/src/lib/components/MainMenu.svelte b/src/lib/components/MainMenu.svelte
index b0f838a9..065590a1 100644
--- a/src/lib/components/MainMenu.svelte
+++ b/src/lib/components/MainMenu.svelte
@@ -29,16 +29,18 @@
href: $urlsStore.mermaidChart({ medium: 'main_menu' }).playground
},
{
- label: 'Plugins',
- icon: PluginIcon,
+ checkDiagramType: false,
href: $urlsStore.mermaidChart({ medium: 'main_menu' }).plugins,
- checkDiagramType: false
+ icon: PluginIcon,
+ label: 'Plugins',
+ sharesData: false
},
{
- label: 'MermaidChart',
- icon: MermaidChartIcon,
+ checkDiagramType: false,
href: $urlsStore.mermaidChart({ medium: 'main_menu' }).home,
- checkDiagramType: false
+ icon: MermaidChartIcon,
+ label: 'MermaidChart',
+ sharesData: false
}
]);
@@ -76,7 +78,11 @@
{#each mermaidChartMenuItems as item}
-
+
{@render menuItem({
...item,
class: 'text-accent bg-background hover:bg-muted'
diff --git a/src/lib/components/McWrapper.svelte b/src/lib/components/McWrapper.svelte
index 5fedf0b1..6dcd525a 100644
--- a/src/lib/components/McWrapper.svelte
+++ b/src/lib/components/McWrapper.svelte
@@ -1,50 +1,17 @@
-{#if env.isEnabledMermaidChartLinks}
-
-
-
-
- {@render children()}
-
-
-
-
- {#if shouldDisableComponent}
-
- This diagram type is not supported in MermaidChart.com
-
- {:else}
-
-
- {labelPrefix}
- MermaidChart.com
-
- {/if}
-
-
-
-
-{/if}
+
+ {@render children()}
+
diff --git a/src/lib/components/Navbar.svelte b/src/lib/components/Navbar.svelte
index f25d48e6..42e7c264 100644
--- a/src/lib/components/Navbar.svelte
+++ b/src/lib/components/Navbar.svelte
@@ -96,7 +96,7 @@
Live Editor
-
+
+ import ExternalLinkWrapper from '$/components/ExternalLinkWrapper.svelte';
import * as Dialog from '$/components/ui/dialog';
import ShieldIcon from '~icons/material-symbols/shield-lock-outline-rounded';
@@ -7,7 +8,7 @@
-
+
@@ -15,39 +16,30 @@
-
- The content of the diagrams you create never leaves your browser.
-
- It's only stored in the URL, and your browser's local storage.
+ Your diagrams never leave your browser.
+ They're only stored in the URL and your browser's local storage.
- Mermaid Live Editor is a fully open source, client side application, deployed transparently on
- GitHub Pages
- .
+ target="_blank">GitHub Pages
+ that works offline as a
+ Progressive Web App .
- It will also work as a fully offline
-
- Progressive Web App.
-
-
-
- The only server we have is a self hosted version of the open source and privacy friendly
- Plausible Analytics. We only collect anonymous data related to actions performed, like the
- type of diagram rendered, number of times a feature was used, etc.
-
-
- All the data we collect is anonymized and
-
- available publicly.
-
-
-
-
- Additional services like the external PNG/SVG/Kroki links and "Save to Mermaid Chart" feature
- will share your diagram with the respective 3rd party service.
+ We use self hosted, privacy-friendly Plausible Analytics to collect anonymous usage metadata
+ (diagram types, feature usage, etc.). All data is publicly available .
+
+
+ External services (PNG/SVG/Kroki exports, "Save to Mermaid Chart", "Repair with AI", etc)
+ will share your diagram with those 3rd parties, and are highlighted in the UI on hover.
+
+
diff --git a/src/lib/util/util.ts b/src/lib/util/util.ts
index 37a8b50c..a3702419 100644
--- a/src/lib/util/util.ts
+++ b/src/lib/util/util.ts
@@ -5,6 +5,12 @@ import { applyMigrations } from './migrations';
import { initURLSubscription, loadState, updateCodeStore, verifyState } from './state';
import { initAnalytics, plausible } from './stats';
+export const getDomain = (url?: string): string => {
+ if (!url) return '';
+ const domain = new URL(url).hostname;
+ return domain;
+};
+
export const loadStateFromURL = (): void => {
loadState(window.location.hash.slice(1));
};