mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 14:32:22 -04:00
parent
806fb0f102
commit
18bd821a1f
2 changed files with 7 additions and 2 deletions
|
@ -145,7 +145,9 @@ class AddCards(QDialog):
|
||||||
|
|
||||||
# and update editor state
|
# and update editor state
|
||||||
self.editor.note = new
|
self.editor.note = new
|
||||||
self.editor.loadNote()
|
self.editor.loadNote(
|
||||||
|
focusTo=min(self.editor.last_field_index or 0, len(new.fields) - 1)
|
||||||
|
)
|
||||||
|
|
||||||
def _load_new_note(self, sticky_fields_from: Optional[Note] = None) -> None:
|
def _load_new_note(self, sticky_fields_from: Optional[Note] = None) -> None:
|
||||||
note = self._new_note()
|
note = self._new_note()
|
||||||
|
|
|
@ -106,6 +106,9 @@ class Editor:
|
||||||
self.note: Optional[Note] = None
|
self.note: Optional[Note] = None
|
||||||
self.addMode = addMode
|
self.addMode = addMode
|
||||||
self.currentField: Optional[int] = None
|
self.currentField: Optional[int] = None
|
||||||
|
# Similar to currentField, but not set to None on a blur. May be
|
||||||
|
# outside the bounds of the current notetype.
|
||||||
|
self.last_field_index: Optional[int] = None
|
||||||
# current card, for card layout
|
# current card, for card layout
|
||||||
self.card: Optional[Card] = None
|
self.card: Optional[Card] = None
|
||||||
self.setupOuter()
|
self.setupOuter()
|
||||||
|
@ -387,7 +390,7 @@ $editorToolbar.then(({{ toolbar }}) => toolbar.appendGroup({{
|
||||||
# focused into field?
|
# focused into field?
|
||||||
elif cmd.startswith("focus"):
|
elif cmd.startswith("focus"):
|
||||||
(type, num) = cmd.split(":", 1)
|
(type, num) = cmd.split(":", 1)
|
||||||
self.currentField = int(num)
|
self.last_field_index = self.currentField = int(num)
|
||||||
gui_hooks.editor_did_focus_field(self.note, self.currentField)
|
gui_hooks.editor_did_focus_field(self.note, self.currentField)
|
||||||
|
|
||||||
elif cmd.startswith("toggleStickyAll"):
|
elif cmd.startswith("toggleStickyAll"):
|
||||||
|
|
Loading…
Reference in a new issue