It seems like you could just call editor.focus() here rather than relying on internal functions?