Save note after field update (#287)

Signed-off-by: Marcel Graber <marcel@clever.design>
This commit is contained in:
Marcel Graber 2021-09-16 02:55:46 +02:00 committed by GitHub
parent 5bb02e7d21
commit 335de469c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -730,6 +730,7 @@ class AnkiConnect:
def updateNoteFields(self, note): def updateNoteFields(self, note):
ankiNote = self.getNote(note['id']) ankiNote = self.getNote(note['id'])
self.startEditing()
for name, value in note['fields'].items(): for name, value in note['fields'].items():
if name in ankiNote: if name in ankiNote:
ankiNote[name] = value ankiNote[name] = value
@ -745,6 +746,9 @@ class AnkiConnect:
ankiNote.flush() ankiNote.flush()
self.collection().autosave()
self.stopEditing()
@util.api() @util.api()
def addTags(self, notes, tags, add=True): def addTags(self, notes, tags, add=True):