@hailin-zheng/editor-core 1.1.29 → 1.1.31
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 +24 -24
- package/index-cjs.js.map +1 -1
- package/index.js +24 -24
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index-cjs.js
CHANGED
@@ -702,13 +702,14 @@ function appendToOps(doc, ele, ops) {
|
|
702
702
|
docOpsMap.set(doc, array = []);
|
703
703
|
}
|
704
704
|
const prevEle = ElementUtil.getPrevSiblingElement(ele);
|
705
|
-
|
705
|
+
const log = {
|
706
706
|
index: ElementUtil.getControlIndex(ele, true),
|
707
707
|
parentIndex: ElementUtil.getControlIndex(ele.parent, true),
|
708
708
|
prevIndex: prevEle ? ElementUtil.getControlIndex(prevEle, true) : -1,
|
709
709
|
ele,
|
710
710
|
ops
|
711
|
-
}
|
711
|
+
};
|
712
|
+
array.push(log);
|
712
713
|
}
|
713
714
|
function inputText(ele, startIndex, input) {
|
714
715
|
const options = getDocCtx(ele);
|
@@ -798,14 +799,15 @@ function generatePatch(doc) {
|
|
798
799
|
if (!ops || !ops.length) {
|
799
800
|
return [];
|
800
801
|
}
|
801
|
-
|
802
|
+
getDeleteEleOps(ops);
|
802
803
|
for (let i = 0; i < ops.length; i++) {
|
803
804
|
const op = ops[i];
|
804
805
|
const ele = op.ele;
|
805
806
|
//修改样式
|
806
807
|
if ('format' in op.ops) {
|
807
808
|
//修改插入或者删除的不做处理
|
808
|
-
|
809
|
+
//|| delOpsMap.has(ele)
|
810
|
+
if (insertOpsMap.has(ele)) {
|
809
811
|
continue;
|
810
812
|
}
|
811
813
|
//合并操作属性
|
@@ -3860,7 +3862,7 @@ class TableCellElement extends BlockContainerElement {
|
|
3860
3862
|
}
|
3861
3863
|
beginMeasure(data) {
|
3862
3864
|
//不被合并的单元格
|
3863
|
-
if (!this.length
|
3865
|
+
if (!this.length) {
|
3864
3866
|
this.addChild(data.createParaFn());
|
3865
3867
|
}
|
3866
3868
|
super.beginMeasure(data);
|
@@ -5134,7 +5136,7 @@ class TableUtil {
|
|
5134
5136
|
const hMergeEndIndex = this.getHMergeEndIndex(tb, i, colIndex);
|
5135
5137
|
if (hMergeEndIndex > colIndex) {
|
5136
5138
|
const nextCell = row.getChild(colIndex + 1);
|
5137
|
-
nextCell.props.hMerge = hMergeEndIndex - colIndex
|
5139
|
+
nextCell.props.hMerge = hMergeEndIndex - colIndex >= 2 ? 'restart' : null;
|
5138
5140
|
}
|
5139
5141
|
}
|
5140
5142
|
else if (cell.props.hMerge === 'continue') {
|
@@ -5142,8 +5144,8 @@ class TableUtil {
|
|
5142
5144
|
const hMergeEndIndex = this.getHMergeEndIndex(tb, i, colIndex);
|
5143
5145
|
//当前单元格处于合并行的最后一行,并且合并的行数为2行
|
5144
5146
|
if (hMergeEndIndex === colIndex && hMergeEndIndex - hMergeStartIndex === 1) {
|
5145
|
-
const
|
5146
|
-
|
5147
|
+
const masterHMergeCell = tb.getChild(i).getChild(hMergeStartIndex);
|
5148
|
+
masterHMergeCell.props.hMerge = null;
|
5147
5149
|
}
|
5148
5150
|
}
|
5149
5151
|
row.removeChild(cell);
|
@@ -14949,7 +14951,8 @@ class DocumentEvent {
|
|
14949
14951
|
if (!this.selectionState.cursorPos) {
|
14950
14952
|
return;
|
14951
14953
|
}
|
14952
|
-
let { x, y } = this.selectionState.cursorPos;
|
14954
|
+
let { x, y, height } = this.selectionState.cursorPos;
|
14955
|
+
y = y + (height / 2 * (up ? -1 : 1));
|
14953
14956
|
//y -= this.viewOptions.pageOffset.y;
|
14954
14957
|
for (let i = 0; i < 50; i++) {
|
14955
14958
|
const docEvent = new MouseElementEvent(this.docCtx);
|
@@ -15101,7 +15104,7 @@ class DocumentInput {
|
|
15101
15104
|
const evt = nodeEvt.sourceEvt;
|
15102
15105
|
const keyEvent = new KeyboradElementEvent(this.docCtx);
|
15103
15106
|
keyEvent.sourceEvent = evt;
|
15104
|
-
if (DocumentEvent.invokeEvent('ElementKeyDown', this.docCtx.selectionState.startControl, keyEvent, '
|
15107
|
+
if (DocumentEvent.invokeEvent('ElementKeyDown', this.docCtx.selectionState.startControl, keyEvent, 'All')) {
|
15105
15108
|
return;
|
15106
15109
|
}
|
15107
15110
|
if (evt.keyCode === 8) {
|
@@ -17336,28 +17339,25 @@ class ElementTrackManage {
|
|
17336
17339
|
}
|
17337
17340
|
}
|
17338
17341
|
restoreToInsert(index, parentIndex, prevIndex, data) {
|
17339
|
-
const prevSiblingEle = prevIndex !== -1 ? this.getControl(prevIndex) : null;
|
17342
|
+
const prevSiblingEle = prevIndex !== -1 ? this.getControl(prevIndex, true) : null;
|
17343
|
+
//const nextSiblingEle = prevSiblingEle ? prevSiblingEle.nextSibling : null;
|
17340
17344
|
//获取插入位置之前的元素,然后向后插入目标元素
|
17341
|
-
const ele = this.getControl(index - 1);
|
17345
|
+
//const ele = this.getControl(index - 1,true);
|
17346
|
+
const parent = this.getControl(parentIndex, true);
|
17342
17347
|
const target = data.clone(true);
|
17343
17348
|
if (prevSiblingEle) {
|
17344
17349
|
prevSiblingEle.parent.addChild(target, prevSiblingEle.getIndex() + 1);
|
17345
17350
|
}
|
17346
17351
|
else {
|
17347
|
-
|
17348
|
-
|
17349
|
-
|
17350
|
-
if (ele.type === 'tbc' && ele.getChildLength() === 2) {
|
17351
|
-
ele.clearItems();
|
17352
|
-
}
|
17353
|
-
ele.addChild(target, 0);
|
17354
|
-
return;
|
17355
|
-
}
|
17356
|
-
else {
|
17357
|
-
throw new Error('父级类型不正确');
|
17352
|
+
if (parent instanceof BranchElement) {
|
17353
|
+
if (parent.type === 'tbc' && parent.getChildLength() === 2) {
|
17354
|
+
parent.clearItems();
|
17358
17355
|
}
|
17356
|
+
parent.addChild(target, 0);
|
17357
|
+
}
|
17358
|
+
else {
|
17359
|
+
throw new Error('父级类型不正确');
|
17359
17360
|
}
|
17360
|
-
ele.parent.addChild(target, ele.getIndex() + 1);
|
17361
17361
|
}
|
17362
17362
|
}
|
17363
17363
|
/**
|