From 22a174458d41944a979c60e772031b76f63699ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=A5=98=EC=84=A0=EC=9E=84?= Date: Thu, 11 Jun 2020 11:51:32 +0900 Subject: [PATCH] fix: occurs script error when pasting code block in wysiwyg (fix #693, #939) (#1041) --- apps/editor/src/js/wwClipboardManager.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/editor/src/js/wwClipboardManager.js b/apps/editor/src/js/wwClipboardManager.js index 39b13924b0..ca8259d7fd 100644 --- a/apps/editor/src/js/wwClipboardManager.js +++ b/apps/editor/src/js/wwClipboardManager.js @@ -160,6 +160,9 @@ class WwClipboardManager { pasteData.fragment = document.createDocumentFragment(); toArray(clipboardContainer.childNodes).forEach(element => { + if (domUtils.getNodeName(element) === 'DIV') { + this._replaceNewLineToBr(element); + } pasteData.fragment.appendChild(element); }); @@ -283,7 +286,6 @@ class WwClipboardManager { this._preProcessPtag(clipboardContainer); } - this._replaceNewLineToBr(clipboardContainer); this._removeEmptyFontElement(clipboardContainer); this._pch.preparePaste(clipboardContainer);