fix: #706 combine lists of different type (#716)

This commit is contained in:
Ran Luo 2019-03-04 04:05:39 +08:00 committed by Felix Häusler
parent 4278362f82
commit 240d64aa55

View File

@ -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