Update _getNodeNoteIds to return integer IDs (#2142)

This commit is contained in:
toasted-nutbread 2022-05-16 22:20:53 -04:00 committed by GitHub
parent 63d37c872b
commit bd53f2bbfb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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) {