Refactor bridgeCommand and silence false "uncaught msg" log

This commit is contained in:
Henrik Giesel 2021-03-01 13:34:49 +01:00
parent 25d7d80e20
commit e03bfd2923

View file

@ -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)