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 3f5d539 commit ca2b6e2Copy full SHA for ca2b6e2
lib/codeit.js
@@ -652,9 +652,12 @@ class CodeitElement extends HTMLElement {
652
cd.setSelection(pos.start, (pos.start + wrappedText.length));
653
654
} else {
655
+
656
+ // get caret pos in text
657
+ const pos = cd.getSelection();
658
659
// if cursor is on last line
- if (textSel.start === cd.textContent.length) {
660
+ if (pos.start === cd.textContent.length) {
661
662
// insert newline
663
cd.insert((close[open.indexOf(event.key)] + '\n'), { moveToEnd: false });
0 commit comments