@hailin-zheng/editor-core 2.0.29 → 2.0.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 +38 -12
- package/index-cjs.js.map +1 -1
- package/index.js +38 -12
- package/index.js.map +1 -1
- package/med_editor/framework/element-util.d.ts +1 -1
- package/med_editor/framework/impl/data-element/data-element-date-impl.d.ts +1 -1
- package/med_editor/framework/impl/data-element/data-element-list-impl.d.ts +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
@@ -2373,7 +2373,7 @@ class DataEleCheckProps extends DataEleBaseProps {
|
|
2373
2373
|
if (this.falseChar !== falseChar) {
|
2374
2374
|
props.falseChar = this.falseChar;
|
2375
2375
|
}
|
2376
|
-
if (this.border) {
|
2376
|
+
if (!this.border) {
|
2377
2377
|
props.border = this.border;
|
2378
2378
|
}
|
2379
2379
|
if (this.trueStateColor !== '#f00000') {
|
@@ -4912,6 +4912,9 @@ class DocumentSelection {
|
|
4912
4912
|
* @private
|
4913
4913
|
*/
|
4914
4914
|
updateSelectionState() {
|
4915
|
+
if (this.selectionState.startControl && !this.selectionState.startControl.parent) {
|
4916
|
+
this.selectionState.clear();
|
4917
|
+
}
|
4915
4918
|
if (!this.selectionState.rangeDirty) {
|
4916
4919
|
return false;
|
4917
4920
|
}
|
@@ -5029,6 +5032,7 @@ class SelectionState {
|
|
5029
5032
|
this.clear();
|
5030
5033
|
}
|
5031
5034
|
clear() {
|
5035
|
+
this.startHitInfo = null;
|
5032
5036
|
this.rangeDirty = true;
|
5033
5037
|
this.range = null;
|
5034
5038
|
this.startOffset = -1;
|
@@ -8579,6 +8583,10 @@ class DataElementDate extends DataElementInlineGroup {
|
|
8579
8583
|
return super.cloneSelf(data, DataElementDate);
|
8580
8584
|
}
|
8581
8585
|
setValue(val) {
|
8586
|
+
if (val === null) {
|
8587
|
+
this.clearInnerItems();
|
8588
|
+
return;
|
8589
|
+
}
|
8582
8590
|
const format = this.props.format ?? 'YYYY-MM-DD';
|
8583
8591
|
const date = moment(val, format);
|
8584
8592
|
if (!date.isValid()) {
|
@@ -8941,6 +8949,10 @@ class DataElementList extends DataElementInlineGroup {
|
|
8941
8949
|
return super.cloneSelf(data, DataElementList);
|
8942
8950
|
}
|
8943
8951
|
setValue(vals) {
|
8952
|
+
if (vals === null) {
|
8953
|
+
this.clearInnerItems();
|
8954
|
+
return;
|
8955
|
+
}
|
8944
8956
|
if (!Array.isArray(vals)) {
|
8945
8957
|
vals = [vals];
|
8946
8958
|
}
|
@@ -12383,14 +12395,14 @@ class ElementUtil {
|
|
12383
12395
|
}
|
12384
12396
|
};
|
12385
12397
|
}
|
12386
|
-
static getMousePos(e) {
|
12398
|
+
static getMousePos(e, scale = 1) {
|
12387
12399
|
const svgContainer = e.currentTarget;
|
12388
12400
|
const parentRect = svgContainer.getBoundingClientRect();
|
12389
12401
|
const localX = e.clientX - parentRect.x; //+ this.viewOptions.pageOffset.x;
|
12390
12402
|
const localY = e.clientY - parentRect.y; //+ this.viewOptions.pageOffset.y;
|
12391
12403
|
return {
|
12392
|
-
x: localX,
|
12393
|
-
y: localY
|
12404
|
+
x: localX / scale,
|
12405
|
+
y: localY / scale
|
12394
12406
|
};
|
12395
12407
|
}
|
12396
12408
|
static createClipPath(id, width, height, x = 0, y = 0) {
|
@@ -16129,8 +16141,8 @@ class DocumentPaint {
|
|
16129
16141
|
getDocumentContainerHeight() {
|
16130
16142
|
if (this.docPages.length > 0) {
|
16131
16143
|
return {
|
16132
|
-
width: this.docContainer.rect.width
|
16133
|
-
height: this.docContainer.rect.height
|
16144
|
+
width: this.docContainer.rect.width,
|
16145
|
+
height: this.docContainer.rect.height
|
16134
16146
|
};
|
16135
16147
|
}
|
16136
16148
|
else {
|
@@ -16886,21 +16898,22 @@ class DocumentEvent {
|
|
16886
16898
|
this.bindEvent();
|
16887
16899
|
}
|
16888
16900
|
getEventListener() {
|
16901
|
+
const scale = this.viewOptions.scale;
|
16889
16902
|
return {
|
16890
16903
|
mousedown: (evt) => {
|
16891
|
-
this.mousedown(evt, ElementUtil.getMousePos(evt));
|
16904
|
+
this.mousedown(evt, ElementUtil.getMousePos(evt, scale));
|
16892
16905
|
},
|
16893
16906
|
mouseup: (evt) => {
|
16894
|
-
this.mouseup(evt, ElementUtil.getMousePos(evt));
|
16907
|
+
this.mouseup(evt, ElementUtil.getMousePos(evt, scale));
|
16895
16908
|
},
|
16896
16909
|
click: (evt) => {
|
16897
16910
|
this.mouseClickHandle(evt);
|
16898
16911
|
},
|
16899
16912
|
mousemove: (evt) => {
|
16900
|
-
this.mousemove(evt, ElementUtil.getMousePos(evt));
|
16913
|
+
this.mousemove(evt, ElementUtil.getMousePos(evt, scale));
|
16901
16914
|
},
|
16902
16915
|
dblclick: (evt) => {
|
16903
|
-
this.mouseDblClickHandle(evt, ElementUtil.getMousePos(evt));
|
16916
|
+
this.mouseDblClickHandle(evt, ElementUtil.getMousePos(evt, scale));
|
16904
16917
|
},
|
16905
16918
|
contextmenu: (evt) => {
|
16906
16919
|
this.contextMenu.next(evt);
|
@@ -27056,7 +27069,15 @@ class DocEditor {
|
|
27056
27069
|
}
|
27057
27070
|
},
|
27058
27071
|
children: [
|
27059
|
-
|
27072
|
+
{
|
27073
|
+
sel: 'div.scale-container', data: {
|
27074
|
+
style: {
|
27075
|
+
transform: 'scale(' + this.viewOptions.scale + ')',
|
27076
|
+
transformOrigin: 'left top'
|
27077
|
+
}
|
27078
|
+
},
|
27079
|
+
children: [docContentVNode, inputVNode, dropContainer]
|
27080
|
+
}
|
27060
27081
|
]
|
27061
27082
|
}, ruleFunc.refreshRuleSvg().render()
|
27062
27083
|
]
|
@@ -27218,7 +27239,7 @@ class DocEditor {
|
|
27218
27239
|
}
|
27219
27240
|
getCursorRect() {
|
27220
27241
|
try {
|
27221
|
-
if (!this.
|
27242
|
+
if (!this.selectionState.startHitInfo) {
|
27222
27243
|
return { x: 0, y: 0, width: 0, height: 0 };
|
27223
27244
|
}
|
27224
27245
|
const { startControl, startOffset } = this.selectionState;
|
@@ -27421,6 +27442,11 @@ class DocEditor {
|
|
27421
27442
|
this.updateRenderCtx();
|
27422
27443
|
this.flushToSchedule();
|
27423
27444
|
this.documentPaint.layoutPages();
|
27445
|
+
const sub = this.afterNodePatch.subscribe(() => {
|
27446
|
+
sub.unsubscribe();
|
27447
|
+
const scrollDOM = this.svgContainer.querySelector('.scroll-container');
|
27448
|
+
scrollDOM.scrollLeft = (scrollDOM.scrollWidth - scrollDOM.getBoundingClientRect().width) / 2;
|
27449
|
+
});
|
27424
27450
|
return scale;
|
27425
27451
|
}
|
27426
27452
|
updateRenderCtx() {
|