From 7a4096240ce4faf70a785d047945388baa0daab3 Mon Sep 17 00:00:00 2001 From: Eloy Robillard Date: Thu, 15 Feb 2024 04:02:36 +0100 Subject: Show all duplicate notes on click (#636) * Show all duplicate notes on click * Change 'notesView' to 'viewNotes' * Replace api.noteView with api.viewNotes * Update "viewNote" action to "viewNotes" in options util * Update options-util test with "viewNotes" action * Replace uses of "viewNote" with "viewNotes" * Replace _viewNote with _viewNotes * Rename /*ViewNote*/ methods to /*ViewNotes*/ --- ext/js/comm/anki-connect.js | 8 ++++++++ ext/js/comm/api.js | 12 ++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) (limited to 'ext/js/comm') diff --git a/ext/js/comm/anki-connect.js b/ext/js/comm/anki-connect.js index 7cb2d071..0bf38bda 100644 --- a/ext/js/comm/anki-connect.js +++ b/ext/js/comm/anki-connect.js @@ -200,6 +200,14 @@ export class AnkiConnect { return await this.guiBrowse(`nid:${noteId}`); } + /** + * @param {import('anki').NoteId[]} noteIds + * @returns {Promise} + */ + async guiBrowseNotes(noteIds) { + return await this.guiBrowse(`nid:${noteIds.join(',')}`); + } + /** * Opens the note editor GUI. * @param {import('anki').NoteId} noteId The ID of the note. diff --git a/ext/js/comm/api.js b/ext/js/comm/api.js index 2e1e8826..b4fdbeb5 100644 --- a/ext/js/comm/api.js +++ b/ext/js/comm/api.js @@ -118,13 +118,13 @@ export class API { } /** - * @param {import('api').ApiParam<'noteView', 'noteId'>} noteId - * @param {import('api').ApiParam<'noteView', 'mode'>} mode - * @param {import('api').ApiParam<'noteView', 'allowFallback'>} allowFallback - * @returns {Promise>} + * @param {import('api').ApiParam<'viewNotes', 'noteIds'>} noteIds + * @param {import('api').ApiParam<'viewNotes', 'mode'>} mode + * @param {import('api').ApiParam<'viewNotes', 'allowFallback'>} allowFallback + * @returns {Promise>} */ - noteView(noteId, mode, allowFallback) { - return this._invoke('noteView', {noteId, mode, allowFallback}); + viewNotes(noteIds, mode, allowFallback) { + return this._invoke('viewNotes', {noteIds, mode, allowFallback}); } /** -- cgit v1.2.3