@hailin-zheng/editor-core 1.0.58 → 1.0.61
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/README.md +1646 -1613
- package/index-cjs.js +24 -10
- package/index-cjs.js.map +1 -1
- package/index.js +24 -10
- package/index.js.map +1 -1
- package/med_editor/framework/element-define.d.ts +1 -0
- package/med_editor/texteditor.d.ts +5 -0
- package/package.json +1 -1
package/index-cjs.js
CHANGED
@@ -1425,6 +1425,7 @@ class ViewOptions {
|
|
1425
1425
|
viewBackcolor = 'rgb(230,230,230)';
|
1426
1426
|
paraSymbolColor = 'rgb(128,128,128)';
|
1427
1427
|
dataGroupColor = 'rgb(0,80,179)';
|
1428
|
+
defaultLineHeight = 1.3;
|
1428
1429
|
//新增-留痕块文本颜色
|
1429
1430
|
trackInsColor = '#ff4d4f';
|
1430
1431
|
//删除-留痕块文本颜色
|
@@ -1762,7 +1763,7 @@ class ParagraphProps extends INotifyPropertyChanged {
|
|
1762
1763
|
if (this.hanging) {
|
1763
1764
|
props["hanging"] = this.hanging;
|
1764
1765
|
}
|
1765
|
-
if (this.lineHeight && this.lineHeight !==
|
1766
|
+
if (this.lineHeight && this.lineHeight !== viewOptions.defaultLineHeight) {
|
1766
1767
|
props["lineHeight"] = this.lineHeight;
|
1767
1768
|
}
|
1768
1769
|
if (this.textAlign && this.textAlign !== "left") {
|
@@ -3393,7 +3394,7 @@ class ParagraphFactory extends ElementFactory {
|
|
3393
3394
|
paraElement.props.hanging = props?.hanging ?? 0;
|
3394
3395
|
paraElement.props.textAlign = props?.textAlign ?? 'left';
|
3395
3396
|
paraElement.props.numberType = props?.numberType ?? -1;
|
3396
|
-
paraElement.props.lineHeight = props?.lineHeight ??
|
3397
|
+
paraElement.props.lineHeight = props?.lineHeight ?? this.options.defaultLineHeight;
|
3397
3398
|
paraElement.props.pageBreak = props?.pageBreak ?? false;
|
3398
3399
|
return paraElement;
|
3399
3400
|
}
|
@@ -3484,7 +3485,7 @@ class TableCellElement extends BlockContainerElement {
|
|
3484
3485
|
const cellRender = new TableCellRenderObject(this);
|
3485
3486
|
cellRender.rect.width = cellWidth;
|
3486
3487
|
cellRender.rect.maxWidth = cellWidth;
|
3487
|
-
cellRender.padding = new PaddingProps(
|
3488
|
+
cellRender.padding = new PaddingProps(2, 2, 5, 5);
|
3488
3489
|
cellRender.rect.x = cellOffset;
|
3489
3490
|
return cellRender;
|
3490
3491
|
}
|
@@ -6666,9 +6667,9 @@ class DocumentSelection {
|
|
6666
6667
|
if (!this.selectionState.rangeDirty) {
|
6667
6668
|
return false;
|
6668
6669
|
}
|
6669
|
-
const range = this.selectionState.range;
|
6670
6670
|
//转换选区
|
6671
6671
|
this.transformRange();
|
6672
|
+
const range = this.selectionState.range;
|
6672
6673
|
this.selectionState.clear();
|
6673
6674
|
if (!range) {
|
6674
6675
|
return false;
|
@@ -10074,7 +10075,7 @@ class ElementMeasure {
|
|
10074
10075
|
const innerLineRect = innerLineRects[i];
|
10075
10076
|
innerLineRect.rect.x = this.getParaLineRectStartX(innerLineRects.length, i, paragraph, render, innerLineRect);
|
10076
10077
|
//限制最大行高
|
10077
|
-
const maxLineHeight = Math.floor(14 *
|
10078
|
+
const maxLineHeight = paragraph.props.lineHeight !== this.options.defaultLineHeight ? 100 : Math.floor(14 * 2);
|
10078
10079
|
//fillLineHeight填充行高
|
10079
10080
|
let fillLineHeight = Math.ceil(innerLineRect.rect.height * (paragraph.props.lineHeight - 1));
|
10080
10081
|
fillLineHeight = fillLineHeight > maxLineHeight ? maxLineHeight : fillLineHeight;
|
@@ -15259,13 +15260,15 @@ class DocumentContext {
|
|
15259
15260
|
*/
|
15260
15261
|
searchText(text) {
|
15261
15262
|
const docTextData = this.getElementTextData(this.ctx);
|
15262
|
-
const matchData = [];
|
15263
15263
|
for (let i = 0; i < docTextData.length; i++) {
|
15264
|
-
if (docTextData[i].text.indexOf(text) >= 0) {
|
15265
|
-
|
15264
|
+
// if (docTextData[i].text.indexOf(text) >= 0) {
|
15265
|
+
// matchData.push(docTextData[i]);
|
15266
|
+
// }
|
15267
|
+
const matchAll = docTextData[i].text.matchAll(new RegExp(`${text}`, 'g'));
|
15268
|
+
for (let regExpMatchArray of matchAll) {
|
15269
|
+
console.log(regExpMatchArray);
|
15266
15270
|
}
|
15267
15271
|
}
|
15268
|
-
console.log(matchData);
|
15269
15272
|
}
|
15270
15273
|
getElementTextData(ele) {
|
15271
15274
|
const arr = [];
|
@@ -15886,7 +15889,7 @@ class CanvasTextEditor {
|
|
15886
15889
|
this.viewOptions = new ViewOptions();
|
15887
15890
|
this.documentSelection = new DocumentSelection();
|
15888
15891
|
this.docCtx = new EditorContext(this.documentSelection.selectionState, this.viewOptions);
|
15889
|
-
this.viewOptions.copyRightInfo = '
|
15892
|
+
this.viewOptions.copyRightInfo = '电子病历编辑器(XXX版权所有)';
|
15890
15893
|
this.viewOptions.drawCharRectColor = 'green';
|
15891
15894
|
this.viewOptions.showLineRect = true;
|
15892
15895
|
this.viewOptions.docSpace = 20;
|
@@ -16405,6 +16408,9 @@ class CanvasTextEditor {
|
|
16405
16408
|
return null;
|
16406
16409
|
}
|
16407
16410
|
const para = ElementUtil.getParentByType(selectionState.startControl, ParagraphElement);
|
16411
|
+
if (!para) {
|
16412
|
+
return null;
|
16413
|
+
}
|
16408
16414
|
return para.props;
|
16409
16415
|
}
|
16410
16416
|
setTextFormat(newProps) {
|
@@ -16631,6 +16637,14 @@ class CanvasTextEditor {
|
|
16631
16637
|
}
|
16632
16638
|
return this.documentChange.insertElement(targetElement, targetOffset, destEleArray);
|
16633
16639
|
}
|
16640
|
+
/**
|
16641
|
+
* 插入新元素
|
16642
|
+
* @param ele
|
16643
|
+
*/
|
16644
|
+
insertNewElement(ele) {
|
16645
|
+
const { startControl, startOffset } = this.selectionState;
|
16646
|
+
this.insertElement(startControl, startOffset, [ele]);
|
16647
|
+
}
|
16634
16648
|
showHistory() {
|
16635
16649
|
//console.log(History.ops);
|
16636
16650
|
const newPara = new ParagraphElement();
|