mirror of
https://github.com/ankitects/anki.git
synced 2025-09-23 08:22:24 -04:00
focus correct field on tab/backtab
This commit is contained in:
parent
b6adc9f1bb
commit
954c5171e3
1 changed files with 12 additions and 0 deletions
|
@ -119,6 +119,10 @@ function onFocus(elem) {
|
|||
}
|
||||
}
|
||||
|
||||
function focusField(n) {
|
||||
$("#f"+n).focus();
|
||||
}
|
||||
|
||||
function onDragOver(elem) {
|
||||
elem.focus();
|
||||
}
|
||||
|
@ -894,6 +898,14 @@ class EditorWebView(AnkiWebView):
|
|||
else:
|
||||
AnkiWebView.mouseReleaseEvent(self, evt)
|
||||
|
||||
def focusInEvent(self, evt):
|
||||
AnkiWebView.focusInEvent(self, evt)
|
||||
if evt.reason() == Qt.TabFocusReason:
|
||||
self.eval("focusField(0);")
|
||||
elif evt.reason() == Qt.BacktabFocusReason:
|
||||
n = len(self.editor.note.fields) - 1
|
||||
self.eval("focusField(%d);" % n)
|
||||
|
||||
# Buggy; disable for now.
|
||||
# def contextMenuEvent(self, evt):
|
||||
# # adjust in case the user is going to paste
|
||||
|
|
Loading…
Reference in a new issue