From 7ca468d42f6abc937c0931ca9875737a0e908403 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Thu, 6 Mar 2025 18:48:40 +0530 Subject: [PATCH] fix: Actions panel --- .env | 2 +- src/lib/components/Actions.svelte | 64 +++++++++++++++---------------- 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/.env b/.env index c9bdfa82..d0a789a3 100644 --- a/.env +++ b/.env @@ -1,7 +1,7 @@ MERMAID_DOMAIN='' MERMAID_ANALYTICS_URL='' MERMAID_RENDERER_URL='https://mermaid.ink' -MERMAID_KROKI_RENDERER='https://kroki.io' +MERMAID_KROKI_RENDERER_URL='https://kroki.io' MERMAID_IS_ENABLED_MERMAID_CHART_LINKS='' # cp .env .env.local to make local changes diff --git a/src/lib/components/Actions.svelte b/src/lib/components/Actions.svelte index 979928f1..9400af16 100644 --- a/src/lib/components/Actions.svelte +++ b/src/lib/components/Actions.svelte @@ -9,6 +9,7 @@ import { version as FAVersion } from '@fortawesome/fontawesome-free/package.json'; import dayjs from 'dayjs'; import { toBase64 } from 'js-base64'; + import { Button } from './ui/Button'; const FONT_AWESOME_URL = `https://cdnjs.cloudflare.com/ajax/libs/font-awesome/${FAVersion}/css/all.min.css`; @@ -184,40 +185,28 @@ ${svgString}`); }); +{#snippet dualActionButton(text: string, download: (event: Event) => unknown, url?: string)} +
+ + {#if url} + + {/if} +
+{/snippet} +
{#if isClipboardAvailable()} - - {/if} - - - {#if rendererUrl} - - - - - - - {/if} - {#if krokiRendererUrl} - - - + {/if} -
+
PNG size
+ {@render dualActionButton('PNG', onDownloadPNG, iUrl)} + {@render dualActionButton('SVG', onDownloadSVG, svgUrl)} + + {#if krokiRendererUrl} + + + + {/if} + {#if rendererUrl}
{/if} @@ -261,7 +261,7 @@ ${svgString}`); bind:value={gistURL} placeholder="Enter Gist URL" />
{#if isNetlify}