My package opens a filetype with a tab full of space-pen-rendered HTML elements, and I want to focus on a particular one (a TextEditorView) when the tab is switched to. The layout looks basically like this:
@div class: 'block', => # stuff in between @subview 'editorView', new TextEditorView
What I’d like to do is:
- On the tab being reclicked, re-selected, whatever, so that it is the active one in the current pane,
- Put the focus on the textEditorView so that the cursor is immediately visible and active within that view.
My attempt is as follows:
atom.workspace.observeActivePane (activePane) => @myActivePane = activePane @myActivePane.observeActiveItem (activeItem) => if activeItem is @bpe @editorView.focus()
@bpe is the pane item corresponding to my View. It works, but only if I don’t change the active pane or move my view to another pane. I’m not sure why, since that code seems to cover it, even if a new pane is added. How can I extend the focusing functionality to cover other panes?