@hailin-zheng/editor-core 2.0.38 → 2.0.40
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 +40 -18
- package/index-cjs.js.map +1 -1
- package/index.js +40 -18
- package/index.js.map +1 -1
- package/med_editor/framework/element-util.d.ts +6 -0
- package/package.json +1 -1
package/index-cjs.js
CHANGED
@@ -3900,7 +3900,7 @@ function drawDecorator(e, r) {
|
|
3900
3900
|
}
|
3901
3901
|
function exportDecoratorHTML(event, r) {
|
3902
3902
|
const canPaint = r.element.isMouseenter || r.element.isFocused;
|
3903
|
-
if (canPaint
|
3903
|
+
if (canPaint) {
|
3904
3904
|
const strokeColor = '#0050b3';
|
3905
3905
|
const verOffset = 0;
|
3906
3906
|
const renderPosMap = getCurrentParaGroupRenders(r).map(item => ({ pos: getRenderPosToDoc(item), render: item }));
|
@@ -12514,6 +12514,17 @@ class ElementUtil {
|
|
12514
12514
|
offset = offset === -1 ? 1 : offset;
|
12515
12515
|
return offset;
|
12516
12516
|
}
|
12517
|
+
/**
|
12518
|
+
* 设置光标在数据元内容末尾
|
12519
|
+
*/
|
12520
|
+
static setDataElemEndFocus(ss, ele) {
|
12521
|
+
if (ele.length === 2) {
|
12522
|
+
ss.resetRange(ele.getChild(0), 1);
|
12523
|
+
}
|
12524
|
+
else {
|
12525
|
+
ss.resetRange(ele.getChild(ele.length - 2), -1);
|
12526
|
+
}
|
12527
|
+
}
|
12517
12528
|
}
|
12518
12529
|
|
12519
12530
|
class RenderContext {
|
@@ -14717,9 +14728,9 @@ class DocumentArrange {
|
|
14717
14728
|
blockLine = children[++j];
|
14718
14729
|
}
|
14719
14730
|
}
|
14720
|
-
|
14721
|
-
|
14722
|
-
|
14731
|
+
if (cloneRender.length === 0 && sumHeight === 0) {
|
14732
|
+
return null;
|
14733
|
+
}
|
14723
14734
|
ElementUtil.remeasure(cloneRender);
|
14724
14735
|
ElementUtil.remeasure(render);
|
14725
14736
|
if (cloneRender.length === 0) {
|
@@ -14776,7 +14787,7 @@ class DocumentArrange {
|
|
14776
14787
|
if (cutRow) {
|
14777
14788
|
cloneTbRender.addChild(cutRow);
|
14778
14789
|
sumHeight += cutRow.rect.height;
|
14779
|
-
if (currRow.getItems().
|
14790
|
+
if (currRow.getItems().some(item => item.length !== 0)) {
|
14780
14791
|
cutRows.push(currRow);
|
14781
14792
|
}
|
14782
14793
|
else {
|
@@ -18793,6 +18804,7 @@ class DocumentChange {
|
|
18793
18804
|
if (!selectedRange) {
|
18794
18805
|
throw new Error('selectionRange is null');
|
18795
18806
|
}
|
18807
|
+
this.selectionState.clear();
|
18796
18808
|
//用于刷新后定位光标
|
18797
18809
|
let startPointElement;
|
18798
18810
|
let startPointOffset = 0;
|
@@ -18842,8 +18854,13 @@ class DocumentChange {
|
|
18842
18854
|
else {
|
18843
18855
|
this.deleteRange(selectedRange);
|
18844
18856
|
}
|
18845
|
-
|
18846
|
-
|
18857
|
+
if (startPointElement) {
|
18858
|
+
//如果其他位置设置过选区对象,则以启动位置设置的选区为准
|
18859
|
+
if (!this.selectionState.range) {
|
18860
|
+
this.selectionState.resetRange(startPointElement, startPointOffset);
|
18861
|
+
}
|
18862
|
+
}
|
18863
|
+
//return {cursorEle: startPointElement, cursorOffset: startPointOffset};
|
18847
18864
|
}
|
18848
18865
|
/**
|
18849
18866
|
* backspace删除
|
@@ -18906,9 +18923,8 @@ class DocumentChange {
|
|
18906
18923
|
return;
|
18907
18924
|
}
|
18908
18925
|
if (control.isPrefix && this.viewOptions.docMode === exports.DocMode.FormEdit) {
|
18909
|
-
|
18910
|
-
|
18911
|
-
}
|
18926
|
+
this.selectionState.resetRange(dataEle.startDecorate, 1);
|
18927
|
+
return;
|
18912
18928
|
}
|
18913
18929
|
}
|
18914
18930
|
if (control.isDecorate) {
|
@@ -18932,7 +18948,7 @@ class DocumentChange {
|
|
18932
18948
|
return false;
|
18933
18949
|
}
|
18934
18950
|
if (prevEle) {
|
18935
|
-
this.selectionState
|
18951
|
+
ElementUtil.setDataElemEndFocus(this.selectionState, prevEle);
|
18936
18952
|
return true;
|
18937
18953
|
}
|
18938
18954
|
return false;
|
@@ -19289,6 +19305,7 @@ class DocumentChange {
|
|
19289
19305
|
//在数据元内删除,调用普通的删除处理
|
19290
19306
|
if (dataElement) {
|
19291
19307
|
this.deleteRange(range);
|
19308
|
+
this.selectionState.resetRange(dataElement.startDecorate, 1);
|
19292
19309
|
return;
|
19293
19310
|
}
|
19294
19311
|
//在数据元外删除
|
@@ -19877,6 +19894,14 @@ class DocumentChange {
|
|
19877
19894
|
}
|
19878
19895
|
}
|
19879
19896
|
getCursorElementByDeleteAction(control) {
|
19897
|
+
if (this.viewOptions.docMode === exports.DocMode.FormEdit) {
|
19898
|
+
if (control.parent instanceof DataElementInlineGroup) {
|
19899
|
+
return {
|
19900
|
+
ele: control.parent.startDecorate,
|
19901
|
+
offset: 1
|
19902
|
+
};
|
19903
|
+
}
|
19904
|
+
}
|
19880
19905
|
const prevLeafElementInPara = ElementUtil.getRecursionPrevSiblingElement(control, false, true, this.viewOptions);
|
19881
19906
|
//是否为同一段落
|
19882
19907
|
if (prevLeafElementInPara && ElementUtil.isInSameParagraph(prevLeafElementInPara, control)) {
|
@@ -27340,6 +27365,8 @@ class DocEditor {
|
|
27340
27365
|
this.editInput.style.width = "1px";
|
27341
27366
|
this.editInput.readOnly = false;
|
27342
27367
|
this.setCursorVisibility(true);
|
27368
|
+
//判断光标位置是否被可见,如果不可见,需要将其设置到可见区域
|
27369
|
+
//TODO:暂时不做处理
|
27343
27370
|
//this.setCursorInputStatus();
|
27344
27371
|
}
|
27345
27372
|
/**
|
@@ -28106,12 +28133,7 @@ class DocEditor {
|
|
28106
28133
|
* 设置光标在数据元内容末尾
|
28107
28134
|
*/
|
28108
28135
|
setDataElemEndFocus(ele) {
|
28109
|
-
|
28110
|
-
this.selectionState.resetRange(ele.getChild(0), 1);
|
28111
|
-
}
|
28112
|
-
else {
|
28113
|
-
this.selectionState.resetRange(ele.getChild(ele.length - 2), -1);
|
28114
|
-
}
|
28136
|
+
ElementUtil.setDataElemEndFocus(this.selectionState, ele);
|
28115
28137
|
}
|
28116
28138
|
/**
|
28117
28139
|
* 渲染下拉框数据元
|
@@ -28338,7 +28360,7 @@ class DocEditor {
|
|
28338
28360
|
rule.setRuleOptions({ width: this.viewOptions.docPageSettings.width, pagePL, pagePR, docLeft });
|
28339
28361
|
}
|
28340
28362
|
version() {
|
28341
|
-
return "2.0.
|
28363
|
+
return "2.0.40";
|
28342
28364
|
}
|
28343
28365
|
}
|
28344
28366
|
|