@hailin-zheng/editor-core 1.1.29 → 1.1.30
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 +23 -20
- package/index-cjs.js.map +1 -1
- package/index.js +23 -20
- package/index.js.map +1 -1
- package/med_editor/framework/element-trace-tracking.d.ts +1 -0
- package/package.json +1 -1
package/index-cjs.js
CHANGED
@@ -702,13 +702,18 @@ 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
|
+
if (log.prevIndex === -1) {
|
713
|
+
const nextEle = ElementUtil.getNextSiblingElement(ele);
|
714
|
+
log.nextIndex = nextEle ? ElementUtil.getControlIndex(nextEle, true) : -1;
|
715
|
+
}
|
716
|
+
array.push(log);
|
712
717
|
}
|
713
718
|
function inputText(ele, startIndex, input) {
|
714
719
|
const options = getDocCtx(ele);
|
@@ -3860,7 +3865,7 @@ class TableCellElement extends BlockContainerElement {
|
|
3860
3865
|
}
|
3861
3866
|
beginMeasure(data) {
|
3862
3867
|
//不被合并的单元格
|
3863
|
-
if (!this.length
|
3868
|
+
if (!this.length) {
|
3864
3869
|
this.addChild(data.createParaFn());
|
3865
3870
|
}
|
3866
3871
|
super.beginMeasure(data);
|
@@ -5134,7 +5139,7 @@ class TableUtil {
|
|
5134
5139
|
const hMergeEndIndex = this.getHMergeEndIndex(tb, i, colIndex);
|
5135
5140
|
if (hMergeEndIndex > colIndex) {
|
5136
5141
|
const nextCell = row.getChild(colIndex + 1);
|
5137
|
-
nextCell.props.hMerge = hMergeEndIndex - colIndex
|
5142
|
+
nextCell.props.hMerge = hMergeEndIndex - colIndex >= 2 ? 'restart' : null;
|
5138
5143
|
}
|
5139
5144
|
}
|
5140
5145
|
else if (cell.props.hMerge === 'continue') {
|
@@ -14949,7 +14954,8 @@ class DocumentEvent {
|
|
14949
14954
|
if (!this.selectionState.cursorPos) {
|
14950
14955
|
return;
|
14951
14956
|
}
|
14952
|
-
let { x, y } = this.selectionState.cursorPos;
|
14957
|
+
let { x, y, height } = this.selectionState.cursorPos;
|
14958
|
+
y = y + (height / 2 * (up ? -1 : 1));
|
14953
14959
|
//y -= this.viewOptions.pageOffset.y;
|
14954
14960
|
for (let i = 0; i < 50; i++) {
|
14955
14961
|
const docEvent = new MouseElementEvent(this.docCtx);
|
@@ -15101,7 +15107,7 @@ class DocumentInput {
|
|
15101
15107
|
const evt = nodeEvt.sourceEvt;
|
15102
15108
|
const keyEvent = new KeyboradElementEvent(this.docCtx);
|
15103
15109
|
keyEvent.sourceEvent = evt;
|
15104
|
-
if (DocumentEvent.invokeEvent('ElementKeyDown', this.docCtx.selectionState.startControl, keyEvent, '
|
15110
|
+
if (DocumentEvent.invokeEvent('ElementKeyDown', this.docCtx.selectionState.startControl, keyEvent, 'All')) {
|
15105
15111
|
return;
|
15106
15112
|
}
|
15107
15113
|
if (evt.keyCode === 8) {
|
@@ -17336,28 +17342,25 @@ class ElementTrackManage {
|
|
17336
17342
|
}
|
17337
17343
|
}
|
17338
17344
|
restoreToInsert(index, parentIndex, prevIndex, data) {
|
17339
|
-
const prevSiblingEle = prevIndex !== -1 ? this.getControl(prevIndex) : null;
|
17345
|
+
const prevSiblingEle = prevIndex !== -1 ? this.getControl(prevIndex, true) : null;
|
17346
|
+
//const nextSiblingEle = prevSiblingEle ? prevSiblingEle.nextSibling : null;
|
17340
17347
|
//获取插入位置之前的元素,然后向后插入目标元素
|
17341
|
-
const ele = this.getControl(index - 1);
|
17348
|
+
//const ele = this.getControl(index - 1,true);
|
17349
|
+
const parent = this.getControl(parentIndex, true);
|
17342
17350
|
const target = data.clone(true);
|
17343
17351
|
if (prevSiblingEle) {
|
17344
17352
|
prevSiblingEle.parent.addChild(target, prevSiblingEle.getIndex() + 1);
|
17345
17353
|
}
|
17346
17354
|
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('父级类型不正确');
|
17355
|
+
if (parent instanceof BranchElement) {
|
17356
|
+
if (parent.type === 'tbc' && parent.getChildLength() === 2) {
|
17357
|
+
parent.clearItems();
|
17358
17358
|
}
|
17359
|
+
parent.addChild(target, 0);
|
17360
|
+
}
|
17361
|
+
else {
|
17362
|
+
throw new Error('父级类型不正确');
|
17359
17363
|
}
|
17360
|
-
ele.parent.addChild(target, ele.getIndex() + 1);
|
17361
17364
|
}
|
17362
17365
|
}
|
17363
17366
|
/**
|