preserve cursor position when switching to another window
https://anki.tenderapp.com/discussions/beta-testing/1043-anki-21-beta-37-if-switch-from-another-program-to-continue-editing-the-cursor-will-move-to-the-bottom
This commit is contained in:
parent
bdaedb7898
commit
844778636c
@ -120,6 +120,10 @@ function clearChangeTimer() {
|
||||
}
|
||||
|
||||
function onFocus(elem) {
|
||||
if (currentField === elem) {
|
||||
// anki window refocused; current element unchanged
|
||||
return;
|
||||
}
|
||||
currentField = elem;
|
||||
pycmd("focus:" + currentFieldOrdinal());
|
||||
enableButtons();
|
||||
@ -190,6 +194,10 @@ function caretToEnd() {
|
||||
}
|
||||
|
||||
function onBlur() {
|
||||
if (document.activeElement === currentField) {
|
||||
// anki window defocused; current field unchanged
|
||||
return;
|
||||
}
|
||||
if (currentField) {
|
||||
saveField("blur");
|
||||
currentField = null;
|
||||
|
Loading…
Reference in New Issue
Block a user