From 891e82b524140ac0290d7cebd587d8aa8b6f6f5b Mon Sep 17 00:00:00 2001 From: Chaitanya Narhare Date: Sun, 21 Apr 2024 22:44:14 +0530 Subject: [PATCH] fixes #2221 characters getting deleted between file changes --- client/modules/IDE/components/Editor/index.jsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/client/modules/IDE/components/Editor/index.jsx b/client/modules/IDE/components/Editor/index.jsx index 87f456a126..da1136d96a 100644 --- a/client/modules/IDE/components/Editor/index.jsx +++ b/client/modules/IDE/components/Editor/index.jsx @@ -235,6 +235,16 @@ class Editor extends React.Component { componentDidUpdate(prevProps) { if (this.props.file.id !== prevProps.file.id) { + const fileMode = this.getFileMode(this.props.file.name); + if (fileMode === 'javascript') { + // Define the new Emmet configuration based on the file mode + const emmetConfig = { + preview: ['html'], + markTagPairs: false, + autoRenameTags: true + }; + this._cm.setOption('emmet', emmetConfig); + } const oldDoc = this._cm.swapDoc(this._docs[this.props.file.id]); this._docs[prevProps.file.id] = oldDoc; this._cm.focus();