fix: chord actions not sorted

This commit is contained in:
2023-11-18 15:53:07 +01:00
parent 683561dc06
commit e84470d577
3 changed files with 10 additions and 3 deletions

View File

View File

@@ -29,12 +29,16 @@
if (!editing) return
editing = false
if (pressedKeys.size < 2) return
if (!chord) return dispatch("submit", [...pressedKeys].sort())
if (!chord)
return dispatch(
"submit",
[...pressedKeys].sort((a, b) => a - b),
)
changes.update(changes => {
changes.push({
type: ChangeType.Chord,
id: chord!.id,
actions: [...pressedKeys].sort(),
actions: [...pressedKeys].sort((a, b) => a - b),
phrase: chord!.phrase,
})
return changes
@@ -54,7 +58,10 @@
{:else if !editing && !chord}
<span>{$LL.configure.chords.NEW_CHORD()}</span>
{/if}
<ActionString display="keys" actions={editing ? [...pressedKeys].sort() : chord?.actions ?? []} />
<ActionString
display="keys"
actions={editing ? [...pressedKeys].sort((a, b) => a - b) : chord?.actions ?? []}
/>
<sup></sup>
</button>

View File