Move setSticky() call

This commit is contained in:
Abdo 2025-05-26 02:53:53 +03:00
parent 35f0bc5af6
commit 436d76a81e
2 changed files with 3 additions and 4 deletions

View file

@ -547,10 +547,6 @@ require("anki/ui").loaded.then(() => require("anki/NoteEditor").instances[0].too
assert self.mw.pm.profile is not None
js = f"loadNote({self.note.id}, {self.note.mid});"
if self.addMode:
sticky = [field["sticky"] for field in self.note_type()["flds"]]
js += " setSticky(%s);" % json.dumps(sticky)
if self.current_notetype_is_image_occlusion():
io_field_indices = self.mw.backend.get_image_occlusion_fields(self.note.mid)
image_field = self.note.fields[io_field_indices.image]

View file

@ -640,6 +640,9 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
setShrinkImages(true);
// TODO: closeHTMLTags col config
setCloseHTMLTags(true);
if (mode === "add") {
setSticky(notetype.fields.map((field) => field.config?.sticky ?? false));
}
triggerChanges();
}