Skip to content

Commit 5abb3a5

Browse files
committed
fixed cursor position on tidy
1 parent ec7c2d1 commit 5abb3a5

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

client/modules/IDE/components/Editor.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,13 +271,15 @@ class Editor extends React.Component {
271271
};
272272

273273
const mode = this._cm.getOption('mode');
274+
const currentPosition = this._cm.doc.getCursor();
274275
if (mode === 'javascript') {
275276
this._cm.doc.setValue(beautifyJS(this._cm.doc.getValue(), beautifyOptions));
276277
} else if (mode === 'css') {
277278
this._cm.doc.setValue(beautifyCSS(this._cm.doc.getValue(), beautifyOptions));
278279
} else if (mode === 'htmlmixed') {
279280
this._cm.doc.setValue(beautifyHTML(this._cm.doc.getValue(), beautifyOptions));
280281
}
282+
this._cm.doc.setCursor({ line: currentPosition.line, ch: currentPosition.ch });
281283
}
282284

283285
initializeDocuments(files) {

0 commit comments

Comments
 (0)