Merge pull request #1247 from hgiesel/pinnedfieldsfix

Call update_notetype_legacy after toggling sticky
This commit is contained in:
Damien Elmes 2021-06-22 09:10:14 +10:00 committed by GitHub
commit a62b3dd10f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -32,6 +32,7 @@ from anki.utils import checksum, isLin, isWin, namedtmp
from aqt import AnkiQt, colors, gui_hooks
from aqt.operations import QueryOp
from aqt.operations.note import update_note
from aqt.operations.notetype import update_notetype_legacy
from aqt.qt import *
from aqt.sound import av_player
from aqt.theme import theme_manager
@ -393,10 +394,13 @@ $editorToolbar.then(({{ toolbar }}) => toolbar.appendGroup({{
(type, num) = cmd.split(":", 1)
ord = int(num)
fld = self.note.model()["flds"][ord]
model = self.note.model()
fld = model["flds"][ord]
new_state = not fld["sticky"]
fld["sticky"] = new_state
update_notetype_legacy(parent=self.mw, notetype=model).run_in_background()
return new_state
elif cmd in self._links: