Anki Forums

How to identify Editor instance in Editor gui_hooks

I’m specifically talking about editor_did_fire_typing_timer, editor_did_focus_field, and editor_did_unfocus_field.

I want to trigger a certain action, when the user types into editor fields. However the hooks only provide the note the editor has loaded, not the editor itself.

I was never able to actually use those hooks, because they don’t provide enough information. The editor could be from the browser, or the editcurrent window. Just providing the editor instance would already be enough.

I only see one “hack” possible: You take the note argument provided, and see which editor has it loaded. However what if both have them loaded?

Is there something I’m missing? Is there a way to infer which editor instance fired the hook?

Not the most beautiful solution, but

if hasattr(, "editor"):
      editor =