mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 15:02:21 -04:00
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
1 changed files with 8 additions and 0 deletions
|
@ -120,6 +120,10 @@ function clearChangeTimer() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function onFocus(elem) {
|
function onFocus(elem) {
|
||||||
|
if (currentField === elem) {
|
||||||
|
// anki window refocused; current element unchanged
|
||||||
|
return;
|
||||||
|
}
|
||||||
currentField = elem;
|
currentField = elem;
|
||||||
pycmd("focus:" + currentFieldOrdinal());
|
pycmd("focus:" + currentFieldOrdinal());
|
||||||
enableButtons();
|
enableButtons();
|
||||||
|
@ -190,6 +194,10 @@ function caretToEnd() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function onBlur() {
|
function onBlur() {
|
||||||
|
if (document.activeElement === currentField) {
|
||||||
|
// anki window defocused; current field unchanged
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (currentField) {
|
if (currentField) {
|
||||||
saveField("blur");
|
saveField("blur");
|
||||||
currentField = null;
|
currentField = null;
|
||||||
|
|
Loading…
Reference in a new issue