Skip to content

Commit

Permalink
fix: #961 cursor position when add a list
Browse files Browse the repository at this point in the history
  • Loading branch information
JiHong88 committed Apr 7, 2022
1 parent 4071ac5 commit c2f6339
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -5945,7 +5945,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
}

/** default active buttons [strong, ins, em, del, sub, sup] */
if (classOnCheck.test(nodeName)) {
if (classOnCheck && classOnCheck.test(nodeName)) {
commandMapNodes.push(nodeName);
util.addClass(commandMap[nodeName], 'active');
}
Expand Down
8 changes: 8 additions & 0 deletions src/plugins/submenu/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,14 @@ export default {

newCell = util.createElement('LI');
util.copyFormatAttributes(newCell, fTag);

if (i === 0 && originRange.sc === fTag) {
originRange.sc = newCell;
}
if (i === len - 1 && originRange.ec === fTag) {
originRange.ec = newCell;
}

if (util.isComponent(fTag)) {
const isHR = /^HR$/i.test(fTag.nodeName);
if (!isHR) newCell.innerHTML = '<br>';
Expand Down

0 comments on commit c2f6339

Please sign in to comment.