This commit is contained in:
Jan Prochazka
2022-02-17 15:41:42 +01:00
parent 83ab3cb012
commit 256f97ad42
4 changed files with 19 additions and 26 deletions

View File

@@ -0,0 +1,11 @@
<script lang="ts">
import _ from 'lodash';
import ToolStripCommandButton from './ToolStripCommandButton.svelte';
import ToolStripSplitDropDownButton from './ToolStripSplitDropDownButton.svelte';
export let commands;
$: menu = _.compact(commands).map(command => ({ command }));
</script>
<ToolStripCommandButton command={commands[0]} component={ToolStripSplitDropDownButton} {menu} />

View File

@@ -1,20 +1,12 @@
<script lang="ts">
import getElectron from '../utility/getElectron';
import ToolStripCommandButton from './ToolStripCommandButton.svelte';
import ToolStripSplitDropDownButton from './ToolStripSplitDropDownButton.svelte';
import ToolStripCommandSplitButton from './ToolStripCommandSplitButton.svelte';
export let idPrefix;
const electron = getElectron();
</script>
<ToolStripCommandButton
command={`${idPrefix}.save`}
component={ToolStripSplitDropDownButton}
menu={[
{ command: `${idPrefix}.save` },
{ command: `${idPrefix}.saveAs` },
electron && { command: `${idPrefix}.saveToDisk` },
]}
<ToolStripCommandSplitButton
commands={[`${idPrefix}.save`, `${idPrefix}.saveAs`, electron && `${idPrefix}.saveToDisk`]}
/>