From c53708b2456435e53b200e708687d8fcb115ab27 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Fri, 2 Aug 2019 16:36:09 +0200 Subject: [PATCH] set lastNode directly when not decending --- src/editor/deserialize.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/editor/deserialize.js b/src/editor/deserialize.js index 8fefecb885..e8fd8fb888 100644 --- a/src/editor/deserialize.js +++ b/src/editor/deserialize.js @@ -192,8 +192,11 @@ function parseHtmlMessage(html, partCreator) { if (lastNode && lastNode.nodeName === "BLOCKQUOTE") { parts.push(partCreator.newline()); } - lastNode = null; - return checkDecendInto(n); + const decend = checkDecendInto(n); + // when not decending (like for PRE), onNodeLeave won't be called to set lastNode + // so do that here. + lastNode = decend ? null : n; + return decend; } function onNodeLeave(n) {