buttons folder

This commit is contained in:
Jan Prochazka
2022-02-12 17:26:28 +01:00
parent 5a88423f62
commit e06b030707
74 changed files with 81 additions and 107 deletions

View File

@@ -0,0 +1,29 @@
<script context="module">
function getCommandTitle(command) {
let res = command.text;
if (command.keyText || command.keyTextFromGroup) res += ` (${command.keyText || command.keyTextFromGroup})`;
return res;
}
</script>
<script lang="ts">
import { commandsCustomized } from '../stores';
import ToolStripButton from './ToolStripButton.svelte';
export let command;
export let component = ToolStripButton;
$: cmd = Object.values($commandsCustomized).find((x: any) => x.id == command) as any;
</script>
{#if cmd}
<svelte:component
this={component}
title={getCommandTitle(cmd)}
icon={cmd.icon}
on:click={cmd.onClick}
disabled={!cmd.enabled}
>
{cmd.toolbarName || cmd.name}
</svelte:component>
{/if}