fixed cursor position on tidy
This commit is contained in:
parent
ec7c2d1ae9
commit
5abb3a5586
1 changed files with 2 additions and 0 deletions
|
@ -271,6 +271,7 @@ class Editor extends React.Component {
|
||||||
};
|
};
|
||||||
|
|
||||||
const mode = this._cm.getOption('mode');
|
const mode = this._cm.getOption('mode');
|
||||||
|
const currentPosition = this._cm.doc.getCursor();
|
||||||
if (mode === 'javascript') {
|
if (mode === 'javascript') {
|
||||||
this._cm.doc.setValue(beautifyJS(this._cm.doc.getValue(), beautifyOptions));
|
this._cm.doc.setValue(beautifyJS(this._cm.doc.getValue(), beautifyOptions));
|
||||||
} else if (mode === 'css') {
|
} else if (mode === 'css') {
|
||||||
|
@ -278,6 +279,7 @@ class Editor extends React.Component {
|
||||||
} else if (mode === 'htmlmixed') {
|
} else if (mode === 'htmlmixed') {
|
||||||
this._cm.doc.setValue(beautifyHTML(this._cm.doc.getValue(), beautifyOptions));
|
this._cm.doc.setValue(beautifyHTML(this._cm.doc.getValue(), beautifyOptions));
|
||||||
}
|
}
|
||||||
|
this._cm.doc.setCursor({ line: currentPosition.line, ch: currentPosition.ch });
|
||||||
}
|
}
|
||||||
|
|
||||||
initializeDocuments(files) {
|
initializeDocuments(files) {
|
||||||
|
|
Loading…
Reference in a new issue