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
This commit is contained in:
Damien Elmes 2017-08-15 11:38:32 +10:00
parent 1e06fe4896
commit 30e6a34d25

View file

@ -264,10 +264,9 @@ class Editor:
return
self.setupForegroundButton()
self.checkValid()
runHook("loadNote", self)
if focusTo is not None:
self.web.setFocus()
runHook("loadNote", self)
self.web.evalWithCallback("setFields(%s, %s); setFonts(%s); focusField(%s)" % (
json.dumps(data), json.dumps(self.prewrapMode()),