@hailin-zheng/editor-core 1.0.58 → 1.0.60

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 CHANGED
@@ -3484,7 +3484,7 @@ class TableCellElement extends BlockContainerElement {
3484
3484
  const cellRender = new TableCellRenderObject(this);
3485
3485
  cellRender.rect.width = cellWidth;
3486
3486
  cellRender.rect.maxWidth = cellWidth;
3487
- cellRender.padding = new PaddingProps(0, 0, 5, 5);
3487
+ cellRender.padding = new PaddingProps(2, 2, 5, 5);
3488
3488
  cellRender.rect.x = cellOffset;
3489
3489
  return cellRender;
3490
3490
  }
@@ -6666,9 +6666,9 @@ class DocumentSelection {
6666
6666
  if (!this.selectionState.rangeDirty) {
6667
6667
  return false;
6668
6668
  }
6669
- const range = this.selectionState.range;
6670
6669
  //转换选区
6671
6670
  this.transformRange();
6671
+ const range = this.selectionState.range;
6672
6672
  this.selectionState.clear();
6673
6673
  if (!range) {
6674
6674
  return false;
@@ -15259,13 +15259,15 @@ class DocumentContext {
15259
15259
  */
15260
15260
  searchText(text) {
15261
15261
  const docTextData = this.getElementTextData(this.ctx);
15262
- const matchData = [];
15263
15262
  for (let i = 0; i < docTextData.length; i++) {
15264
- if (docTextData[i].text.indexOf(text) >= 0) {
15265
- matchData.push(docTextData[i]);
15263
+ // if (docTextData[i].text.indexOf(text) >= 0) {
15264
+ // matchData.push(docTextData[i]);
15265
+ // }
15266
+ const matchAll = docTextData[i].text.matchAll(new RegExp(`${text}`, 'g'));
15267
+ for (let regExpMatchArray of matchAll) {
15268
+ console.log(regExpMatchArray);
15266
15269
  }
15267
15270
  }
15268
- console.log(matchData);
15269
15271
  }
15270
15272
  getElementTextData(ele) {
15271
15273
  const arr = [];
@@ -15886,7 +15888,7 @@ class CanvasTextEditor {
15886
15888
  this.viewOptions = new ViewOptions();
15887
15889
  this.documentSelection = new DocumentSelection();
15888
15890
  this.docCtx = new EditorContext(this.documentSelection.selectionState, this.viewOptions);
15889
- this.viewOptions.copyRightInfo = '万达信息电子病历编辑器,www.wondersgroup.com';
15891
+ this.viewOptions.copyRightInfo = '电子病历编辑器(XXX版权所有)';
15890
15892
  this.viewOptions.drawCharRectColor = 'green';
15891
15893
  this.viewOptions.showLineRect = true;
15892
15894
  this.viewOptions.docSpace = 20;
@@ -16405,6 +16407,9 @@ class CanvasTextEditor {
16405
16407
  return null;
16406
16408
  }
16407
16409
  const para = ElementUtil.getParentByType(selectionState.startControl, ParagraphElement);
16410
+ if (!para) {
16411
+ return null;
16412
+ }
16408
16413
  return para.props;
16409
16414
  }
16410
16415
  setTextFormat(newProps) {
@@ -16631,6 +16636,14 @@ class CanvasTextEditor {
16631
16636
  }
16632
16637
  return this.documentChange.insertElement(targetElement, targetOffset, destEleArray);
16633
16638
  }
16639
+ /**
16640
+ * 插入新元素
16641
+ * @param ele
16642
+ */
16643
+ insertNewElement(ele) {
16644
+ const { startControl, startOffset } = this.selectionState;
16645
+ this.insertElement(startControl, startOffset, [ele]);
16646
+ }
16634
16647
  showHistory() {
16635
16648
  //console.log(History.ops);
16636
16649
  const newPara = new ParagraphElement();