From 30e6a34d250ea6d6d5ebe2b6c929b72b54dd7f45 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Tue, 15 Aug 2017 11:38:32 +1000 Subject: [PATCH] only focus webview after fields have been set on some platforms the old approach was causing a focus+blur event to fire with the old note contents fixes https://anki.tenderapp.com/discussions/beta-testing/681-red-cloze and probably fixes https://anki.tenderapp.com/discussions/beta-testing/683-back-input-returns --- aqt/editor.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/aqt/editor.py b/aqt/editor.py index 5c52da657..3867fedf7 100644 --- a/aqt/editor.py +++ b/aqt/editor.py @@ -264,11 +264,10 @@ class Editor: return self.setupForegroundButton() self.checkValid() + if focusTo is not None: + self.web.setFocus() runHook("loadNote", self) - if focusTo is not None: - self.web.setFocus() - self.web.evalWithCallback("setFields(%s, %s); setFonts(%s); focusField(%s)" % ( json.dumps(data), json.dumps(self.prewrapMode()), json.dumps(self.fonts()), json.dumps(focusTo)),