Hi everyone, I am tring to focus the editor by calling view.focus() or view.dom.focus(). But it seems not working.
view.focus()
view.dom.focus()
I write a plugin by listening the dom focus event. It was not triggered. But I could trigger the focus event by mouse click.
What I want to do is focus the editor by code?
Any sugguestion would help.
view.focus() is the way to do this. If it’s not working, maybe you’re calling it at a point where the browser (or your script) is moving focus to something else. You could try using a timeout to move the call forward a bit, and see if that helps.
Thanks, @marijn for the quick reply.
I finnally got it. I tried to call the view.dom.focus() in my chrome dev-tool console → it’s not work.
Then my colleage sugguested me to try just in the real code. It worked as expected.
Really appreciate for the reply anyway.