From feddc436db2aa91570d397dc8f8733ab75ec3c07 Mon Sep 17 00:00:00 2001 From: Wenzel Jonas Date: Wed, 15 Nov 2023 13:41:26 +0100 Subject: [PATCH] Fix issue #1312 TypeError: Cannot read properties of null (reading 'previousElementSibling') --- src/lib/core.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/core.js b/src/lib/core.js index 0bdc4547..af857b54 100755 --- a/src/lib/core.js +++ b/src/lib/core.js @@ -2143,7 +2143,9 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re let endNextEl = null; if (isStartEdge) { startPrevEl = util.getFormatElement(range.startContainer); - prevContainer = startPrevEl.previousElementSibling; + if (startPrevEl) { + prevContainer = startPrevEl.previousElementSibling; + } startPrevEl = startPrevEl ? prevContainer : startPrevEl; } if (isEndEdge) {