diff --git a/package.json b/package.json index 3d93aa1..dbea7a1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "logseq-dictionary", - "version": "0.0.1", + "version": "0.0.2", "type": "module", "main": "./dist/index.html", "license": "MIT", diff --git a/src/main.ts b/src/main.ts index 7d9735c..5e9b2e3 100644 --- a/src/main.ts +++ b/src/main.ts @@ -31,16 +31,25 @@ async function main() { if (result.message) { throw new Error("word not found"); } - const blocks = [ - { - content: "phonetic", - children: [ - { - content: result[0].phonetic, - }, - ], - }, - ].concat( + const firstAudio = result[0].phonetics.find((p: any) => p.audio); + const phonetic = firstAudio + ? { + content: "phonetic", + children: [ + { + content: `${firstAudio.text}\n`, + }, + ], + } + : { + content: "phonetic", + children: [ + { + content: result[0].phonetic, + }, + ], + }; + const blocks = [phonetic].concat( result[0].meanings.map((meaning: any) => { return { content: meaning.partOfSpeech,