mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
Merge pull request #778 from hgiesel/refocus
Always focus main web instead of bottom web in reviewer
This commit is contained in:
commit
301c9587d1
3 changed files with 19 additions and 11 deletions
|
@ -201,9 +201,7 @@ class Reviewer:
|
||||||
self._drawFlag()
|
self._drawFlag()
|
||||||
self._drawMark()
|
self._drawMark()
|
||||||
self._showAnswerButton()
|
self._showAnswerButton()
|
||||||
# if we have a type answer field, focus main web
|
self.mw.web.setFocus()
|
||||||
if self.typeCorrect:
|
|
||||||
self.mw.web.setFocus()
|
|
||||||
# user hook
|
# user hook
|
||||||
gui_hooks.reviewer_did_show_question(c)
|
gui_hooks.reviewer_did_show_question(c)
|
||||||
|
|
||||||
|
@ -242,6 +240,7 @@ class Reviewer:
|
||||||
# render and update bottom
|
# render and update bottom
|
||||||
self.web.eval("_showAnswer(%s);" % json.dumps(a))
|
self.web.eval("_showAnswer(%s);" % json.dumps(a))
|
||||||
self._showEaseButtons()
|
self._showEaseButtons()
|
||||||
|
self.mw.web.setFocus()
|
||||||
# user hook
|
# user hook
|
||||||
gui_hooks.reviewer_did_show_answer(c)
|
gui_hooks.reviewer_did_show_answer(c)
|
||||||
|
|
||||||
|
@ -574,11 +573,9 @@ time = %(time)d;
|
||||||
)
|
)
|
||||||
|
|
||||||
def _showAnswerButton(self) -> None:
|
def _showAnswerButton(self) -> None:
|
||||||
if not self.typeCorrect:
|
|
||||||
self.bottom.web.setFocus()
|
|
||||||
middle = """
|
middle = """
|
||||||
<span class=stattxt>%s</span><br>
|
<span class=stattxt>%s</span><br>
|
||||||
<button title="%s" id=ansbut onclick='pycmd("ans");'>%s</button>""" % (
|
<button title="%s" id="ansbut" class="focus" onclick='pycmd("ans");'>%s</button>""" % (
|
||||||
self._remaining(),
|
self._remaining(),
|
||||||
_("Shortcut key: %s") % _("Space"),
|
_("Shortcut key: %s") % _("Space"),
|
||||||
_("Show Answer"),
|
_("Show Answer"),
|
||||||
|
@ -596,7 +593,6 @@ time = %(time)d;
|
||||||
self.bottom.web.adjustHeightToFit()
|
self.bottom.web.adjustHeightToFit()
|
||||||
|
|
||||||
def _showEaseButtons(self) -> None:
|
def _showEaseButtons(self) -> None:
|
||||||
self.bottom.web.setFocus()
|
|
||||||
middle = self._answerButtons()
|
middle = self._answerButtons()
|
||||||
self.bottom.web.eval("showAnswer(%s);" % json.dumps(middle))
|
self.bottom.web.eval("showAnswer(%s);" % json.dumps(middle))
|
||||||
|
|
||||||
|
@ -648,7 +644,7 @@ time = %(time)d;
|
||||||
|
|
||||||
def but(i, label):
|
def but(i, label):
|
||||||
if i == default:
|
if i == default:
|
||||||
extra = "id=defease"
|
extra = """id="defease" class="focus" """
|
||||||
else:
|
else:
|
||||||
extra = ""
|
extra = ""
|
||||||
due = self._buttonTime(i)
|
due = self._buttonTime(i)
|
||||||
|
|
|
@ -33,7 +33,21 @@ button {
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ansbut { margin-bottom: 1em; }
|
#ansbut {
|
||||||
|
margin-bottom: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.focus {
|
||||||
|
outline: 5px auto rgba(0, 103, 244, 0.247);
|
||||||
|
|
||||||
|
#innertable:focus-within & {
|
||||||
|
outline: unset;
|
||||||
|
|
||||||
|
&:focus {
|
||||||
|
outline: 5px auto rgba(0, 103, 244, 0.247);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.nobold {
|
.nobold {
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
|
|
|
@ -36,14 +36,12 @@ let updateTime = function () {
|
||||||
function showQuestion(txt, maxTime_) {
|
function showQuestion(txt, maxTime_) {
|
||||||
// much faster than jquery's .html()
|
// much faster than jquery's .html()
|
||||||
$("#middle")[0].innerHTML = txt;
|
$("#middle")[0].innerHTML = txt;
|
||||||
$("#ansbut").focus();
|
|
||||||
time = 0;
|
time = 0;
|
||||||
maxTime = maxTime_;
|
maxTime = maxTime_;
|
||||||
}
|
}
|
||||||
|
|
||||||
function showAnswer(txt) {
|
function showAnswer(txt) {
|
||||||
$("#middle")[0].innerHTML = txt;
|
$("#middle")[0].innerHTML = txt;
|
||||||
$("#defease").focus();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function selectedAnswerButton() {
|
function selectedAnswerButton() {
|
||||||
|
|
Loading…
Reference in a new issue