mirror of
https://github.com/CharaChorder/DeviceManager.git
synced 2026-01-05 09:32:53 +00:00
Squash merge fix-vocabulary-export into master
This commit is contained in:
@@ -43,7 +43,7 @@
|
|||||||
buildIndex($chords, $osLayout).then(searchIndex.set);
|
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 plainPhrase: string[] = [""];
|
||||||
const extraActions: string[] = [];
|
const extraActions: string[] = [];
|
||||||
const extraCodes: string[] = [];
|
const extraCodes: string[] = [];
|
||||||
@@ -103,6 +103,10 @@
|
|||||||
return result ?? `0x${it.toString(16)}`;
|
return result ?? `0x${it.toString(16)}`;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (onlyPhrase) {
|
||||||
|
return plainPhrase.join();
|
||||||
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
...plainPhrase,
|
...plainPhrase,
|
||||||
`+${input.join("+")}`,
|
`+${input.join("+")}`,
|
||||||
@@ -182,7 +186,7 @@
|
|||||||
function downloadVocabulary() {
|
function downloadVocabulary() {
|
||||||
const vocabulary = new Set(
|
const vocabulary = new Set(
|
||||||
$chords.map((it) =>
|
$chords.map((it) =>
|
||||||
"phrase" in it ? plainPhrase(it.phrase, $osLayout).trim() : "",
|
"phrase" in it ? encodeChord(it, $osLayout, true).trim() : "",
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
vocabulary.delete("");
|
vocabulary.delete("");
|
||||||
|
|||||||
Reference in New Issue
Block a user