Skip to content

Commit

Permalink
fix: enter key style bug
Browse files Browse the repository at this point in the history
  • Loading branch information
JiHong88 committed May 30, 2023
1 parent 8ad79ba commit 1693c0d
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/lib/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -7475,10 +7475,19 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
e.preventDefault();
const focusBR = util.createElement('BR');
const newFormat = util.createElement(formatEl.nodeName);
newFormat.appendChild(focusBR);

util.copyTagAttributes(newFormat, formatEl, options.lineAttrReset);

let child = focusBR;
do {
if (selectionNode.nodeType === 1) {
const f = selectionNode.cloneNode(false)
f.appendChild(child);
child = f;
}
selectionNode = selectionNode.parentNode;
} while(formatEl !== selectionNode && formatEl.contains(selectionNode))

newFormat.appendChild(child);
formatEl.parentNode.insertBefore(newFormat, formatStartEdge ? formatEl : formatEl.nextElementSibling);
if (formatEndEdge) {
core.setRange(focusBR, 1, focusBR, 1);
Expand Down

0 comments on commit 1693c0d

Please sign in to comment.