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) {
|
function onDragOver(elem) {
|
||||||
elem.focus();
|
elem.focus();
|
||||||
}
|
}
|
||||||
|
@ -894,6 +898,14 @@ class EditorWebView(AnkiWebView):
|
||||||
else:
|
else:
|
||||||
AnkiWebView.mouseReleaseEvent(self, evt)
|
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.
|
# Buggy; disable for now.
|
||||||
# def contextMenuEvent(self, evt):
|
# def contextMenuEvent(self, evt):
|
||||||
# # adjust in case the user is going to paste
|
# # adjust in case the user is going to paste
|
||||||
|
|
Loading…
Reference in a new issue