Skip to content

Commit fe0d19f

Browse files
Vishawdeep-Singhkhanniie
authored andcommitted
fix Exiting Multi-Line Cursor Doesnt Return to the Original Cursor
1 parent 249e728 commit fe0d19f

File tree

1 file changed

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

1 file changed

+12
-0
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,18 @@ class Editor extends React.Component {
193193
if (/^[a-z]$/i.test(e.key) && (mode === 'css' || mode === 'javascript')) {
194194
showHint(_cm, this.props.autocompleteHinter, this.props.fontSize);
195195
}
196+
if (e.key === 'Escape') {
197+
console.log(this._cm);
198+
e.preventDefault();
199+
const selections = this._cm.listSelections();
200+
if (selections.length > 1) {
201+
const firstPos = selections[0].head || selections[0].anchor;
202+
this._cm.setSelection(firstPos);
203+
this._cm.scrollIntoView(firstPos);
204+
} else {
205+
this._cm.getInputField().blur();
206+
}
207+
}
196208
});
197209

198210
this._cm.getWrapperElement().style[

0 commit comments

Comments
 (0)