@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.js CHANGED
@@ -3475,7 +3475,7 @@ class TableCellElement extends BlockContainerElement {
3475
3475
  const cellRender = new TableCellRenderObject(this);
3476
3476
  cellRender.rect.width = cellWidth;
3477
3477
  cellRender.rect.maxWidth = cellWidth;
3478
- cellRender.padding = new PaddingProps(0, 0, 5, 5);
3478
+ cellRender.padding = new PaddingProps(2, 2, 5, 5);
3479
3479
  cellRender.rect.x = cellOffset;
3480
3480
  return cellRender;
3481
3481
  }
@@ -6657,9 +6657,9 @@ class DocumentSelection {
6657
6657
  if (!this.selectionState.rangeDirty) {
6658
6658
  return false;
6659
6659
  }
6660
- const range = this.selectionState.range;
6661
6660
  //转换选区
6662
6661
  this.transformRange();
6662
+ const range = this.selectionState.range;
6663
6663
  this.selectionState.clear();
6664
6664
  if (!range) {
6665
6665
  return false;
@@ -15250,13 +15250,15 @@ class DocumentContext {
15250
15250
  */
15251
15251
  searchText(text) {
15252
15252
  const docTextData = this.getElementTextData(this.ctx);
15253
- const matchData = [];
15254
15253
  for (let i = 0; i < docTextData.length; i++) {
15255
- if (docTextData[i].text.indexOf(text) >= 0) {
15256
- matchData.push(docTextData[i]);
15254
+ // if (docTextData[i].text.indexOf(text) >= 0) {
15255
+ // matchData.push(docTextData[i]);
15256
+ // }
15257
+ const matchAll = docTextData[i].text.matchAll(new RegExp(`${text}`, 'g'));
15258
+ for (let regExpMatchArray of matchAll) {
15259
+ console.log(regExpMatchArray);
15257
15260
  }
15258
15261
  }
15259
- console.log(matchData);
15260
15262
  }
15261
15263
  getElementTextData(ele) {
15262
15264
  const arr = [];
@@ -15877,7 +15879,7 @@ class CanvasTextEditor {
15877
15879
  this.viewOptions = new ViewOptions();
15878
15880
  this.documentSelection = new DocumentSelection();
15879
15881
  this.docCtx = new EditorContext(this.documentSelection.selectionState, this.viewOptions);
15880
- this.viewOptions.copyRightInfo = '万达信息电子病历编辑器,www.wondersgroup.com';
15882
+ this.viewOptions.copyRightInfo = '电子病历编辑器(XXX版权所有)';
15881
15883
  this.viewOptions.drawCharRectColor = 'green';
15882
15884
  this.viewOptions.showLineRect = true;
15883
15885
  this.viewOptions.docSpace = 20;
@@ -16396,6 +16398,9 @@ class CanvasTextEditor {
16396
16398
  return null;
16397
16399
  }
16398
16400
  const para = ElementUtil.getParentByType(selectionState.startControl, ParagraphElement);
16401
+ if (!para) {
16402
+ return null;
16403
+ }
16399
16404
  return para.props;
16400
16405
  }
16401
16406
  setTextFormat(newProps) {
@@ -16622,6 +16627,14 @@ class CanvasTextEditor {
16622
16627
  }
16623
16628
  return this.documentChange.insertElement(targetElement, targetOffset, destEleArray);
16624
16629
  }
16630
+ /**
16631
+ * 插入新元素
16632
+ * @param ele
16633
+ */
16634
+ insertNewElement(ele) {
16635
+ const { startControl, startOffset } = this.selectionState;
16636
+ this.insertElement(startControl, startOffset, [ele]);
16637
+ }
16625
16638
  showHistory() {
16626
16639
  //console.log(History.ops);
16627
16640
  const newPara = new ParagraphElement();