@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-cjs.js
CHANGED
@@ -2403,7 +2403,7 @@ class DataEleCheckProps extends DataEleBaseProps {
|
|
2403
2403
|
if (this.falseChar !== falseChar) {
|
2404
2404
|
props.falseChar = this.falseChar;
|
2405
2405
|
}
|
2406
|
-
if (this.border) {
|
2406
|
+
if (!this.border) {
|
2407
2407
|
props.border = this.border;
|
2408
2408
|
}
|
2409
2409
|
if (this.trueStateColor !== '#f00000') {
|
@@ -4942,6 +4942,9 @@ class DocumentSelection {
|
|
4942
4942
|
* @private
|
4943
4943
|
*/
|
4944
4944
|
updateSelectionState() {
|
4945
|
+
if (this.selectionState.startControl && !this.selectionState.startControl.parent) {
|
4946
|
+
this.selectionState.clear();
|
4947
|
+
}
|
4945
4948
|
if (!this.selectionState.rangeDirty) {
|
4946
4949
|
return false;
|
4947
4950
|
}
|
@@ -5059,6 +5062,7 @@ class SelectionState {
|
|
5059
5062
|
this.clear();
|
5060
5063
|
}
|
5061
5064
|
clear() {
|
5065
|
+
this.startHitInfo = null;
|
5062
5066
|
this.rangeDirty = true;
|
5063
5067
|
this.range = null;
|
5064
5068
|
this.startOffset = -1;
|
@@ -8609,6 +8613,10 @@ class DataElementDate extends DataElementInlineGroup {
|
|
8609
8613
|
return super.cloneSelf(data, DataElementDate);
|
8610
8614
|
}
|
8611
8615
|
setValue(val) {
|
8616
|
+
if (val === null) {
|
8617
|
+
this.clearInnerItems();
|
8618
|
+
return;
|
8619
|
+
}
|
8612
8620
|
const format = this.props.format ?? 'YYYY-MM-DD';
|
8613
8621
|
const date = moment__default["default"](val, format);
|
8614
8622
|
if (!date.isValid()) {
|
@@ -8971,6 +8979,10 @@ class DataElementList extends DataElementInlineGroup {
|
|
8971
8979
|
return super.cloneSelf(data, DataElementList);
|
8972
8980
|
}
|
8973
8981
|
setValue(vals) {
|
8982
|
+
if (vals === null) {
|
8983
|
+
this.clearInnerItems();
|
8984
|
+
return;
|
8985
|
+
}
|
8974
8986
|
if (!Array.isArray(vals)) {
|
8975
8987
|
vals = [vals];
|
8976
8988
|
}
|
@@ -12413,14 +12425,14 @@ class ElementUtil {
|
|
12413
12425
|
}
|
12414
12426
|
};
|
12415
12427
|
}
|
12416
|
-
static getMousePos(e) {
|
12428
|
+
static getMousePos(e, scale = 1) {
|
12417
12429
|
const svgContainer = e.currentTarget;
|
12418
12430
|
const parentRect = svgContainer.getBoundingClientRect();
|
12419
12431
|
const localX = e.clientX - parentRect.x; //+ this.viewOptions.pageOffset.x;
|
12420
12432
|
const localY = e.clientY - parentRect.y; //+ this.viewOptions.pageOffset.y;
|
12421
12433
|
return {
|
12422
|
-
x: localX,
|
12423
|
-
y: localY
|
12434
|
+
x: localX / scale,
|
12435
|
+
y: localY / scale
|
12424
12436
|
};
|
12425
12437
|
}
|
12426
12438
|
static createClipPath(id, width, height, x = 0, y = 0) {
|
@@ -16159,8 +16171,8 @@ class DocumentPaint {
|
|
16159
16171
|
getDocumentContainerHeight() {
|
16160
16172
|
if (this.docPages.length > 0) {
|
16161
16173
|
return {
|
16162
|
-
width: this.docContainer.rect.width
|
16163
|
-
height: this.docContainer.rect.height
|
16174
|
+
width: this.docContainer.rect.width,
|
16175
|
+
height: this.docContainer.rect.height
|
16164
16176
|
};
|
16165
16177
|
}
|
16166
16178
|
else {
|
@@ -16916,21 +16928,22 @@ class DocumentEvent {
|
|
16916
16928
|
this.bindEvent();
|
16917
16929
|
}
|
16918
16930
|
getEventListener() {
|
16931
|
+
const scale = this.viewOptions.scale;
|
16919
16932
|
return {
|
16920
16933
|
mousedown: (evt) => {
|
16921
|
-
this.mousedown(evt, ElementUtil.getMousePos(evt));
|
16934
|
+
this.mousedown(evt, ElementUtil.getMousePos(evt, scale));
|
16922
16935
|
},
|
16923
16936
|
mouseup: (evt) => {
|
16924
|
-
this.mouseup(evt, ElementUtil.getMousePos(evt));
|
16937
|
+
this.mouseup(evt, ElementUtil.getMousePos(evt, scale));
|
16925
16938
|
},
|
16926
16939
|
click: (evt) => {
|
16927
16940
|
this.mouseClickHandle(evt);
|
16928
16941
|
},
|
16929
16942
|
mousemove: (evt) => {
|
16930
|
-
this.mousemove(evt, ElementUtil.getMousePos(evt));
|
16943
|
+
this.mousemove(evt, ElementUtil.getMousePos(evt, scale));
|
16931
16944
|
},
|
16932
16945
|
dblclick: (evt) => {
|
16933
|
-
this.mouseDblClickHandle(evt, ElementUtil.getMousePos(evt));
|
16946
|
+
this.mouseDblClickHandle(evt, ElementUtil.getMousePos(evt, scale));
|
16934
16947
|
},
|
16935
16948
|
contextmenu: (evt) => {
|
16936
16949
|
this.contextMenu.next(evt);
|
@@ -27086,7 +27099,15 @@ class DocEditor {
|
|
27086
27099
|
}
|
27087
27100
|
},
|
27088
27101
|
children: [
|
27089
|
-
|
27102
|
+
{
|
27103
|
+
sel: 'div.scale-container', data: {
|
27104
|
+
style: {
|
27105
|
+
transform: 'scale(' + this.viewOptions.scale + ')',
|
27106
|
+
transformOrigin: 'left top'
|
27107
|
+
}
|
27108
|
+
},
|
27109
|
+
children: [docContentVNode, inputVNode, dropContainer]
|
27110
|
+
}
|
27090
27111
|
]
|
27091
27112
|
}, ruleFunc.refreshRuleSvg().render()
|
27092
27113
|
]
|
@@ -27248,7 +27269,7 @@ class DocEditor {
|
|
27248
27269
|
}
|
27249
27270
|
getCursorRect() {
|
27250
27271
|
try {
|
27251
|
-
if (!this.
|
27272
|
+
if (!this.selectionState.startHitInfo) {
|
27252
27273
|
return { x: 0, y: 0, width: 0, height: 0 };
|
27253
27274
|
}
|
27254
27275
|
const { startControl, startOffset } = this.selectionState;
|
@@ -27451,6 +27472,11 @@ class DocEditor {
|
|
27451
27472
|
this.updateRenderCtx();
|
27452
27473
|
this.flushToSchedule();
|
27453
27474
|
this.documentPaint.layoutPages();
|
27475
|
+
const sub = this.afterNodePatch.subscribe(() => {
|
27476
|
+
sub.unsubscribe();
|
27477
|
+
const scrollDOM = this.svgContainer.querySelector('.scroll-container');
|
27478
|
+
scrollDOM.scrollLeft = (scrollDOM.scrollWidth - scrollDOM.getBoundingClientRect().width) / 2;
|
27479
|
+
});
|
27454
27480
|
return scale;
|
27455
27481
|
}
|
27456
27482
|
updateRenderCtx() {
|