Merge pull request #1240 from ashu8912/cursor-pos-final
fixed cursor position on tidy
This commit is contained in:
commit
69f26c12ea
1 changed files with 5 additions and 1 deletions
|
@ -269,8 +269,8 @@ class Editor extends React.Component {
|
|||
indent_size: INDENTATION_AMOUNT,
|
||||
indent_with_tabs: IS_TAB_INDENT
|
||||
};
|
||||
|
||||
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 +278,10 @@ class Editor extends React.Component {
|
|||
} else if (mode === 'htmlmixed') {
|
||||
this._cm.doc.setValue(beautifyHTML(this._cm.doc.getValue(), beautifyOptions));
|
||||
}
|
||||
setTimeout(() => {
|
||||
this._cm.focus();
|
||||
this._cm.doc.setCursor({ line: currentPosition.line, ch: currentPosition.ch + INDENTATION_AMOUNT });
|
||||
}, 0);
|
||||
}
|
||||
|
||||
initializeDocuments(files) {
|
||||
|
|
Loading…
Reference in a new issue