filearts / plunker

Plnkr.co front-end and backend
MIT License
598 stars 118 forks source link

Ace Editor does not focus unless clicked #85

Open bryc opened 9 years ago

bryc commented 9 years ago

When you choose a file from the left sidebar (or when the app first loads), it won't let you type anything unless you click the editor.

It would be nice if the editor was automatically focused when doing this. I noticed that each Ace Editor actually saves the text cursor's position, so it is advantageous to focus and continue typing.

Ace editor has a built-in focus method.

sureshputtur commented 9 years ago

use editor.focus to get focus on first line.

To focus previous edited line use below code session = editor.getSession(); //Get the number of lines count = session.getLength();

//Go to the last line editor.gotoLine(count, session.getLine(count-1).length);