@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.js
CHANGED
@@ -673,13 +673,14 @@ function appendToOps(doc, ele, ops) {
|
|
673
673
|
docOpsMap.set(doc, array = []);
|
674
674
|
}
|
675
675
|
const prevEle = ElementUtil.getPrevSiblingElement(ele);
|
676
|
-
|
676
|
+
const log = {
|
677
677
|
index: ElementUtil.getControlIndex(ele, true),
|
678
678
|
parentIndex: ElementUtil.getControlIndex(ele.parent, true),
|
679
679
|
prevIndex: prevEle ? ElementUtil.getControlIndex(prevEle, true) : -1,
|
680
680
|
ele,
|
681
681
|
ops
|
682
|
-
}
|
682
|
+
};
|
683
|
+
array.push(log);
|
683
684
|
}
|
684
685
|
function inputText(ele, startIndex, input) {
|
685
686
|
const options = getDocCtx(ele);
|
@@ -769,14 +770,15 @@ function generatePatch(doc) {
|
|
769
770
|
if (!ops || !ops.length) {
|
770
771
|
return [];
|
771
772
|
}
|
772
|
-
|
773
|
+
getDeleteEleOps(ops);
|
773
774
|
for (let i = 0; i < ops.length; i++) {
|
774
775
|
const op = ops[i];
|
775
776
|
const ele = op.ele;
|
776
777
|
//修改样式
|
777
778
|
if ('format' in op.ops) {
|
778
779
|
//修改插入或者删除的不做处理
|
779
|
-
|
780
|
+
//|| delOpsMap.has(ele)
|
781
|
+
if (insertOpsMap.has(ele)) {
|
780
782
|
continue;
|
781
783
|
}
|
782
784
|
//合并操作属性
|
@@ -3831,7 +3833,7 @@ class TableCellElement extends BlockContainerElement {
|
|
3831
3833
|
}
|
3832
3834
|
beginMeasure(data) {
|
3833
3835
|
//不被合并的单元格
|
3834
|
-
if (!this.length
|
3836
|
+
if (!this.length) {
|
3835
3837
|
this.addChild(data.createParaFn());
|
3836
3838
|
}
|
3837
3839
|
super.beginMeasure(data);
|
@@ -5105,7 +5107,7 @@ class TableUtil {
|
|
5105
5107
|
const hMergeEndIndex = this.getHMergeEndIndex(tb, i, colIndex);
|
5106
5108
|
if (hMergeEndIndex > colIndex) {
|
5107
5109
|
const nextCell = row.getChild(colIndex + 1);
|
5108
|
-
nextCell.props.hMerge = hMergeEndIndex - colIndex
|
5110
|
+
nextCell.props.hMerge = hMergeEndIndex - colIndex >= 2 ? 'restart' : null;
|
5109
5111
|
}
|
5110
5112
|
}
|
5111
5113
|
else if (cell.props.hMerge === 'continue') {
|
@@ -5113,8 +5115,8 @@ class TableUtil {
|
|
5113
5115
|
const hMergeEndIndex = this.getHMergeEndIndex(tb, i, colIndex);
|
5114
5116
|
//当前单元格处于合并行的最后一行,并且合并的行数为2行
|
5115
5117
|
if (hMergeEndIndex === colIndex && hMergeEndIndex - hMergeStartIndex === 1) {
|
5116
|
-
const
|
5117
|
-
|
5118
|
+
const masterHMergeCell = tb.getChild(i).getChild(hMergeStartIndex);
|
5119
|
+
masterHMergeCell.props.hMerge = null;
|
5118
5120
|
}
|
5119
5121
|
}
|
5120
5122
|
row.removeChild(cell);
|
@@ -14920,7 +14922,8 @@ class DocumentEvent {
|
|
14920
14922
|
if (!this.selectionState.cursorPos) {
|
14921
14923
|
return;
|
14922
14924
|
}
|
14923
|
-
let { x, y } = this.selectionState.cursorPos;
|
14925
|
+
let { x, y, height } = this.selectionState.cursorPos;
|
14926
|
+
y = y + (height / 2 * (up ? -1 : 1));
|
14924
14927
|
//y -= this.viewOptions.pageOffset.y;
|
14925
14928
|
for (let i = 0; i < 50; i++) {
|
14926
14929
|
const docEvent = new MouseElementEvent(this.docCtx);
|
@@ -15072,7 +15075,7 @@ class DocumentInput {
|
|
15072
15075
|
const evt = nodeEvt.sourceEvt;
|
15073
15076
|
const keyEvent = new KeyboradElementEvent(this.docCtx);
|
15074
15077
|
keyEvent.sourceEvent = evt;
|
15075
|
-
if (DocumentEvent.invokeEvent('ElementKeyDown', this.docCtx.selectionState.startControl, keyEvent, '
|
15078
|
+
if (DocumentEvent.invokeEvent('ElementKeyDown', this.docCtx.selectionState.startControl, keyEvent, 'All')) {
|
15076
15079
|
return;
|
15077
15080
|
}
|
15078
15081
|
if (evt.keyCode === 8) {
|
@@ -17307,28 +17310,25 @@ class ElementTrackManage {
|
|
17307
17310
|
}
|
17308
17311
|
}
|
17309
17312
|
restoreToInsert(index, parentIndex, prevIndex, data) {
|
17310
|
-
const prevSiblingEle = prevIndex !== -1 ? this.getControl(prevIndex) : null;
|
17313
|
+
const prevSiblingEle = prevIndex !== -1 ? this.getControl(prevIndex, true) : null;
|
17314
|
+
//const nextSiblingEle = prevSiblingEle ? prevSiblingEle.nextSibling : null;
|
17311
17315
|
//获取插入位置之前的元素,然后向后插入目标元素
|
17312
|
-
const ele = this.getControl(index - 1);
|
17316
|
+
//const ele = this.getControl(index - 1,true);
|
17317
|
+
const parent = this.getControl(parentIndex, true);
|
17313
17318
|
const target = data.clone(true);
|
17314
17319
|
if (prevSiblingEle) {
|
17315
17320
|
prevSiblingEle.parent.addChild(target, prevSiblingEle.getIndex() + 1);
|
17316
17321
|
}
|
17317
17322
|
else {
|
17318
|
-
|
17319
|
-
|
17320
|
-
|
17321
|
-
if (ele.type === 'tbc' && ele.getChildLength() === 2) {
|
17322
|
-
ele.clearItems();
|
17323
|
-
}
|
17324
|
-
ele.addChild(target, 0);
|
17325
|
-
return;
|
17326
|
-
}
|
17327
|
-
else {
|
17328
|
-
throw new Error('父级类型不正确');
|
17323
|
+
if (parent instanceof BranchElement) {
|
17324
|
+
if (parent.type === 'tbc' && parent.getChildLength() === 2) {
|
17325
|
+
parent.clearItems();
|
17329
17326
|
}
|
17327
|
+
parent.addChild(target, 0);
|
17328
|
+
}
|
17329
|
+
else {
|
17330
|
+
throw new Error('父级类型不正确');
|
17330
17331
|
}
|
17331
|
-
ele.parent.addChild(target, ele.getIndex() + 1);
|
17332
17332
|
}
|
17333
17333
|
}
|
17334
17334
|
/**
|