Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
vinhtranchau committed Feb 12, 2020
1 parent 5b56edb commit 26c4d71
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/modules/Selection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1441,8 +1441,11 @@ export class Select {
const cursorOnTheRight = this.cursorOnTheRight(currentBox);
const cursorOnTheLeft = this.cursorOnTheLeft(currentBox);

let br: HTMLElement | null = null;

if (cursorOnTheRight || cursorOnTheLeft) {
const br = this.jodit.create.inside.element('br');
br = this.jodit.create.inside.element('br');

range.insertNode(br);

const clearBR = (
Expand Down Expand Up @@ -1486,7 +1489,15 @@ export class Select {
if (currentBox.parentNode) {
try {
currentBox.parentNode.insertBefore(fragment, currentBox);
} catch {}

if (br && br.parentNode) {
const range = this.createRange();
range.setStartBefore(br);
this.selectRange(range);
}
} catch(e) {
console.log(e)
}
}

return currentBox.previousElementSibling;
Expand Down

0 comments on commit 26c4d71

Please sign in to comment.