fixed cursor position on tidy

This commit is contained in:
ashu8912 2020-01-15 17:50:00 +05:30
parent ec7c2d1ae9
commit 5abb3a5586

View file

@ -271,6 +271,7 @@ class Editor extends React.Component {
};
const mode = this._cm.getOption('mode');
const currentPosition = this._cm.doc.getCursor();
if (mode === 'javascript') {
this._cm.doc.setValue(beautifyJS(this._cm.doc.getValue(), beautifyOptions));
} else if (mode === 'css') {
@ -278,6 +279,7 @@ class Editor extends React.Component {
} else if (mode === 'htmlmixed') {
this._cm.doc.setValue(beautifyHTML(this._cm.doc.getValue(), beautifyOptions));
}
this._cm.doc.setCursor({ line: currentPosition.line, ch: currentPosition.ch });
}
initializeDocuments(files) {