From fb6cf4425c7d431cfe70944ce70fb0efcb51ef24 Mon Sep 17 00:00:00 2001 From: sairaj mote Date: Thu, 24 Mar 2022 17:16:11 +0530 Subject: [PATCH] bug fixes --- index.html | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/index.html b/index.html index c88ff57..599d44e 100644 --- a/index.html +++ b/index.html @@ -1823,6 +1823,13 @@ const sectionID = parentSection.dataset.sectionId const plainText = contentArea.innerText.trim() if (plainText === '') return + if (contentArea.firstChild.nodeType === Node.TEXT_NODE) { + const clone = contentArea.firstChild.cloneNode(true) + const p = createElement('p') + p.append(clone) + contentArea.firstChild.remove() + contentArea.prepend(p) + } const cleanHTML = DOMPurify.sanitize(contentArea.innerHTML.split('\n').map(v => v.trim()).filter(v => v).join('\n'), { FORBID_ATTR: ['style'] }) const hash = Crypto.SHA256(cleanHTML) let previousVersion, previousHash