feat: allow creation of single letter chords

resolves #84
This commit is contained in:
2024-04-06 16:52:18 +02:00
parent 91a044bbba
commit 5c8eb1d19f

View File

@@ -40,7 +40,7 @@
function keyup() {
if (!editing) return;
editing = false;
if (pressedKeys.size < 2) return;
if (pressedKeys.size < 1) return;
if (!chord) return dispatch("submit", [...pressedKeys].sort(compare));
changes.update((changes) => {
changes.push({
@@ -78,7 +78,9 @@
class:deleted={chord && chord.deleted}
class:edited={chord && chord.actionsChanged}
class:invalid={chord &&
chordActions?.some((it, i) => chordActions?.[i] !== it)}
chordActions &&
(chordActions.length < 2 ||
chordActions.some((it, i) => chordActions[i] !== it))}
class="chord"
on:click={edit}
on:keydown={keydown}