Skip to content

Commit 891e82b

Browse files
author
Chaitanya Narhare
committed
fixes #2221 characters getting deleted between file changes
1 parent 229f86c commit 891e82b

File tree

1 file changed

+10
-0
lines changed
  • client/modules/IDE/components/Editor

1 file changed

+10
-0
lines changed

client/modules/IDE/components/Editor/index.jsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,16 @@ class Editor extends React.Component {
235235

236236
componentDidUpdate(prevProps) {
237237
if (this.props.file.id !== prevProps.file.id) {
238+
const fileMode = this.getFileMode(this.props.file.name);
239+
if (fileMode === 'javascript') {
240+
// Define the new Emmet configuration based on the file mode
241+
const emmetConfig = {
242+
preview: ['html'],
243+
markTagPairs: false,
244+
autoRenameTags: true
245+
};
246+
this._cm.setOption('emmet', emmetConfig);
247+
}
238248
const oldDoc = this._cm.swapDoc(this._docs[this.props.file.id]);
239249
this._docs[prevProps.file.id] = oldDoc;
240250
this._cm.focus();

0 commit comments

Comments
 (0)