aboutsummaryrefslogtreecommitdiff
path: root/ext/js/comm/anki-connect.js
diff options
context:
space:
mode:
authorStefanVukovic99 <stefanvukovic44@gmail.com>2024-05-21 18:55:02 +0200
committerGitHub <noreply@github.com>2024-05-21 16:55:02 +0000
commitba9fa339a43a5f494785877018b10f111ccafff5 (patch)
tree1a4a0b141e08cfe767170425d5afda253bf92990 /ext/js/comm/anki-connect.js
parent737e7eab8182fc4e083f7fd6df840327ab83287c (diff)
add support for overwriting existing card (#859)
* frontend * wip * minimum viable * minor simplification * simplify gradients in duplicate svg * simplify add-duplicate svg * colors good * arrows shape * disable overwrite if no valid duplicate IDs * add warning
Diffstat (limited to 'ext/js/comm/anki-connect.js')
-rw-r--r--ext/js/comm/anki-connect.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/ext/js/comm/anki-connect.js b/ext/js/comm/anki-connect.js
index 446b2139..8c5e2c85 100644
--- a/ext/js/comm/anki-connect.js
+++ b/ext/js/comm/anki-connect.js
@@ -144,6 +144,21 @@ export class AnkiConnect {
}
/**
+ * @param {import('anki').Note} noteWithId
+ * @returns {Promise<null>}
+ */
+ async updateNoteFields(noteWithId) {
+ if (!this._enabled) { return null; }
+ await this._checkVersion();
+ const result = await this._invoke('updateNoteFields', {note: noteWithId});
+ if (result !== null) {
+ throw this._createUnexpectedResultError('null', result);
+ }
+ return result;
+ }
+
+
+ /**
* @param {import('anki').Note[]} notes
* @returns {Promise<boolean[]>}
*/