@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.js
CHANGED
@@ -3870,7 +3870,7 @@ function drawDecorator(e, r) {
|
|
3870
3870
|
}
|
3871
3871
|
function exportDecoratorHTML(event, r) {
|
3872
3872
|
const canPaint = r.element.isMouseenter || r.element.isFocused;
|
3873
|
-
if (canPaint
|
3873
|
+
if (canPaint) {
|
3874
3874
|
const strokeColor = '#0050b3';
|
3875
3875
|
const verOffset = 0;
|
3876
3876
|
const renderPosMap = getCurrentParaGroupRenders(r).map(item => ({ pos: getRenderPosToDoc(item), render: item }));
|
@@ -12484,6 +12484,17 @@ class ElementUtil {
|
|
12484
12484
|
offset = offset === -1 ? 1 : offset;
|
12485
12485
|
return offset;
|
12486
12486
|
}
|
12487
|
+
/**
|
12488
|
+
* 设置光标在数据元内容末尾
|
12489
|
+
*/
|
12490
|
+
static setDataElemEndFocus(ss, ele) {
|
12491
|
+
if (ele.length === 2) {
|
12492
|
+
ss.resetRange(ele.getChild(0), 1);
|
12493
|
+
}
|
12494
|
+
else {
|
12495
|
+
ss.resetRange(ele.getChild(ele.length - 2), -1);
|
12496
|
+
}
|
12497
|
+
}
|
12487
12498
|
}
|
12488
12499
|
|
12489
12500
|
class RenderContext {
|
@@ -14687,9 +14698,9 @@ class DocumentArrange {
|
|
14687
14698
|
blockLine = children[++j];
|
14688
14699
|
}
|
14689
14700
|
}
|
14690
|
-
|
14691
|
-
|
14692
|
-
|
14701
|
+
if (cloneRender.length === 0 && sumHeight === 0) {
|
14702
|
+
return null;
|
14703
|
+
}
|
14693
14704
|
ElementUtil.remeasure(cloneRender);
|
14694
14705
|
ElementUtil.remeasure(render);
|
14695
14706
|
if (cloneRender.length === 0) {
|
@@ -14746,7 +14757,7 @@ class DocumentArrange {
|
|
14746
14757
|
if (cutRow) {
|
14747
14758
|
cloneTbRender.addChild(cutRow);
|
14748
14759
|
sumHeight += cutRow.rect.height;
|
14749
|
-
if (currRow.getItems().
|
14760
|
+
if (currRow.getItems().some(item => item.length !== 0)) {
|
14750
14761
|
cutRows.push(currRow);
|
14751
14762
|
}
|
14752
14763
|
else {
|
@@ -18763,6 +18774,7 @@ class DocumentChange {
|
|
18763
18774
|
if (!selectedRange) {
|
18764
18775
|
throw new Error('selectionRange is null');
|
18765
18776
|
}
|
18777
|
+
this.selectionState.clear();
|
18766
18778
|
//用于刷新后定位光标
|
18767
18779
|
let startPointElement;
|
18768
18780
|
let startPointOffset = 0;
|
@@ -18812,8 +18824,13 @@ class DocumentChange {
|
|
18812
18824
|
else {
|
18813
18825
|
this.deleteRange(selectedRange);
|
18814
18826
|
}
|
18815
|
-
|
18816
|
-
|
18827
|
+
if (startPointElement) {
|
18828
|
+
//如果其他位置设置过选区对象,则以启动位置设置的选区为准
|
18829
|
+
if (!this.selectionState.range) {
|
18830
|
+
this.selectionState.resetRange(startPointElement, startPointOffset);
|
18831
|
+
}
|
18832
|
+
}
|
18833
|
+
//return {cursorEle: startPointElement, cursorOffset: startPointOffset};
|
18817
18834
|
}
|
18818
18835
|
/**
|
18819
18836
|
* backspace删除
|
@@ -18876,9 +18893,8 @@ class DocumentChange {
|
|
18876
18893
|
return;
|
18877
18894
|
}
|
18878
18895
|
if (control.isPrefix && this.viewOptions.docMode === DocMode.FormEdit) {
|
18879
|
-
|
18880
|
-
|
18881
|
-
}
|
18896
|
+
this.selectionState.resetRange(dataEle.startDecorate, 1);
|
18897
|
+
return;
|
18882
18898
|
}
|
18883
18899
|
}
|
18884
18900
|
if (control.isDecorate) {
|
@@ -18902,7 +18918,7 @@ class DocumentChange {
|
|
18902
18918
|
return false;
|
18903
18919
|
}
|
18904
18920
|
if (prevEle) {
|
18905
|
-
this.selectionState
|
18921
|
+
ElementUtil.setDataElemEndFocus(this.selectionState, prevEle);
|
18906
18922
|
return true;
|
18907
18923
|
}
|
18908
18924
|
return false;
|
@@ -19259,6 +19275,7 @@ class DocumentChange {
|
|
19259
19275
|
//在数据元内删除,调用普通的删除处理
|
19260
19276
|
if (dataElement) {
|
19261
19277
|
this.deleteRange(range);
|
19278
|
+
this.selectionState.resetRange(dataElement.startDecorate, 1);
|
19262
19279
|
return;
|
19263
19280
|
}
|
19264
19281
|
//在数据元外删除
|
@@ -19847,6 +19864,14 @@ class DocumentChange {
|
|
19847
19864
|
}
|
19848
19865
|
}
|
19849
19866
|
getCursorElementByDeleteAction(control) {
|
19867
|
+
if (this.viewOptions.docMode === DocMode.FormEdit) {
|
19868
|
+
if (control.parent instanceof DataElementInlineGroup) {
|
19869
|
+
return {
|
19870
|
+
ele: control.parent.startDecorate,
|
19871
|
+
offset: 1
|
19872
|
+
};
|
19873
|
+
}
|
19874
|
+
}
|
19850
19875
|
const prevLeafElementInPara = ElementUtil.getRecursionPrevSiblingElement(control, false, true, this.viewOptions);
|
19851
19876
|
//是否为同一段落
|
19852
19877
|
if (prevLeafElementInPara && ElementUtil.isInSameParagraph(prevLeafElementInPara, control)) {
|
@@ -27310,6 +27335,8 @@ class DocEditor {
|
|
27310
27335
|
this.editInput.style.width = "1px";
|
27311
27336
|
this.editInput.readOnly = false;
|
27312
27337
|
this.setCursorVisibility(true);
|
27338
|
+
//判断光标位置是否被可见,如果不可见,需要将其设置到可见区域
|
27339
|
+
//TODO:暂时不做处理
|
27313
27340
|
//this.setCursorInputStatus();
|
27314
27341
|
}
|
27315
27342
|
/**
|
@@ -28076,12 +28103,7 @@ class DocEditor {
|
|
28076
28103
|
* 设置光标在数据元内容末尾
|
28077
28104
|
*/
|
28078
28105
|
setDataElemEndFocus(ele) {
|
28079
|
-
|
28080
|
-
this.selectionState.resetRange(ele.getChild(0), 1);
|
28081
|
-
}
|
28082
|
-
else {
|
28083
|
-
this.selectionState.resetRange(ele.getChild(ele.length - 2), -1);
|
28084
|
-
}
|
28106
|
+
ElementUtil.setDataElemEndFocus(this.selectionState, ele);
|
28085
28107
|
}
|
28086
28108
|
/**
|
28087
28109
|
* 渲染下拉框数据元
|
@@ -28308,7 +28330,7 @@ class DocEditor {
|
|
28308
28330
|
rule.setRuleOptions({ width: this.viewOptions.docPageSettings.width, pagePL, pagePR, docLeft });
|
28309
28331
|
}
|
28310
28332
|
version() {
|
28311
|
-
return "2.0.
|
28333
|
+
return "2.0.40";
|
28312
28334
|
}
|
28313
28335
|
}
|
28314
28336
|
|