diff --git a/rslib/ftl/notetypes.ftl b/rslib/ftl/notetypes.ftl index 3a3c42194..924bf3e54 100644 --- a/rslib/ftl/notetypes.ftl +++ b/rslib/ftl/notetypes.ftl @@ -4,6 +4,7 @@ notetypes-front-field = Front notetypes-back-field = Back notetypes-add-reverse-field = Add Reverse notetypes-text-field = Text +notetypes-back-extra-field = Back Extra ## Default note type names diff --git a/rslib/src/findreplace.rs b/rslib/src/findreplace.rs index dc7fabd25..099df8e17 100644 --- a/rslib/src/findreplace.rs +++ b/rslib/src/findreplace.rs @@ -142,11 +142,16 @@ mod test { assert_eq!(¬e.fields, &["one BBB", "two BBB"]); let note2 = col.storage.get_note(note2.id)?.unwrap(); - assert_eq!(¬e2.fields, &["three BBB"]); + assert_eq!(¬e2.fields, &["three BBB", ""]); assert_eq!( col.storage.field_names_for_notes(&nids)?, - vec!["Back".to_string(), "Front".into(), "Text".into()] + vec![ + "Back".to_string(), + "Back Extra".into(), + "Front".into(), + "Text".into() + ] ); let cnt = col.find_and_replace(nids.clone(), "BBB", "ccc", Some("Front".into()))?; // still 2, as the caller is expected to provide only note ids that have diff --git a/rslib/src/notetype/stock.rs b/rslib/src/notetype/stock.rs index 6c2fac169..38a928f9e 100644 --- a/rslib/src/notetype/stock.rs +++ b/rslib/src/notetype/stock.rs @@ -112,8 +112,11 @@ pub(crate) fn cloze(i18n: &I18n) -> NoteType { nt.name = i18n.tr(TR::NotetypesClozeName).into(); let text = i18n.tr(TR::NotetypesTextField); nt.add_field(text.as_ref()); - let fmt = format!("{{{{cloze:{}}}}}", text); - nt.add_template(nt.name.clone(), fmt.clone(), fmt); + let back_extra = i18n.tr(TR::NotetypesBackExtraField); + nt.add_field(back_extra.as_ref()); + let qfmt = format!("{{{{cloze:{}}}}}", text); + let afmt = format!("{}
\n{{{{{}}}}}", qfmt, back_extra); + nt.add_template(nt.name.clone(), qfmt, afmt); nt.config.kind = NoteTypeKind::Cloze as i32; nt.config.css += " .cloze {