mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02: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:
|
||||
# shutdown
|
||||
return
|
||||
|
||||
# focus lost or key/button pressed?
|
||||
if cmd.startswith("blur") or cmd.startswith("key"):
|
||||
(type, ord_str, nid_str, txt) = cmd.split(":", 3)
|
||||
|
@ -462,17 +463,14 @@ class Editor:
|
|||
else:
|
||||
gui_hooks.editor_did_fire_typing_timer(self.note)
|
||||
self.checkValid()
|
||||
|
||||
# focused into field?
|
||||
elif cmd.startswith("focus"):
|
||||
(type, num) = cmd.split(":", 1)
|
||||
self.currentField = int(num)
|
||||
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)
|
||||
ord = int(num)
|
||||
|
||||
|
@ -482,6 +480,12 @@ class Editor:
|
|||
|
||||
return new_state
|
||||
|
||||
elif cmd in self._links:
|
||||
self._links[cmd](self)
|
||||
|
||||
else:
|
||||
print("uncaught cmd", cmd)
|
||||
|
||||
def mungeHTML(self, txt: str) -> str:
|
||||
return gui_hooks.editor_will_munge_html(txt, self)
|
||||
|
||||
|
|
Loading…
Reference in a new issue