mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
Refactor bridgeCommand and silence false "uncaught msg" log
This commit is contained in:
parent
25d7d80e20
commit
e03bfd2923
1 changed files with 9 additions and 5 deletions
|
@ -433,6 +433,7 @@ class Editor:
|
||||||
if not self.note:
|
if not self.note:
|
||||||
# shutdown
|
# shutdown
|
||||||
return
|
return
|
||||||
|
|
||||||
# focus lost or key/button pressed?
|
# focus lost or key/button pressed?
|
||||||
if cmd.startswith("blur") or cmd.startswith("key"):
|
if cmd.startswith("blur") or cmd.startswith("key"):
|
||||||
(type, ord_str, nid_str, txt) = cmd.split(":", 3)
|
(type, ord_str, nid_str, txt) = cmd.split(":", 3)
|
||||||
|
@ -462,17 +463,14 @@ class Editor:
|
||||||
else:
|
else:
|
||||||
gui_hooks.editor_did_fire_typing_timer(self.note)
|
gui_hooks.editor_did_fire_typing_timer(self.note)
|
||||||
self.checkValid()
|
self.checkValid()
|
||||||
|
|
||||||
# focused into field?
|
# focused into field?
|
||||||
elif cmd.startswith("focus"):
|
elif cmd.startswith("focus"):
|
||||||
(type, num) = cmd.split(":", 1)
|
(type, num) = cmd.split(":", 1)
|
||||||
self.currentField = int(num)
|
self.currentField = int(num)
|
||||||
gui_hooks.editor_did_focus_field(self.note, self.currentField)
|
gui_hooks.editor_did_focus_field(self.note, self.currentField)
|
||||||
elif cmd in self._links:
|
|
||||||
self._links[cmd](self)
|
|
||||||
else:
|
|
||||||
print("uncaught cmd", cmd)
|
|
||||||
|
|
||||||
if cmd.startswith("toggleSticky"):
|
elif cmd.startswith("toggleSticky"):
|
||||||
(type, num) = cmd.split(":", 1)
|
(type, num) = cmd.split(":", 1)
|
||||||
ord = int(num)
|
ord = int(num)
|
||||||
|
|
||||||
|
@ -482,6 +480,12 @@ class Editor:
|
||||||
|
|
||||||
return new_state
|
return new_state
|
||||||
|
|
||||||
|
elif cmd in self._links:
|
||||||
|
self._links[cmd](self)
|
||||||
|
|
||||||
|
else:
|
||||||
|
print("uncaught cmd", cmd)
|
||||||
|
|
||||||
def mungeHTML(self, txt: str) -> str:
|
def mungeHTML(self, txt: str) -> str:
|
||||||
return gui_hooks.editor_will_munge_html(txt, self)
|
return gui_hooks.editor_will_munge_html(txt, self)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue