feat: do not use empty phrase for deleted chords

This commit is contained in:
2023-12-16 15:20:44 +01:00
parent b679aa377a
commit 766bc44a85
5 changed files with 28 additions and 13 deletions

View File

@@ -13,7 +13,13 @@
function remove() {
changes.update(changes => {
changes.push({type: ChangeType.Chord, id: chord.id, actions: chord.actions, phrase: []})
changes.push({
type: ChangeType.Chord,
id: chord.id,
actions: chord.actions,
phrase: chord.phrase,
deleted: true,
})
return changes
})
}
@@ -60,9 +66,9 @@
<ChordPhraseEdit {chord} />
</td>
<td class="table-buttons">
{#if chord.phrase.length !== 0}
{#if !chord.deleted}
<button transition:slide class="icon compact" on:click={remove}>delete</button>
{:else if chord.phraseChanged}
{:else}
<button transition:slide class="icon compact" on:click={restore}>restore_from_trash</button>
{/if}
<button class="icon compact" class:disabled={chord.isApplied} on:click={restore}>undo</button>