Skip to content

Commit

Permalink
#51
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed Jan 8, 2020
1 parent 57f6f02 commit b4f2821
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/ts/wysiwyg/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
hasClosestByAttribute,
hasClosestByClassName,
hasClosestByMatchTag,
hasClosestByTag,
hasClosestByTag, hasTopClosestByTag,
} from "../util/hasClosest";
import {log} from "../util/log";
import {processPasteCode} from "../util/processPasteCode";
Expand Down Expand Up @@ -381,6 +381,20 @@ class WYSIWYG {
return;
}

// https://github.com/Vanessa219/vditor/issues/51
const topBQElement = hasTopClosestByTag(range.startContainer, 'BLOCKQUOTE')
if (topBQElement) {
range.setStartAfter(topBQElement);
setSelectionFocus(range);
const node = document.createElement("p");
node.setAttribute("data-block", "0");
node.innerHTML = "\n";
range.insertNode(node);
range.collapse(true);
setSelectionFocus(range);
highlightToolbar(vditor);
afterRenderEvent(vditor);
}
}
scrollCenter(this.element);
});
Expand Down

0 comments on commit b4f2821

Please sign in to comment.