app menu definition in JSON

This commit is contained in:
Jan Prochazka
2022-02-12 07:40:58 +01:00
parent 19a43b6fbc
commit 0c951b4659
9 changed files with 266 additions and 107 deletions

View File

@@ -1,25 +1,18 @@
<script lang="ts">
import getElectron from '../utility/getElectron';
import { openWebLink } from '../utility/exportElectronFile';
export let href = undefined;
export let onClick = undefined;
const electron = getElectron();
</script>
{#if onClick}
<a on:click={onClick}>
<slot />
</a>
{:else if electron}
<a on:click={() => electron.shell.openExternal(href)}>
<slot />
</a>
{:else}
<a {href} target="_blank" rel="noopener noreferrer">
<slot />
</a>
{/if}
<a
on:click={() => {
if (onClick) onClick();
else openWebLink(href);
}}
>
<slot />
</a>
<style>
a {