@hailin-zheng/editor-core 1.1.7 → 1.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index-cjs.js +18 -8
- package/index-cjs.js.map +1 -1
- package/index.js +18 -8
- package/index.js.map +1 -1
- package/med_editor/framework/impl/table/table-util.d.ts +7 -0
- package/package.json +1 -1
package/index.js
CHANGED
@@ -4288,6 +4288,13 @@ class TableUtil {
|
|
4288
4288
|
currCell.props.vMerge = i === tbRegion.startRow ? 'restart' : 'continue';
|
4289
4289
|
currCell.props.hMerge = 'restart';
|
4290
4290
|
}
|
4291
|
+
//选择的行数一行,此时纵向合并不需要设置
|
4292
|
+
if (tbRegion.endRow === tbRegion.startRow) {
|
4293
|
+
currCell.props.vMerge = null;
|
4294
|
+
}
|
4295
|
+
if (tbRegion.startCol === tbRegion.endCol) {
|
4296
|
+
currCell.props.hMerge = null;
|
4297
|
+
}
|
4291
4298
|
if (currCell !== startCell) {
|
4292
4299
|
cellContents.push(...ElementUtil.getChildrenElements(currCell));
|
4293
4300
|
currCell.clearItems();
|
@@ -4427,6 +4434,13 @@ class TableUtil {
|
|
4427
4434
|
tb.pubOnChange('self');
|
4428
4435
|
tb.refreshView();
|
4429
4436
|
}
|
4437
|
+
/**
|
4438
|
+
* 在指定位置插入行
|
4439
|
+
* 动作:在指定行上方或者下方插入行
|
4440
|
+
* 原则:插入的行单元格尽量不纵向合并
|
4441
|
+
* @param ss
|
4442
|
+
* @param insertRowIndex
|
4443
|
+
*/
|
4430
4444
|
static insertRow(ss, insertRowIndex) {
|
4431
4445
|
const startCell = ElementUtil.getParentByType(ss.startControl, TableCellElement);
|
4432
4446
|
if (!startCell?.parent) {
|
@@ -4434,7 +4448,7 @@ class TableUtil {
|
|
4434
4448
|
}
|
4435
4449
|
const startRow = startCell.parent;
|
4436
4450
|
const tb = startRow.parent;
|
4437
|
-
|
4451
|
+
startRow.getIndex();
|
4438
4452
|
insertRowIndex = insertRowIndex < 0 ? 0 : insertRowIndex;
|
4439
4453
|
insertRowIndex = insertRowIndex > tb.length ? tb.length : insertRowIndex;
|
4440
4454
|
const newRow = TableRowElement.createRow(tb.getColsCount());
|
@@ -4452,16 +4466,12 @@ class TableUtil {
|
|
4452
4466
|
if (destCell.props.vMerge === 'continue') {
|
4453
4467
|
//获取合并列的最后的行索引
|
4454
4468
|
const vMergeEndRowIndex = this.getVMergeEndIndex(tb, insertRowIndex, i);
|
4455
|
-
|
4469
|
+
//当前单元格处于纵向合并的单元格之中
|
4470
|
+
if (vMergeEndRowIndex >= insertRowIndex) {
|
4456
4471
|
newCell.props.vMerge = 'continue';
|
4457
|
-
//newCell.cellProps.hMerge = destCell.cellProps.hMerge;
|
4458
4472
|
}
|
4459
4473
|
}
|
4460
|
-
|
4461
|
-
//在上方新增行,目标行单元格属于合并的起点
|
4462
|
-
newCell.props.vMerge = 'continue';
|
4463
|
-
//newCell.cellProps.hMerge = destCell.cellProps.hMerge;
|
4464
|
-
}
|
4474
|
+
newCell.props.hMerge = destCell.props.hMerge;
|
4465
4475
|
}
|
4466
4476
|
tb.addChild(newRow, insertRowIndex);
|
4467
4477
|
tb.refreshView();
|