We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0bcf8b2 commit 5563bd9Copy full SHA for 5563bd9
filebrowser.js
@@ -2440,16 +2440,16 @@ function setupEditor() {
2440
// if the code is different, swap it
2441
if (hashCode(selText) !== hashCode(beautifiedText)) {
2442
2443
- // get current selection
2444
- const [startPos, endPos] = cd.getSelection();
+ // get caret pos in text
+ const pos = cd.getSelection();
2445
2446
// replace selection contents
2447
// with beautified text
2448
cd.deleteCurrentSelection();
2449
cd.insert(beautifiedText);
2450
-
2451
- // reselect
2452
- cd.setSelection(startPos, endPos);
+
+ // restore pos in text
+ cd.setSelection(pos.start, pos.end);
2453
2454
// dispatch type event (simulate typing)
2455
cd.dispatchTypeEvent();
0 commit comments