From c2f6339213e3fa27aef38eacd0d63d0ce33878fa Mon Sep 17 00:00:00 2001 From: JiHong88 <0125ses@hanmail.net> Date: Fri, 8 Apr 2022 02:11:00 +0900 Subject: [PATCH] fix: #961 cursor position when add a list --- src/lib/core.js | 2 +- src/plugins/submenu/list.js | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/lib/core.js b/src/lib/core.js index 6d3c64eb8..c90829ce0 100755 --- a/src/lib/core.js +++ b/src/lib/core.js @@ -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'); } diff --git a/src/plugins/submenu/list.js b/src/plugins/submenu/list.js index 632a95934..8c6a8e441 100644 --- a/src/plugins/submenu/list.js +++ b/src/plugins/submenu/list.js @@ -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 = '
';