@hailin-zheng/editor-core 2.2.18 → 2.2.20

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
@@ -4204,8 +4204,9 @@ function exportDataEleDecoratorSVG$1(event, r) {
4204
4204
  //绘制背景
4205
4205
  if (['all', 'background'].includes(mode)) {
4206
4206
  const bgX = event.relativePagePos.x;
4207
- const bgY = event.relativePagePos.y;
4208
- event.highlights.push(ElementUtil.getFillSvgRect(bgX, bgY, r.rect.width, r.rect.height, color));
4207
+ const bgY = event.relativePagePos.y + 1;
4208
+ //+1,-2,放置渲染元素边框被遮挡
4209
+ event.highlights.push(ElementUtil.getFillSvgRect(bgX, bgY, r.rect.width, r.rect.height - 2, color));
4209
4210
  }
4210
4211
  if (['all', 'outline'].includes(mode)) {
4211
4212
  color = event.options.dataEleOutlineColor;
@@ -18563,6 +18564,13 @@ class DocumentChange {
18563
18564
  }
18564
18565
  let pasteText = evt.clipboardData?.getData('text/plain') ?? '';
18565
18566
  const pasteData = evt.clipboardData?.getData('doc/plain') ?? '';
18567
+ this.onInsertContent({ text: pasteText, doc: pasteData });
18568
+ }
18569
+ /**
18570
+ * 在光标处插入内容
18571
+ * @param data
18572
+ */
18573
+ onInsertContent(data) {
18566
18574
  const { collapsed } = this.selectionState;
18567
18575
  if (!collapsed) {
18568
18576
  //TODO:如果一个容器内的元素被全部删除,则返回 null
@@ -18571,12 +18579,12 @@ class DocumentChange {
18571
18579
  // startOffset = cursorOffset;
18572
18580
  this.onRangeDelete();
18573
18581
  const cb = () => {
18574
- this.handlePasteContent({ text: pasteText, doc: pasteData }, this.selectionState);
18582
+ this.handlePasteContent({ text: data.text, doc: data.doc }, this.selectionState);
18575
18583
  };
18576
18584
  this.docCtx.onNextView(cb);
18577
18585
  return;
18578
18586
  }
18579
- this.handlePasteContent({ text: pasteText, doc: pasteData }, this.selectionState);
18587
+ this.handlePasteContent({ text: data.text, doc: data.doc }, this.selectionState);
18580
18588
  }
18581
18589
  /**
18582
18590
  * 处理粘贴的内容
@@ -22444,7 +22452,7 @@ class DocEditor {
22444
22452
  rule.setRuleOptions({ width: this.viewOptions.docPageSettings.width, pagePL, pagePR, docLeft });
22445
22453
  }
22446
22454
  version() {
22447
- return "2.2.18";
22455
+ return "2.2.20";
22448
22456
  }
22449
22457
  switchPageHeaderEditor() {
22450
22458
  this.docCtx.document.switchPageHeaderEditor(this.selectionState, null);
@@ -22791,6 +22799,13 @@ class DocEditor {
22791
22799
  removeEleAttribute(ele, attr) {
22792
22800
  ElementUtil.removeEleAttribute(ele, attr);
22793
22801
  }
22802
+ /**
22803
+ * 在光标处插入内容
22804
+ * @param data
22805
+ */
22806
+ insertContent(data) {
22807
+ this.documentChange.onInsertContent(data);
22808
+ }
22794
22809
  }
22795
22810
 
22796
22811
  /**