summaryrefslogtreecommitdiff
path: root/ext/js/data/anki-note-data-creator.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-06-26 11:57:09 -0400
committerGitHub <noreply@github.com>2021-06-26 11:57:09 -0400
commit6e0a367afcae07ae6f8274c7310950af613b4bf0 (patch)
tree4cc45dd6b2f3b53aeaf1c9eb95db774aabcad5b2 /ext/js/data/anki-note-data-creator.js
parent5756885fa9340f087a168d40c8d0d10a3a8fe4d5 (diff)
Translator data format updates (#1754)
* Add {dictionaryIndex, dictionaryPriority} to definitions * Add score to definitions * Add id to definition * Use definition id instead of ids array * Remove ids array * Update docs * Update test data
Diffstat (limited to 'ext/js/data/anki-note-data-creator.js')
-rw-r--r--ext/js/data/anki-note-data-creator.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/js/data/anki-note-data-creator.js b/ext/js/data/anki-note-data-creator.js
index c76369c3..6a6bfd36 100644
--- a/ext/js/data/anki-note-data-creator.js
+++ b/ext/js/data/anki-note-data-creator.js
@@ -274,7 +274,7 @@ class AnkiNoteDataCreator {
case 'merge': type = 'termMerged'; break;
}
- const {ids, inflections, score, dictionaryIndex, dictionaryPriority, sourceTermExactMatchCount} = dictionaryEntry;
+ const {inflections, score, dictionaryIndex, dictionaryPriority, sourceTermExactMatchCount, definitions} = dictionaryEntry;
const {
screenshotFileName=null,
@@ -301,7 +301,7 @@ class AnkiNoteDataCreator {
return {
type,
- id: (type === 'term' ? ids[0] : void 0),
+ id: (type === 'term' && definitions.length > 0 ? definitions[0].id : void 0),
source: (primarySource !== null ? primarySource.transformedText : null),
rawSource: (primarySource !== null ? primarySource.originalText : null),
sourceTerm: (type !== 'termMerged' ? (primarySource !== null ? primarySource.deinflectedText : null) : void 0),