Skip to content

Commit 8d4d54c

Browse files
committed
Update codeit.js
1 parent 5e9261b commit 8d4d54c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/codeit.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ class CodeitElement extends HTMLElement {
391391

392392
cd.on('paste cut', () => { cd.dispatchEvent(typeEvent) });
393393

394-
cd.on('type mousedown mouseup touchstart touchend focus blur',
394+
cd.on('keydown mousedown mouseup touchstart touchend focus blur',
395395
() => { onNextFrame(checkCaretPosEvent) }, false);
396396

397397

@@ -1284,13 +1284,13 @@ class CodeitElement extends HTMLElement {
12841284

12851285
// if start pos is bigger than codeit length,
12861286
// set start pos to codeit length
1287-
if (startPos > cd.textContent.length) startPos = cd.textContent.length-1;
1287+
if (startPos > cd.textContent.length) startPos = cd.textContent.length;
12881288

12891289
if (endPos) {
12901290

12911291
// if end pos is bigger than codeit length,
12921292
// set end pos to codeit length
1293-
if (endPos > cd.textContent.length) endPos = cd.textContent.length-1;
1293+
if (endPos > cd.textContent.length) endPos = cd.textContent.length;
12941294

12951295
// get caret node and offset
12961296
c = getCaretNode(startPos, endPos);

0 commit comments

Comments
 (0)