2 Commits

Author SHA1 Message Date
kazuki
720c7d569d Merge 7c081f60b1 into 588719df91 2024-12-06 02:08:59 +00:00
kazuki kumo
7c081f60b1 fix: export only plain phrase 2024-12-06 11:08:36 +09:00

View File

@@ -43,7 +43,7 @@
buildIndex($chords, $osLayout).then(searchIndex.set);
});
function encodeChord(chord: ChordInfo, osLayout: Map<string, string>) {
function encodeChord(chord: ChordInfo, osLayout: Map<string, string>, onlyPhrase: boolean = false) {
const plainPhrase: string[] = [""];
const extraActions: string[] = [];
const extraCodes: string[] = [];
@@ -103,6 +103,10 @@
return result ?? `0x${it.toString(16)}`;
});
if (onlyPhrase) {
return plainPhrase.join();
}
return [
...plainPhrase,
`+${input.join("+")}`,
@@ -182,7 +186,7 @@
function downloadVocabulary() {
const vocabulary = new Set(
$chords.map((it) =>
"phrase" in it ? encodeChord(it, $osLayout).trim() : "",
"phrase" in it ? encodeChord(it, $osLayout, true).trim() : "",
),
);
vocabulary.delete("");