@hailin-zheng/editor-core 2.2.18 → 2.2.19

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
@@ -4233,8 +4233,9 @@ function exportDataEleDecoratorSVG$1(event, r) {
4233
4233
  //绘制背景
4234
4234
  if (['all', 'background'].includes(mode)) {
4235
4235
  const bgX = event.relativePagePos.x;
4236
- const bgY = event.relativePagePos.y;
4237
- event.highlights.push(ElementUtil.getFillSvgRect(bgX, bgY, r.rect.width, r.rect.height, color));
4236
+ const bgY = event.relativePagePos.y + 1;
4237
+ //+1,-2,放置渲染元素边框被遮挡
4238
+ event.highlights.push(ElementUtil.getFillSvgRect(bgX, bgY, r.rect.width, r.rect.height - 2, color));
4238
4239
  }
4239
4240
  if (['all', 'outline'].includes(mode)) {
4240
4241
  color = event.options.dataEleOutlineColor;
@@ -18592,6 +18593,13 @@ class DocumentChange {
18592
18593
  }
18593
18594
  let pasteText = evt.clipboardData?.getData('text/plain') ?? '';
18594
18595
  const pasteData = evt.clipboardData?.getData('doc/plain') ?? '';
18596
+ this.onInsertContent({ text: pasteText, doc: pasteData });
18597
+ }
18598
+ /**
18599
+ * 在光标处插入内容
18600
+ * @param data
18601
+ */
18602
+ onInsertContent(data) {
18595
18603
  const { collapsed } = this.selectionState;
18596
18604
  if (!collapsed) {
18597
18605
  //TODO:如果一个容器内的元素被全部删除,则返回 null
@@ -18600,12 +18608,12 @@ class DocumentChange {
18600
18608
  // startOffset = cursorOffset;
18601
18609
  this.onRangeDelete();
18602
18610
  const cb = () => {
18603
- this.handlePasteContent({ text: pasteText, doc: pasteData }, this.selectionState);
18611
+ this.handlePasteContent({ text: data.text, doc: data.doc }, this.selectionState);
18604
18612
  };
18605
18613
  this.docCtx.onNextView(cb);
18606
18614
  return;
18607
18615
  }
18608
- this.handlePasteContent({ text: pasteText, doc: pasteData }, this.selectionState);
18616
+ this.handlePasteContent({ text: data.text, doc: data.doc }, this.selectionState);
18609
18617
  }
18610
18618
  /**
18611
18619
  * 处理粘贴的内容
@@ -22473,7 +22481,7 @@ class DocEditor {
22473
22481
  rule.setRuleOptions({ width: this.viewOptions.docPageSettings.width, pagePL, pagePR, docLeft });
22474
22482
  }
22475
22483
  version() {
22476
- return "2.2.18";
22484
+ return "2.2.19";
22477
22485
  }
22478
22486
  switchPageHeaderEditor() {
22479
22487
  this.docCtx.document.switchPageHeaderEditor(this.selectionState, null);
@@ -22820,6 +22828,13 @@ class DocEditor {
22820
22828
  removeEleAttribute(ele, attr) {
22821
22829
  ElementUtil.removeEleAttribute(ele, attr);
22822
22830
  }
22831
+ /**
22832
+ * 在光标处插入内容
22833
+ * @param data
22834
+ */
22835
+ onInsertContent(data) {
22836
+ this.documentChange.onInsertContent(data);
22837
+ }
22823
22838
  }
22824
22839
 
22825
22840
  /**