diff options
author | Kuuuube <61125188+Kuuuube@users.noreply.github.com> | 2024-05-11 23:03:27 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-12 03:03:27 +0000 |
commit | 486eec15b817d6a87ad98245dea3534545286334 (patch) | |
tree | a5376ab50b4770842915c7338401cb1b2a9e4636 /ext/js/comm/anki-connect.js | |
parent | 9b28e8ecf84027c4b52a015b389c6c1730732ce0 (diff) |
Add option to bulk generate anki cards (#895)
* Add option to bulk generate anki cards
* Fix tab replacement
* Set deckname and modelname in note builder
* Add addNotes to ankiconnect api implementation
* Add option to send word list to anki directly
* Add support for audio and media toggle
* Add support for dictionary media
* Remove unnecessary assignment
* Remove unused css
* Remove redundant html
* Start of progress bar implementation
* Remove redundant type annotation
* Remove unused import
* Rename words to terms
* Print progress to console
* Add confirmation to Export to file
* Improve progress logs
* Add unresponsive and console note
* Add progress bars
* Make cancel button actually cancel operation
* Remove unresponsive warnings
* Disable send and export buttons after they are clicked
* Remove unneeded Yomichan mention
* Mark as experimental
* Clarify description
* Add documentation on Anki Deck Generation
* Add experimental note in docs
* Add warning text to settings page
* Switch example text based on language
* Remove silly cancel function and bind directly
* Rename to model
* Add link to docs
* Make test text less confusing
* Rename deck to notes
* Clarify what is being sent to anki
* Fix incorrect modal header text
* Clarify wording
* Fix ankiconnect addNotes return types
* Add error handling to send to anki
* Fix wording and naming in docs
* Add option to prevent sending duplicates to anki
* Update anki deck and model without a page refresh
* Cleanup internal html naming
* Cleanup type definition styling
* Update example text without a page refresh
* Prevent closing the send/export confirm modal from messing up the ui and not allowing the user to see the current progress
* Fix cancel getting stuck on true
* Consolidate state changes
* Support idle download timeout
* Capitalize Failed to add cards error
* Add separate variable for idleTimeout calculation
* Remove redundant _cachedDictionaryEntryValue variable
* Use tags option to populate tags
* Include deck and tags when exporting to file
* Use date down to seconds and zero pad
* Remove unnecessary ternary
* Limit 'path' finding function to only being able to search for 'path'
* Rename _findPathsByKey to _findAllPaths
Diffstat (limited to 'ext/js/comm/anki-connect.js')
-rw-r--r-- | ext/js/comm/anki-connect.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/ext/js/comm/anki-connect.js b/ext/js/comm/anki-connect.js index 23183e79..446b2139 100644 --- a/ext/js/comm/anki-connect.js +++ b/ext/js/comm/anki-connect.js @@ -129,6 +129,19 @@ export class AnkiConnect { return result; } + /** + * @param {import('anki').Note[]} notes + * @returns {Promise<?((number | null)[] | null)>} + */ + async addNotes(notes) { + if (!this._enabled) { return null; } + await this._checkVersion(); + const result = await this._invoke('addNotes', {notes}); + if (result !== null && !Array.isArray(result)) { + throw this._createUnexpectedResultError('(number | null)[] | null', result); + } + return result; + } /** * @param {import('anki').Note[]} notes |