@hailin-zheng/editor-core 1.0.54 → 1.0.55
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 +18 -18
- package/index-cjs.js.map +1 -1
- package/index.js +18 -18
- package/index.js.map +1 -1
- package/med_editor/framework/document-selection.d.ts +6 -3
- package/package.json +1 -1
package/index.js
CHANGED
@@ -2770,8 +2770,8 @@ class DataElementRenderObject extends InlineGroupRenderObject {
|
|
2770
2770
|
const titleWidth = render.contentContext.measureText(caption, textProps).width;
|
2771
2771
|
const x = position.x;
|
2772
2772
|
const y = position.y - 20;
|
2773
|
-
render.contentContext.fillRect(x, y, titleWidth, 20, 'blue');
|
2774
|
-
render.contentContext.drawText(caption, textProps, x, y, titleWidth, 20);
|
2773
|
+
render.contentContext.fillRect(x, y, titleWidth + 10, 20, 'blue');
|
2774
|
+
render.contentContext.drawText(caption, textProps, x + 5, y, titleWidth, 20);
|
2775
2775
|
}
|
2776
2776
|
}
|
2777
2777
|
}
|
@@ -6618,8 +6618,8 @@ class DocumentSelection {
|
|
6618
6618
|
this.selectionState.addRange(startRange);
|
6619
6619
|
}
|
6620
6620
|
/**
|
6621
|
-
|
6622
|
-
|
6621
|
+
* 获取选区共同的祖先控件
|
6622
|
+
*/
|
6623
6623
|
static getAncestorCommonControl(startControl, endControl) {
|
6624
6624
|
const startNestParents = this.getNestParents(startControl.parent);
|
6625
6625
|
const ancestorCommonControl = this.getCommonParenet(endControl.parent, startNestParents);
|
@@ -6654,10 +6654,11 @@ class DocumentSelection {
|
|
6654
6654
|
* @private
|
6655
6655
|
*/
|
6656
6656
|
updateSelectionState() {
|
6657
|
-
if (this.
|
6657
|
+
if (!this.selectionState.rangeDirty) {
|
6658
6658
|
return false;
|
6659
6659
|
}
|
6660
6660
|
const range = this.selectionState.range;
|
6661
|
+
//转换选区
|
6661
6662
|
this.transformRange();
|
6662
6663
|
if (!range) {
|
6663
6664
|
return false;
|
@@ -6671,6 +6672,7 @@ class DocumentSelection {
|
|
6671
6672
|
this.selectionState.endControlIndex = ElementUtil.getControlIndex(range.endControl);
|
6672
6673
|
this.selectionState.ancestorCommonControl = DocumentSelection.getAncestorCommonControl(this.selectionState.startControl, this.selectionState.endControl);
|
6673
6674
|
this.selectionState.enableTrackChanges = this.getEnableTrackChanges(range.startControl);
|
6675
|
+
this.selectionState.rangeDirty = false;
|
6674
6676
|
return true;
|
6675
6677
|
}
|
6676
6678
|
/**
|
@@ -6681,17 +6683,6 @@ class DocumentSelection {
|
|
6681
6683
|
const body = ElementUtil.getParentByType(ele, DocumentBodyElement);
|
6682
6684
|
return body?.trackChanges || false;
|
6683
6685
|
}
|
6684
|
-
compareSelectionEquals() {
|
6685
|
-
const range = this.selectionState.range;
|
6686
|
-
const snap = this.snapshotSelectionState;
|
6687
|
-
if (snap && range) {
|
6688
|
-
return range.startControl === snap.startControl
|
6689
|
-
&& range.startOffset === snap.startOffset
|
6690
|
-
&& range.endControl === snap.endControl
|
6691
|
-
&& range.endOffset === snap.endOffset;
|
6692
|
-
}
|
6693
|
-
return false;
|
6694
|
-
}
|
6695
6686
|
/**
|
6696
6687
|
* 转换选区内容
|
6697
6688
|
* 处理结束选区在开始选区之前
|
@@ -6785,9 +6776,14 @@ class SelectionState {
|
|
6785
6776
|
this.selectedRange = null;
|
6786
6777
|
this.cursorPos = null;
|
6787
6778
|
}
|
6779
|
+
/**
|
6780
|
+
* 当前选区是否发生改变
|
6781
|
+
*/
|
6782
|
+
rangeDirty = false;
|
6788
6783
|
addRange(range) {
|
6789
6784
|
//this.clear();
|
6790
6785
|
this.range = range;
|
6786
|
+
this.rangeDirty = true;
|
6791
6787
|
this.onChangedEvent.next();
|
6792
6788
|
}
|
6793
6789
|
resetRange(startControl, startOffset) {
|
@@ -12260,6 +12256,7 @@ class DocumentEvent {
|
|
12260
12256
|
const newParents = ElementUtil.getParentElements(focusElement);
|
12261
12257
|
const leaveParents = oldParents.filter(item => newParents.every(oldItem => item !== oldItem));
|
12262
12258
|
const enterParents = newParents.filter(item => oldParents.every(oldItem => item !== oldItem));
|
12259
|
+
let cancelEvent = false;
|
12263
12260
|
const loopInvokeEvent = (eventName, array) => {
|
12264
12261
|
for (const element of array) {
|
12265
12262
|
const mouseEvent = new LostCursorEvent(this.docCtx);
|
@@ -12268,13 +12265,16 @@ class DocumentEvent {
|
|
12268
12265
|
mouseEvent.ctx = this.docCtx;
|
12269
12266
|
element.invokeEvent(eventName, mouseEvent);
|
12270
12267
|
if (mouseEvent.isCancel) {
|
12268
|
+
cancelEvent = true;
|
12271
12269
|
break;
|
12272
12270
|
}
|
12273
12271
|
}
|
12274
12272
|
};
|
12275
12273
|
loopInvokeEvent('LostCursor', leaveParents);
|
12276
12274
|
loopInvokeEvent('GotCursor', enterParents);
|
12277
|
-
|
12275
|
+
if (!cancelEvent) {
|
12276
|
+
this.prevCursorItems = newParents;
|
12277
|
+
}
|
12278
12278
|
//dDocumentEvent.invokeEvent('GotCursor', focusElement, getCursorEvent, 'All', this.docCtx);
|
12279
12279
|
}
|
12280
12280
|
/**
|
@@ -16034,10 +16034,10 @@ class CanvasTextEditor {
|
|
16034
16034
|
*/
|
16035
16035
|
refreshView(rePaint) {
|
16036
16036
|
const ssChanged = this.documentSelection.updateSelectionState();
|
16037
|
+
this.setCursor();
|
16037
16038
|
this.selectionOverlays.getSelectionTreeData();
|
16038
16039
|
this.documentPaint.refreshView(rePaint);
|
16039
16040
|
this.setScrollSize();
|
16040
|
-
this.setCursor();
|
16041
16041
|
ssChanged && this.selectionChanged.next(this.documentSelection.selectionState);
|
16042
16042
|
this.docRule.refreshRule();
|
16043
16043
|
}
|