|
|
|
@ -1,6 +1,6 @@
|
|
|
|
import { IEditorOption, IElement, RowFlex } from '..'
|
|
|
|
import { IEditorOption, IElement, RowFlex } from '..'
|
|
|
|
import { ZERO } from '../dataset/constant/Common'
|
|
|
|
import { ZERO } from '../dataset/constant/Common'
|
|
|
|
import { TEXTLIKE_ELEMENT_TYPE } from '../dataset/constant/Element'
|
|
|
|
import { INLINE_NODE_NAME, TEXTLIKE_ELEMENT_TYPE } from '../dataset/constant/Element'
|
|
|
|
import { titleNodeNameMapping, titleOrderNumberMapping } from '../dataset/constant/Title'
|
|
|
|
import { titleNodeNameMapping, titleOrderNumberMapping } from '../dataset/constant/Title'
|
|
|
|
import { ControlComponent } from '../dataset/enum/Control'
|
|
|
|
import { ControlComponent } from '../dataset/enum/Control'
|
|
|
|
import { ElementType } from '../dataset/enum/Element'
|
|
|
|
import { ElementType } from '../dataset/enum/Element'
|
|
|
|
@ -81,7 +81,8 @@ export function writeElementList(elementList: IElement[], options: DeepRequired<
|
|
|
|
const td = tr.tdList[d]
|
|
|
|
const td = tr.tdList[d]
|
|
|
|
tdDom.colSpan = td.colspan
|
|
|
|
tdDom.colSpan = td.colspan
|
|
|
|
tdDom.rowSpan = td.rowspan
|
|
|
|
tdDom.rowSpan = td.rowspan
|
|
|
|
tdDom.innerText = td.value[0]?.value || ''
|
|
|
|
const childDom = buildDomFromElementList(zipElementList(td.value!))
|
|
|
|
|
|
|
|
tdDom.innerHTML = childDom.innerHTML
|
|
|
|
trDom.append(tdDom)
|
|
|
|
trDom.append(tdDom)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
tableDom.append(trDom)
|
|
|
|
tableDom.append(trDom)
|
|
|
|
@ -212,9 +213,11 @@ export function getElementListByHTML(htmlText: string, options: IGetElementListB
|
|
|
|
level: titleNodeNameMapping[node.nodeName],
|
|
|
|
level: titleNodeNameMapping[node.nodeName],
|
|
|
|
valueList
|
|
|
|
valueList
|
|
|
|
})
|
|
|
|
})
|
|
|
|
elementList.push({
|
|
|
|
if (node.nextSibling && !INLINE_NODE_NAME.includes(node.nextSibling.nodeName)) {
|
|
|
|
value: '\n'
|
|
|
|
elementList.push({
|
|
|
|
})
|
|
|
|
value: '\n'
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
} else if (node.nodeName === 'HR') {
|
|
|
|
} else if (node.nodeName === 'HR') {
|
|
|
|
elementList.push({
|
|
|
|
elementList.push({
|
|
|
|
value: '\n',
|
|
|
|
value: '\n',
|
|
|
|
@ -247,12 +250,11 @@ export function getElementListByHTML(htmlText: string, options: IGetElementListB
|
|
|
|
}
|
|
|
|
}
|
|
|
|
trElement.querySelectorAll('th,td').forEach(tdElement => {
|
|
|
|
trElement.querySelectorAll('th,td').forEach(tdElement => {
|
|
|
|
const tableCell = <HTMLTableCellElement>tdElement
|
|
|
|
const tableCell = <HTMLTableCellElement>tdElement
|
|
|
|
|
|
|
|
const valueList = getElementListByHTML(tableCell.innerHTML, options)
|
|
|
|
const td: ITd = {
|
|
|
|
const td: ITd = {
|
|
|
|
colspan: tableCell.colSpan,
|
|
|
|
colspan: tableCell.colSpan,
|
|
|
|
rowspan: tableCell.rowSpan,
|
|
|
|
rowspan: tableCell.rowSpan,
|
|
|
|
value: [{
|
|
|
|
value: valueList
|
|
|
|
value: tableCell.innerText
|
|
|
|
|
|
|
|
}]
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
tr.tdList.push(td)
|
|
|
|
tr.tdList.push(td)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|