Skip to content

Commit 3551e63

Browse files
Arthur-MilchiorBrayanDSO
authored andcommitted
fix(note-editor): properly save sticky fields
Fixes #18362
1 parent 38fa459 commit 3551e63

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

AnkiDroid/src/main/java/com/ichi2/anki/NoteEditor.kt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2076,15 +2076,22 @@ class NoteEditor :
20762076
toggleStickyButton: ImageButton,
20772077
index: Int,
20782078
) {
2079+
val updatedStickyState = !currentFields[index].sticky
2080+
currentFields[index].sticky = updatedStickyState
20792081
val text = editFields!![index].fieldText
2080-
if (toggleStickyText[index] == null) {
2082+
if (updatedStickyState) {
20812083
toggleStickyText[index] = text
20822084
toggleStickyButton.background.alpha = 255
20832085
Timber.d("Saved Text:: %s", toggleStickyText[index])
20842086
} else {
20852087
toggleStickyText.remove(index)
20862088
toggleStickyButton.background.alpha = 64
20872089
}
2090+
launchCatchingTask {
2091+
withCol {
2092+
this.notetypes.save(editorNote!!.notetype)
2093+
}
2094+
}
20882095
}
20892096

20902097
@NeedsTest("13719: moving from a note type with more fields to one with fewer fields")

0 commit comments

Comments
 (0)