From 8c7258453561b532b95a92079ffbcab288218de8 Mon Sep 17 00:00:00 2001 From: Yi JiHong <0125ses@hanmail.net> Date: Tue, 28 May 2024 22:46:37 +0900 Subject: [PATCH] Fix: _setDefaultFormat #1401 --- sample/html/options.html | 4 ++-- src/lib/core.js | 14 ++++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/sample/html/options.html b/sample/html/options.html index 289e90a4..8f9855c3 100644 --- a/sample/html/options.html +++ b/sample/html/options.html @@ -68,7 +68,7 @@

--Value

-

+



@@ -609,7 +609,7 @@

Applied options

imageTable.innerHTML = ''; var options = { - strictMode: document.getElementById('strictMode').checked ? true : undefined, + strictMode: document.getElementById('strictMode').checked ? undefined : false, defaultTag: document.getElementById('defaultTag').checked ? document.getElementById('defaultTag_value').value : undefined, textTags: document.getElementById('textTags').checked ? { bold: 'b', diff --git a/src/lib/core.js b/src/lib/core.js index dbbe24b6..dbe2db21 100755 --- a/src/lib/core.js +++ b/src/lib/core.js @@ -6261,12 +6261,14 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re this._editorRange(); } - if (util.isBreak(format.nextSibling)) util.removeItem(format.nextSibling); - if (util.isBreak(format.previousSibling)) util.removeItem(format.previousSibling); - if (util.isBreak(focusNode)) { - const zeroWidth = util.createTextNode(util.zeroWidthSpace); - focusNode.parentNode.insertBefore(zeroWidth, focusNode); - focusNode = zeroWidth; + if (format) { + if (util.isBreak(format.nextSibling)) util.removeItem(format.nextSibling); + if (util.isBreak(format.previousSibling)) util.removeItem(format.previousSibling); + if (util.isBreak(focusNode)) { + const zeroWidth = util.createTextNode(util.zeroWidthSpace); + focusNode.parentNode.insertBefore(zeroWidth, focusNode); + focusNode = zeroWidth; + } } this.effectNode = null;