|
|
|
@ -1,5 +1,5 @@
|
|
|
|
import { ZERO } from "../../dataset/constant/Common"
|
|
|
|
import { ZERO } from "../../dataset/constant/Common"
|
|
|
|
import { EDITOR_ELEMENT_STYLE } from "../../dataset/constant/Element"
|
|
|
|
import { EDITOR_ELEMENT_STYLE_ATTR } from "../../dataset/constant/Element"
|
|
|
|
import { EditorContext } from "../../dataset/enum/Editor"
|
|
|
|
import { EditorContext } from "../../dataset/enum/Editor"
|
|
|
|
import { ElementType } from "../../dataset/enum/Element"
|
|
|
|
import { ElementType } from "../../dataset/enum/Element"
|
|
|
|
import { ElementStyleKey } from "../../dataset/enum/ElementStyle"
|
|
|
|
import { ElementStyleKey } from "../../dataset/enum/ElementStyle"
|
|
|
|
@ -75,7 +75,7 @@ export class CommandAdapt {
|
|
|
|
if (!selection) return
|
|
|
|
if (!selection) return
|
|
|
|
const painterStyle: IElementStyle = {}
|
|
|
|
const painterStyle: IElementStyle = {}
|
|
|
|
selection.forEach(s => {
|
|
|
|
selection.forEach(s => {
|
|
|
|
const painterStyleKeys = EDITOR_ELEMENT_STYLE
|
|
|
|
const painterStyleKeys = EDITOR_ELEMENT_STYLE_ATTR
|
|
|
|
painterStyleKeys.forEach(p => {
|
|
|
|
painterStyleKeys.forEach(p => {
|
|
|
|
const key = p as keyof typeof ElementStyleKey
|
|
|
|
const key = p as keyof typeof ElementStyleKey
|
|
|
|
if (painterStyle[key] === undefined) {
|
|
|
|
if (painterStyle[key] === undefined) {
|
|
|
|
@ -757,11 +757,9 @@ export class CommandAdapt {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// 重新渲染
|
|
|
|
// 重新渲染
|
|
|
|
const { startIndex, endIndex } = this.range.getRange()
|
|
|
|
const curIndex = startTd.value.length - 1
|
|
|
|
this.range.setRange(startIndex, endIndex)
|
|
|
|
this.range.setRange(curIndex, curIndex)
|
|
|
|
this.draw.render({
|
|
|
|
this.draw.render()
|
|
|
|
curIndex: endIndex
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
const position = this.position.getOriginalPositionList()
|
|
|
|
const position = this.position.getOriginalPositionList()
|
|
|
|
this.tableTool.render(element, position[index!])
|
|
|
|
this.tableTool.render(element, position[index!])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -776,6 +774,7 @@ export class CommandAdapt {
|
|
|
|
const curTr = curTrList[trIndex!]!
|
|
|
|
const curTr = curTrList[trIndex!]!
|
|
|
|
const curTd = curTr.tdList[tdIndex!]
|
|
|
|
const curTd = curTr.tdList[tdIndex!]
|
|
|
|
if (curTd.rowspan === 1 && curTd.colspan === 1) return
|
|
|
|
if (curTd.rowspan === 1 && curTd.colspan === 1) return
|
|
|
|
|
|
|
|
const colspan = curTd.colspan
|
|
|
|
// 设置跨列
|
|
|
|
// 设置跨列
|
|
|
|
if (curTd.colspan > 1) {
|
|
|
|
if (curTd.colspan > 1) {
|
|
|
|
for (let c = 1; c < curTd.colspan; c++) {
|
|
|
|
for (let c = 1; c < curTd.colspan; c++) {
|
|
|
|
@ -797,30 +796,30 @@ export class CommandAdapt {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// 设置跨行
|
|
|
|
// 设置跨行
|
|
|
|
if (curTd.rowspan > 1) {
|
|
|
|
if (curTd.rowspan > 1) {
|
|
|
|
for (let c = 1; c < curTd.rowspan; c++) {
|
|
|
|
for (let r = 1; r < curTd.rowspan; r++) {
|
|
|
|
const tr = curTrList[trIndex! + c]
|
|
|
|
const tr = curTrList[trIndex! + r]
|
|
|
|
const tdId = getUUID()
|
|
|
|
for (let c = 0; c < colspan; c++) {
|
|
|
|
tr.tdList.splice(curTd.colIndex!, 0, {
|
|
|
|
const tdId = getUUID()
|
|
|
|
id: tdId,
|
|
|
|
tr.tdList.splice(curTd.colIndex!, 0, {
|
|
|
|
rowspan: 1,
|
|
|
|
id: tdId,
|
|
|
|
colspan: 1,
|
|
|
|
rowspan: 1,
|
|
|
|
value: [{
|
|
|
|
colspan: 1,
|
|
|
|
value: ZERO,
|
|
|
|
value: [{
|
|
|
|
size: 16,
|
|
|
|
value: ZERO,
|
|
|
|
tableId: element.id,
|
|
|
|
size: 16,
|
|
|
|
trId: tr.id,
|
|
|
|
tableId: element.id,
|
|
|
|
tdId
|
|
|
|
trId: tr.id,
|
|
|
|
}]
|
|
|
|
tdId
|
|
|
|
})
|
|
|
|
}]
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
curTd.rowspan = 1
|
|
|
|
curTd.rowspan = 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// 重新渲染
|
|
|
|
// 重新渲染
|
|
|
|
const { startIndex, endIndex } = this.range.getRange()
|
|
|
|
const curIndex = curTd.value.length - 1
|
|
|
|
this.range.setRange(startIndex, endIndex)
|
|
|
|
this.range.setRange(curIndex, curIndex)
|
|
|
|
this.draw.render({
|
|
|
|
this.draw.render()
|
|
|
|
curIndex: endIndex
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
const position = this.position.getOriginalPositionList()
|
|
|
|
const position = this.position.getOriginalPositionList()
|
|
|
|
this.tableTool.render(element, position[index!])
|
|
|
|
this.tableTool.render(element, position[index!])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|