From 5abb3a5586b02783524c5241d967fdbd884ae8d5 Mon Sep 17 00:00:00 2001 From: ashu8912 Date: Wed, 15 Jan 2020 17:50:00 +0530 Subject: [PATCH] fixed cursor position on tidy --- client/modules/IDE/components/Editor.jsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/client/modules/IDE/components/Editor.jsx b/client/modules/IDE/components/Editor.jsx index b8e81650..ac10e8e5 100644 --- a/client/modules/IDE/components/Editor.jsx +++ b/client/modules/IDE/components/Editor.jsx @@ -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) {