mirror of
https://github.com/ankitects/anki.git
synced 2025-12-12 22:36:55 -05:00
Use raw sort field text in note_field_str() ...
... instead of the preprocessed note.sort_field. That means we always have to load the note with fields.
This commit is contained in:
parent
9151bfb53e
commit
03b9667789
1 changed files with 6 additions and 6 deletions
|
|
@ -132,7 +132,10 @@ impl RenderContext {
|
||||||
impl<'a> RowContext<'a> {
|
impl<'a> RowContext<'a> {
|
||||||
fn new(col: &'a mut Collection, id: CardID, with_card_render: bool) -> Result<Self> {
|
fn new(col: &'a mut Collection, id: CardID, with_card_render: bool) -> Result<Self> {
|
||||||
let card = col.storage.get_card(id)?.ok_or(AnkiError::NotFound)?;
|
let card = col.storage.get_card(id)?.ok_or(AnkiError::NotFound)?;
|
||||||
let note = if with_card_render {
|
// todo: After note.sort_field has been modified so it can be displayed in the browser,
|
||||||
|
// we can update note_field_str() and only load the note with fields if a card render is
|
||||||
|
// necessary (see #1082).
|
||||||
|
let note = if true {
|
||||||
col.storage.get_note(card.note_id)?
|
col.storage.get_note(card.note_id)?
|
||||||
} else {
|
} else {
|
||||||
col.storage.get_note_without_fields(card.note_id)?
|
col.storage.get_note_without_fields(card.note_id)?
|
||||||
|
|
@ -295,11 +298,8 @@ impl<'a> RowContext<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn note_field_str(&self) -> String {
|
fn note_field_str(&self) -> String {
|
||||||
if let Some(field) = &self.note.sort_field {
|
let index = self.notetype.config.sort_field_idx as usize;
|
||||||
field.to_owned()
|
html_to_text_line(&self.note.fields()[index]).into()
|
||||||
} else {
|
|
||||||
"".to_string()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn template_str(&self) -> Result<String> {
|
fn template_str(&self) -> Result<String> {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue