From 486eec15b817d6a87ad98245dea3534545286334 Mon Sep 17 00:00:00 2001 From: Kuuuube <61125188+Kuuuube@users.noreply.github.com> Date: Sat, 11 May 2024 23:03:27 -0400 Subject: 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 --- ext/js/pages/settings/anki-controller.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'ext/js/pages/settings/anki-controller.js') diff --git a/ext/js/pages/settings/anki-controller.js b/ext/js/pages/settings/anki-controller.js index 9640ed62..7eb09c85 100644 --- a/ext/js/pages/settings/anki-controller.js +++ b/ext/js/pages/settings/anki-controller.js @@ -505,6 +505,22 @@ export class AnkiController { return null; } } + + /** + * @param {import('anki').Note[]} notes + * @returns {Promise} + */ + async addNotes(notes) { + return await this._ankiConnect.addNotes(notes); + } + + /** + * @param {import('anki').Note[]} notes + * @returns {Promise} + */ + async canAddNotes(notes) { + return await this._ankiConnect.canAddNotes(notes); + } } class AnkiCardController { -- cgit v1.2.3