@hailin-zheng/editor-core 1.1.7 → 1.1.9
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.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();
|
@@ -11319,6 +11329,10 @@ class ParagraphMeasure {
|
|
11319
11329
|
}
|
11320
11330
|
else if (paraElement.props.textAlign === 'justify') {
|
11321
11331
|
const renderUnitCount = this.getRenderUnitLength(paraLineRender.line);
|
11332
|
+
if (paraLineIndex === counter - 1 || renderUnitCount === 1) {
|
11333
|
+
return;
|
11334
|
+
//return indent;
|
11335
|
+
}
|
11322
11336
|
const spaceWidth = (limitWidth - paraLineRender.line.rect.width) / (renderUnitCount - 1);
|
11323
11337
|
this.setAlignJustify(paraLineRender.line, 0, spaceWidth);
|
11324
11338
|
//return indent;
|
@@ -15836,12 +15850,14 @@ class DocumentChange {
|
|
15836
15850
|
}
|
15837
15851
|
/**
|
15838
15852
|
* 根据开始位置和结束位置,将字符切割成指定的区间
|
15839
|
-
* @param
|
15853
|
+
* @param text
|
15840
15854
|
* @param start
|
15841
15855
|
* @param end
|
15842
15856
|
* @returns
|
15843
15857
|
*/
|
15844
15858
|
static splitTextGroupByRange(text, start, end) {
|
15859
|
+
start = Math.floor(start);
|
15860
|
+
end = Math.floor(end);
|
15845
15861
|
end = end === -1 ? text.textMeasures.length : end;
|
15846
15862
|
if (start === end) {
|
15847
15863
|
return null;
|