From 240d64aa55cfab613f82c2eb95cd4cce176d0a07 Mon Sep 17 00:00:00 2001 From: Ran Luo Date: Mon, 4 Mar 2019 04:05:39 +0800 Subject: [PATCH] fix: #706 combine lists of different type (#716) --- src/muya/lib/contentState/pasteCtrl.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/muya/lib/contentState/pasteCtrl.js b/src/muya/lib/contentState/pasteCtrl.js index 487053f6..439ac52e 100644 --- a/src/muya/lib/contentState/pasteCtrl.js +++ b/src/muya/lib/contentState/pasteCtrl.js @@ -248,6 +248,17 @@ const pasteCtrl = ContentState => { const liChildren = firstListItem.children const originListItem = this.getParent(parent) const originList = this.getParent(originListItem) + const targetListType = firstFragment.children[0].isLooseListItem + const originListType = originList.children[0].isLooseListItem + // No matter copy loose list to tight list or vice versa, the result is one loose list. + if (targetListType !== originListType) { + if (!targetListType) { + firstFragment.children.forEach(item => item.isLooseListItem = true) + } else { + originList.children.forEach(item => item.isLooseListItem = true) + } + } + if (liChildren[0].type === 'p') { // TODO @JOCS startBlock.text += liChildren[0].children[0].text