@hailin-zheng/editor-core 1.0.55 → 1.0.58
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 +48 -5
- package/index-cjs.js.map +1 -1
- package/index.js +48 -5
- package/index.js.map +1 -1
- package/med_editor/framework/document-context.d.ts +6 -0
- package/package.json +1 -1
package/index-cjs.js
CHANGED
@@ -6669,6 +6669,7 @@ class DocumentSelection {
|
|
6669
6669
|
const range = this.selectionState.range;
|
6670
6670
|
//转换选区
|
6671
6671
|
this.transformRange();
|
6672
|
+
this.selectionState.clear();
|
6672
6673
|
if (!range) {
|
6673
6674
|
return false;
|
6674
6675
|
}
|
@@ -6790,7 +6791,7 @@ class SelectionState {
|
|
6790
6791
|
*/
|
6791
6792
|
rangeDirty = false;
|
6792
6793
|
addRange(range) {
|
6793
|
-
|
6794
|
+
this.clear();
|
6794
6795
|
this.range = range;
|
6795
6796
|
this.rangeDirty = true;
|
6796
6797
|
this.onChangedEvent.next();
|
@@ -12100,7 +12101,7 @@ class DocumentEvent {
|
|
12100
12101
|
//设置文档页中的相对位置
|
12101
12102
|
evt.pageX = hitPagePos.x;
|
12102
12103
|
evt.pageY = hitPagePos.y;
|
12103
|
-
const hitInfo = this.getHitLeafRender(docRender, { x:
|
12104
|
+
const hitInfo = this.getHitLeafRender(docRender, { x: -docRender.rect.x, y: -docRender.rect.y }, {
|
12104
12105
|
x: evt.pageX,
|
12105
12106
|
y: evt.pageY
|
12106
12107
|
});
|
@@ -15252,6 +15253,48 @@ class DocumentContext {
|
|
15252
15253
|
}
|
15253
15254
|
});
|
15254
15255
|
}
|
15256
|
+
/**
|
15257
|
+
* 查询字符
|
15258
|
+
* @param text
|
15259
|
+
*/
|
15260
|
+
searchText(text) {
|
15261
|
+
const docTextData = this.getElementTextData(this.ctx);
|
15262
|
+
const matchData = [];
|
15263
|
+
for (let i = 0; i < docTextData.length; i++) {
|
15264
|
+
if (docTextData[i].text.indexOf(text) >= 0) {
|
15265
|
+
matchData.push(docTextData[i]);
|
15266
|
+
}
|
15267
|
+
}
|
15268
|
+
console.log(matchData);
|
15269
|
+
}
|
15270
|
+
getElementTextData(ele) {
|
15271
|
+
const arr = [];
|
15272
|
+
if (ele instanceof BranchElement) {
|
15273
|
+
let prevText = null;
|
15274
|
+
for (let i = 0; i < ele.length; i++) {
|
15275
|
+
const child = ele.getChild(i);
|
15276
|
+
if (child instanceof TextGroupElement) {
|
15277
|
+
if (prevText) {
|
15278
|
+
const prevData = arr[arr.length - 1];
|
15279
|
+
prevData.eles.push(child);
|
15280
|
+
prevData.text += child.text;
|
15281
|
+
}
|
15282
|
+
else {
|
15283
|
+
arr.push({
|
15284
|
+
text: child.text,
|
15285
|
+
eles: [child]
|
15286
|
+
});
|
15287
|
+
}
|
15288
|
+
prevText = child;
|
15289
|
+
}
|
15290
|
+
else {
|
15291
|
+
arr.push(...this.getElementTextData(child));
|
15292
|
+
prevText = null;
|
15293
|
+
}
|
15294
|
+
}
|
15295
|
+
}
|
15296
|
+
return arr;
|
15297
|
+
}
|
15255
15298
|
}
|
15256
15299
|
|
15257
15300
|
/**
|
@@ -16043,17 +16086,17 @@ class CanvasTextEditor {
|
|
16043
16086
|
*/
|
16044
16087
|
refreshView(rePaint) {
|
16045
16088
|
const ssChanged = this.documentSelection.updateSelectionState();
|
16046
|
-
this.setCursor();
|
16047
16089
|
this.selectionOverlays.getSelectionTreeData();
|
16048
16090
|
this.documentPaint.refreshView(rePaint);
|
16049
16091
|
this.setScrollSize();
|
16050
|
-
|
16092
|
+
this.setCursor();
|
16093
|
+
(ssChanged || rePaint) && this.selectionChanged.next(this.documentSelection.selectionState);
|
16051
16094
|
this.docRule.refreshRule();
|
16052
16095
|
}
|
16053
16096
|
hitInfoChanged(hitInfo) {
|
16054
16097
|
this.documentSelection.setSelectionState(hitInfo);
|
16055
16098
|
this.refreshDocument();
|
16056
|
-
this.selectionChanged.next(this.documentSelection.selectionState);
|
16099
|
+
//this.selectionChanged.next(this.documentSelection.selectionState);
|
16057
16100
|
}
|
16058
16101
|
/**
|
16059
16102
|
* 设置光标
|