From bd53f2bbfb5cd523318d54779e40ceea7ba68874 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Mon, 16 May 2022 22:20:53 -0400 Subject: [PATCH] Update _getNodeNoteIds to return integer IDs (#2142) --- ext/js/display/display-anki.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ext/js/display/display-anki.js b/ext/js/display/display-anki.js index 78a06404..8cb9311e 100644 --- a/ext/js/display/display-anki.js +++ b/ext/js/display/display-anki.js @@ -668,7 +668,16 @@ class DisplayAnki { _getNodeNoteIds(node) { const {noteIds} = node.dataset; - return typeof noteIds === 'string' && noteIds.length > 0 ? noteIds.split(' ') : []; + const results = []; + if (typeof noteIds === 'string' && noteIds.length > 0) { + for (const noteId of noteIds.split(' ')) { + const noteIdInt = Number.parseInt(noteId, 10); + if (Number.isFinite(noteIdInt)) { + results.push(noteIdInt); + } + } + } + return results; } _getViewNoteButton(index) {