@hailin-zheng/editor-core 2.1.6 → 2.1.8

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
@@ -320,7 +320,8 @@ class RenderObject {
320
320
  data: {
321
321
  ns: "http://www.w3.org/2000/svg",
322
322
  attrs: {
323
- transform: `translate(${this.rect.x},${this.rect.y})`
323
+ //transform: `translate(${this.rect.x},${this.rect.y})`
324
+ translate: { x: this.rect.x, y: this.rect.y }
324
325
  }
325
326
  }
326
327
  };
@@ -697,6 +698,35 @@ class CommonUtil {
697
698
  }
698
699
  return true;
699
700
  }
701
+ static debounce(fn, wait) {
702
+ let timeout;
703
+ let lastExecTime = 0;
704
+ return function (...args) {
705
+ const context = this;
706
+ const elapsed = Date.now() - lastExecTime;
707
+ const shouldCallNow = elapsed >= wait;
708
+ clearTimeout(timeout);
709
+ if (shouldCallNow) {
710
+ fn.apply(context, args);
711
+ lastExecTime = Date.now();
712
+ }
713
+ else {
714
+ timeout = setTimeout(() => {
715
+ fn.apply(context, args);
716
+ lastExecTime = Date.now();
717
+ }, wait - elapsed);
718
+ }
719
+ };
720
+ }
721
+ static btoa(str) {
722
+ // 将SVG字符串转换为UTF-8编码的字节数组
723
+ const encoder = new TextEncoder();
724
+ encoder.encode(str);
725
+ // 将字节数组编码为Base64字符串
726
+ //return btoa(String.fromCharCode.apply(null, svgArray));
727
+ return btoa(unescape(encodeURIComponent(str)));
728
+ //return btoa(str.replace(/[\u00A0-\u2666]/g, c => `&#${c.charCodeAt(0)};`));
729
+ }
700
730
  }
701
731
 
702
732
  const docOpsMap = new Map();
@@ -867,7 +897,7 @@ function getExactDiffProps(oldProps, newProps) {
867
897
  function generatePatch(doc) {
868
898
  const insertOpsMap = new Map();
869
899
  const formatOpsMap = new Map();
870
- const patchs = [];
900
+ const patches = [];
871
901
  const ops = docOpsMap.get(doc);
872
902
  if (!ops || !ops.length) {
873
903
  return [];
@@ -898,11 +928,14 @@ function generatePatch(doc) {
898
928
  // op.prevIndex = log.prevIndex;
899
929
  // op.parentIndex = log.parentIndex;
900
930
  // }
901
- patchs.push({ index: op.index, parentIndex: op.parentIndex, prevIndex: op.prevIndex, ops: op.ops });
931
+ if ('insert' in op.ops) {
932
+ op.ops.insert = ele.clone(true);
933
+ }
934
+ patches.push({ index: op.index, parentIndex: op.parentIndex, prevIndex: op.prevIndex, ops: op.ops });
902
935
  }
903
936
  //清空
904
937
  ops.length = 0;
905
- return patchs;
938
+ return patches;
906
939
  }
907
940
  /**
908
941
  * 获取删除元素的操作
@@ -1078,7 +1111,10 @@ exports.ModifyFlag = void 0;
1078
1111
  const elementTypeEventHandler = [];
1079
1112
  function invokeTypeHandler(ele, eventName, e, useCapture = false) {
1080
1113
  const predicate = (ele, th) => {
1081
- if (CommonUtil.isConstructor(th.elementType)) {
1114
+ if (!th.elementTypeCategory) {
1115
+ th.elementTypeCategory = CommonUtil.isConstructor(th.elementType) ? 'constructor' : 'function';
1116
+ }
1117
+ if (th.elementTypeCategory === 'constructor') {
1082
1118
  return ele instanceof th.elementType;
1083
1119
  }
1084
1120
  else {
@@ -1141,6 +1177,7 @@ class Element {
1141
1177
  logUpdateEleProps(this, p, oldValue, newValue);
1142
1178
  this.pubOnChange('self');
1143
1179
  }
1180
+ key;
1144
1181
  //元素是否禁止复制,例如批注元素
1145
1182
  //forbidCopy: boolean;
1146
1183
  constructor(type) {
@@ -1152,6 +1189,7 @@ class Element {
1152
1189
  this.addEvent('ElementMouseLeave', (evt) => {
1153
1190
  this.isMouseenter = false;
1154
1191
  });
1192
+ this.key = nanoid.nanoid(5);
1155
1193
  }
1156
1194
  destroy() {
1157
1195
  this._eventMap?.clear(this);
@@ -1571,6 +1609,9 @@ class ViewOptions {
1571
1609
  trackDelColor = '#000';
1572
1610
  showLineRect;
1573
1611
  showCharRect;
1612
+ //数据元交互修饰模式
1613
+ dataEleDecoratorMode = 'outline';
1614
+ dataEleDecoratorColor = '#0050b3';
1574
1615
  showTabChar;
1575
1616
  showSpaceChar;
1576
1617
  showLineBreak;
@@ -3482,9 +3523,10 @@ class DocumentRenderObject extends BlockContainerRenderObject {
3482
3523
  data: {
3483
3524
  ns: "http://www.w3.org/2000/svg",
3484
3525
  attrs: {
3526
+ "xmlns": "http://www.w3.org/2000/svg",
3485
3527
  width: this.rect.width,
3486
- height: this.rect.height,
3487
- viewBox: `0 0 ${this.rect.width} ${this.rect.height}`,
3528
+ height: this.rect.height - 1,
3529
+ viewBox: `0 0 ${this.rect.width} ${this.rect.height - 1}`,
3488
3530
  overflow: "hidden"
3489
3531
  },
3490
3532
  },
@@ -3926,8 +3968,21 @@ function drawDecorator(e, r) {
3926
3968
  }
3927
3969
  function exportDecoratorHTML(event, r) {
3928
3970
  const canPaint = r.element.isMouseenter || r.element.isFocused;
3929
- if (canPaint) {
3930
- const strokeColor = '#0050b3';
3971
+ if (!canPaint) {
3972
+ return;
3973
+ }
3974
+ const mode = event.options.dataEleDecoratorMode;
3975
+ const color = event.options.dataEleDecoratorColor;
3976
+ if (mode === 'none') {
3977
+ return;
3978
+ }
3979
+ if (mode === 'overlay') {
3980
+ const bgX = event.relativePagePos.x;
3981
+ const bgY = event.relativePagePos.y;
3982
+ event.highlights.push(ElementUtil.getFillSvgRect(bgX, bgY, r.rect.width, r.rect.height, color));
3983
+ return;
3984
+ }
3985
+ else if (mode === 'outline') {
3931
3986
  const verOffset = 0;
3932
3987
  const renderPosMap = getCurrentParaGroupRenders(r).map(item => ({ pos: getRenderPosToDoc(item), render: item }));
3933
3988
  if (renderPosMap.length > 1) {
@@ -3961,7 +4016,7 @@ function exportDecoratorHTML(event, r) {
3961
4016
  ns: 'http://www.w3.org/2000/svg',
3962
4017
  attrs: {
3963
4018
  d: path,
3964
- stroke: strokeColor,
4019
+ stroke: color,
3965
4020
  fill: 'none',
3966
4021
  'stroke-width': 1
3967
4022
  }
@@ -4077,15 +4132,7 @@ class DocumentBodyRenderObject extends MuiltBlockLineRenderObject {
4077
4132
  return cloneRender;
4078
4133
  }
4079
4134
  exportHTML(event) {
4080
- const t = {
4081
- sel: "g",
4082
- data: {
4083
- ns: "http://www.w3.org/2000/svg",
4084
- attrs: {
4085
- transform: `translate(${this.rect.x},${this.rect.y})`
4086
- }
4087
- }
4088
- };
4135
+ const t = super.exportHTML(event);
4089
4136
  if (this.element.disableClick && event.mode === 'view') {
4090
4137
  t.data.attrs['opacity'] = 0.5;
4091
4138
  }
@@ -4289,16 +4336,7 @@ class DocumentHeaderRenderObject extends BlockContainerRenderObject {
4289
4336
  }
4290
4337
  };
4291
4338
  }
4292
- const t = {
4293
- sel: "g",
4294
- data: {
4295
- ns: "http://www.w3.org/2000/svg",
4296
- attrs: {
4297
- transform: `translate(${this.rect.x},${this.rect.y})`
4298
- }
4299
- },
4300
- children: []
4301
- };
4339
+ const t = super.exportHTML(event);
4302
4340
  // if (this.element.disableClick && event.mode === 'view') {
4303
4341
  // t.data.attrs.opacity = 0.5;
4304
4342
  // }
@@ -4867,7 +4905,8 @@ class TextGroupRenderObject extends LeafRenderObject {
4867
4905
  data: {
4868
4906
  ns: "http://www.w3.org/2000/svg",
4869
4907
  attrs: {
4870
- "transform": `translate(0,${(height - props.fontSize) / 2})`,
4908
+ //"transform": `translate(0,${(height - props.fontSize) / 2})`,
4909
+ "translate": { x: 0, y: (height - props.fontSize) / 2 },
4871
4910
  'dominant-baseline': 'hanging',
4872
4911
  'font-family': this.element.props.fontName,
4873
4912
  'font-size': fontSize,
@@ -7251,7 +7290,7 @@ class CommentRenderObject extends LeafRenderObject {
7251
7290
  data: {
7252
7291
  ns: 'http://www.w3.org/2000/svg',
7253
7292
  attrs: {
7254
- transform: `translate(0, ${paraLinePos.y - renderPos.y})`,
7293
+ translate: { x: 0, y: paraLinePos.y - renderPos.y },
7255
7294
  width: 2,
7256
7295
  height: paraLinePos.height,
7257
7296
  fill: color
@@ -8640,7 +8679,7 @@ class DataElementDate extends DataElementInlineGroup {
8640
8679
  return super.cloneSelf(data, DataElementDate);
8641
8680
  }
8642
8681
  setValue(val) {
8643
- if (val === null) {
8682
+ if (val === null || typeof val === 'undefined') {
8644
8683
  this.clearInnerItems();
8645
8684
  this.props.value = '';
8646
8685
  return;
@@ -9644,7 +9683,7 @@ function renderMHHTML(event, element, isPaint, nodes = []) {
9644
9683
  data: {
9645
9684
  ns: "http://www.w3.org/2000/svg",
9646
9685
  attrs: {
9647
- transform: `translate(${x},${y + (height - leftRect.height) / 2})`,
9686
+ translate: { x, y: y + (height - leftRect.height) / 2 },
9648
9687
  'dominant-baseline': 'Hanging',
9649
9688
  'font-family': defaultTextProps.fontName,
9650
9689
  'font-size': defaultTextProps.fontSize,
@@ -9661,7 +9700,7 @@ function renderMHHTML(event, element, isPaint, nodes = []) {
9661
9700
  data: {
9662
9701
  ns: "http://www.w3.org/2000/svg",
9663
9702
  attrs: {
9664
- transform: `translate(${x + (middleWidth - topRect.width) / 2},${y - 2})`,
9703
+ translate: { x: x + (middleWidth - topRect.width) / 2, y: y - 2 },
9665
9704
  'dominant-baseline': 'Hanging',
9666
9705
  'font-family': defaultTextProps.fontName,
9667
9706
  'font-size': defaultTextProps.fontSize,
@@ -9680,7 +9719,7 @@ function renderMHHTML(event, element, isPaint, nodes = []) {
9680
9719
  data: {
9681
9720
  ns: "http://www.w3.org/2000/svg",
9682
9721
  attrs: {
9683
- transform: `translate(${x + (middleWidth - bottomRect.width) / 2},${y + topRect.height + 2})`,
9722
+ translate: { x: x + (middleWidth - bottomRect.width) / 2, y: y + topRect.height + 2 },
9684
9723
  'dominant-baseline': 'Hanging',
9685
9724
  'font-family': defaultTextProps.fontName,
9686
9725
  'font-size': defaultTextProps.fontSize,
@@ -9697,7 +9736,7 @@ function renderMHHTML(event, element, isPaint, nodes = []) {
9697
9736
  data: {
9698
9737
  ns: "http://www.w3.org/2000/svg",
9699
9738
  attrs: {
9700
- transform: `translate(${x},${y + (height - leftRect.height) / 2})`,
9739
+ translate: { x, y: y + (height - leftRect.height) / 2 },
9701
9740
  'dominant-baseline': 'Hanging',
9702
9741
  'font-family': defaultTextProps.fontName,
9703
9742
  'font-size': defaultTextProps.fontSize,
@@ -19965,10 +20004,7 @@ class DocumentChange {
19965
20004
  insertSoftBr() {
19966
20005
  let { startControl, startOffset } = this.selectionState;
19967
20006
  const lastEle = this.insertElement(startControl, startOffset, [new BreakElement()]);
19968
- const focusEle = ElementUtil.getNextSiblingElement(lastEle);
19969
- if (focusEle) {
19970
- this.selectionState.resetRange(focusEle, 0);
19971
- }
20007
+ this.selectionState.resetRange(lastEle, -1);
19972
20008
  }
19973
20009
  insertPageBreakSymbol() {
19974
20010
  let { startControl, startOffset } = this.selectionState;
@@ -20286,19 +20322,20 @@ function createPrintTemplate({ width, height, orient }) {
20286
20322
  -moz-box-sizing: border-box;
20287
20323
  }
20288
20324
  @page {
20289
- size: ${orient};
20325
+ size: ${width}px ${height - 1}px ${orient};
20290
20326
  margin: 0;
20291
20327
  }
20292
20328
  div {
20293
- width: ${width}mm;
20294
- min-height: ${height}mm;
20329
+ width: ${width}px;
20330
+ min-height: ${height - 1}px;
20331
+ overflow: hidden;
20295
20332
  font-size: 0;
20296
20333
  }
20297
20334
  @media print {
20298
20335
  html,
20299
20336
  body {
20300
- width: ${width}mm;
20301
- height: ${height}mm;
20337
+ width: ${width}px;
20338
+ height: ${height - 1}px;
20302
20339
  }
20303
20340
  div {
20304
20341
  width: initial;
@@ -20329,7 +20366,7 @@ function printNodes(printNodes, options, printEvent = null) {
20329
20366
  console.warn('无可打印节点');
20330
20367
  return;
20331
20368
  }
20332
- const printSize = new PageOptions(options.width, options.height, options.orient);
20369
+ const printSize = options;
20333
20370
  const iframeHTML = createPrintTemplate(printSize);
20334
20371
  printIFrame.contentWindow?.document.write(iframeHTML);
20335
20372
  printIFrame.contentWindow?.document.close();
@@ -20355,18 +20392,6 @@ function printNodes(printNodes, options, printEvent = null) {
20355
20392
  }
20356
20393
  printIFrame.onload = () => {
20357
20394
  setTimeout(() => {
20358
- printIFrame.contentWindow?.window.matchMedia('print').addListener(function (query) {
20359
- if (!query.matches) {
20360
- console.log('用户已经打印');
20361
- // 执行打印完成后需要执行的代码
20362
- }
20363
- });
20364
- printIFrame.contentWindow?.window.matchMedia('screen').addListener(function (query) {
20365
- if (!query.matches) {
20366
- console.log('用户已经打印');
20367
- // 执行打印完成后需要执行的代码
20368
- }
20369
- });
20370
20395
  printIFrame.contentWindow?.print();
20371
20396
  printIFrame.parentNode?.removeChild(printIFrame);
20372
20397
  }, 0);
@@ -21127,6 +21152,40 @@ class DocumentSvg {
21127
21152
  }
21128
21153
  }
21129
21154
  selectionRects.push(...selectionRectsTemp);
21155
+ // if (currVNode && currVNode.data?.attrs?.transform) {
21156
+ // currVNode.data.attrs.transform = `translate(${currVNode.data?.attrs?.transform.x},${currVNode.data?.attrs?.transform.y})`
21157
+ // }
21158
+ if (currVNode && currVNode.children) {
21159
+ let translateX = 0, translateY = 0;
21160
+ let line = false;
21161
+ if (render instanceof ParagraphLineRectRenderObject) {
21162
+ translateX = render.rect.x;
21163
+ translateY = render.rect.y;
21164
+ line = true;
21165
+ }
21166
+ currVNode.children.forEach(item => {
21167
+ if (item && item.data?.attrs?.translate && !item.data?.attrs?.transform) {
21168
+ item.data.attrs.transform = `translate(${item.data.attrs.translate.x + translateX},${item.data.attrs.translate.y + translateY})`;
21169
+ delete item.data.attrs.translate;
21170
+ }
21171
+ if (line && !item.data.attrs.transform) {
21172
+ item.data.attrs.transform = `translate(${translateX},${translateY})`;
21173
+ }
21174
+ // if (item && item.data?.attrs?.transform && typeof item.data?.attrs?.transform === 'object') {
21175
+ // item.data.attrs.transform = `translate(${item.data.attrs.transform.x + translateX},${item.data.attrs.transform.y + translateY})`
21176
+ // } else {
21177
+ // if (line && !item.data.attrs.transform) {
21178
+ // item.data.attrs.transform = `translate(${translateX},${translateY})`;
21179
+ // }
21180
+ // }
21181
+ });
21182
+ if (line) {
21183
+ return currVNode.children;
21184
+ }
21185
+ }
21186
+ if (currVNode && render.element) {
21187
+ currVNode.key = render.element.key + render.element.paintRenders.indexOf(render);
21188
+ }
21130
21189
  return currVNode;
21131
21190
  }
21132
21191
  getHTMLVNode(docRenders) {
@@ -21144,11 +21203,7 @@ class DocumentSvg {
21144
21203
  position: 'absolute',
21145
21204
  background: 'white',
21146
21205
  "box-shadow": "rgba(158, 161, 165, 0.4) 0px 2px 12px 0px",
21147
- },
21148
- hook: {
21149
- insert: (vnode) => {
21150
- }
21151
- },
21206
+ }
21152
21207
  },
21153
21208
  children: [pageSvg]
21154
21209
  };
@@ -21158,8 +21213,8 @@ class DocumentSvg {
21158
21213
  }
21159
21214
  /**
21160
21215
  * 判断当前元素是否在视窗内
21161
- * @param rect
21162
21216
  * @private
21217
+ * @param item
21163
21218
  */
21164
21219
  checkInViewBox(item) {
21165
21220
  if (!this.viewOptions.virtualViewMode || this.mode === 'print') {
@@ -26234,46 +26289,31 @@ class DocumentPrintOffscreenBase {
26234
26289
  * 续打
26235
26290
  */
26236
26291
  async printForContinuation(data, options) {
26237
- // const sub = this.beforeRenderEvent.subscribe((event) => {
26238
- // const {index, renderCtx, docRender, pageSvgVNode} = event;
26239
- // if (index === options.startDocIndex) {
26240
- // const bodyRender = docRender.getChild(1);
26241
- // let x = 0, y = options.startY, width = bodyRender.rect.width,
26242
- // height = bodyRender.rect.height - (options.startY - bodyRender.rect.y);
26243
- // if (options.startDocIndex === options.endDocIndex) {
26244
- // height = options.endY - options.startY;
26245
- // }
26246
- // renderCtx.mainContext.clip(x, y, width, height);
26247
- // }
26248
- // });
26249
26292
  this.afterRenderEvent.subscribe((event) => {
26250
26293
  const { index, renderCtx, docRender, pageSvgVNode } = event;
26251
26294
  if (index === options.startDocIndex && options.startY !== 0) {
26252
26295
  const bodyRender = docRender.getChild(1);
26253
- let x = bodyRender.rect.x, y = options.startY, width = bodyRender.rect.width, height = bodyRender.rect.height - (options.startY - bodyRender.rect.y);
26254
- // if (options.startDocIndex === options.endDocIndex) {
26255
- // height = options.endY - options.startY;
26256
- // }
26296
+ let x = bodyRender.rect.x, y = options.startY, width = bodyRender.rect.width,
26297
+ //由于body下面紧跟着页脚线,由于虚打不需要绘制该线,因此要裁剪掉2个像素
26298
+ height = bodyRender.rect.height - (options.startY - bodyRender.rect.y) - 2;
26257
26299
  const pageClip = ElementUtil.createClipPath('page-clip-' + index, width, height, x, y);
26258
26300
  //pageSvgVNode.children?.push(pageClip)
26259
26301
  pageSvgVNode.children?.push(pageClip);
26260
26302
  pageSvgVNode.data.attrs['clip-path'] = `url(#${'page-clip-' + index})`;
26261
26303
  }
26262
- // if (options.startDocIndex !== options.endDocIndex && index === options.endDocIndex) {
26263
- // const bodyRender = docRender.getChild(1);
26264
- // const height = bodyRender.rect.height - (options.endY - bodyRender.rect.y);
26265
- // renderCtx.contentContext.clearRect(bodyRender.rect.x, options.endY, bodyRender.rect.width, height);
26266
- // }
26267
26304
  });
26268
26305
  await this.prepare(data);
26269
26306
  const printRanges = new Array(this.documentPaint.docPages.length).fill(0).map((item, index) => index).filter(index => index >= options.startDocIndex);
26270
- const canvasNodes = this.getSvgNodes(this.documentPaint.docPages, printRanges);
26271
- if (!canvasNodes.length) {
26307
+ let svgNodes = this.getSvgNodes(this.documentPaint.docPages, printRanges);
26308
+ if (!svgNodes.length) {
26272
26309
  console.warn('无可打印页');
26273
26310
  return;
26274
26311
  }
26275
- const docProps = this.docCtx.document.props;
26276
- printNodes(canvasNodes, { ...docProps });
26312
+ const docProps = this.docCtx.viewOptions.docPageSettings;
26313
+ // if (docProps.orient === 'landscape') {
26314
+ // svgNodes = svgNodes.map(item => 'data:image/svg+xml;base64,' + CommonUtil.btoa(item)).map(item => `<img src="${item}" width="${docProps.width}px" height="${docProps.height-1}px" style="display: block"/>`);
26315
+ // }
26316
+ printNodes(svgNodes, docProps);
26277
26317
  }
26278
26318
  // /**
26279
26319
  // * 获取绘制的图片,格式为Base64编码
@@ -26292,6 +26332,9 @@ class DocumentPrintOffscreenBase {
26292
26332
  const canvasNodes = this.getSvgNodes(this.documentPaint.docPages, ranges);
26293
26333
  return canvasNodes;
26294
26334
  }
26335
+ Encode64(str) {
26336
+ return btoa(encodeURIComponent(str));
26337
+ }
26295
26338
  /**
26296
26339
  * 读取数据,排版
26297
26340
  * @param data
@@ -26341,7 +26384,7 @@ class DocumentPrintOffscreenBase {
26341
26384
  modules.class,
26342
26385
  modules.props,
26343
26386
  modules.attributes,
26344
- modules.style
26387
+ modules.style,
26345
26388
  ]);
26346
26389
  // const pageSvgVNodes = docRenders.filter((item, index) =>
26347
26390
  // !printRanges || printRanges.indexOf(index) >= 0)
@@ -26653,6 +26696,17 @@ class EditorCalendarVNode {
26653
26696
  sel: 'div.editor-calendar-footer-right',
26654
26697
  data: {},
26655
26698
  children: [{
26699
+ sel: 'div.editor-calendar-footer-right-btn',
26700
+ data: {
26701
+ on: {
26702
+ click: () => {
26703
+ this.onSetValue.next(undefined);
26704
+ }
26705
+ }
26706
+ },
26707
+ text: '清除'
26708
+ },
26709
+ {
26656
26710
  sel: 'div.editor-calendar-footer-right-btn',
26657
26711
  data: {
26658
26712
  on: {
@@ -27682,10 +27736,22 @@ class DocEditor {
27682
27736
  * 处理全选当前段落
27683
27737
  */
27684
27738
  docDblClickHandle(evt) {
27685
- const res = getFocusTextSegment(this.selectionState);
27686
- if (res) {
27739
+ //1.如果在数据元中双击,则默认选中数据元内部的所有内容
27740
+ const currDataEle = this.getCurrentDataElement();
27741
+ if (currDataEle && currDataEle instanceof DataElementInlineGroup && currDataEle.length > 2 && this.selectionState.startControl instanceof TextGroupElement) {
27742
+ const range = new SelectionRange();
27743
+ range.setStart(currDataEle.startDecorate, 1);
27744
+ range.setEnd(currDataEle.endDecorate, 0);
27745
+ this.selectionState.addRange(range);
27687
27746
  this.flushToSchedule();
27688
27747
  }
27748
+ else {
27749
+ //2.默认选词
27750
+ const res = getFocusTextSegment(this.selectionState);
27751
+ if (res) {
27752
+ this.flushToSchedule();
27753
+ }
27754
+ }
27689
27755
  this.updateSelection();
27690
27756
  this.onDblClickEvent.next(evt);
27691
27757
  }
@@ -28326,9 +28392,12 @@ class DocEditor {
28326
28392
  //console.timeEnd('patch');
28327
28393
  };
28328
28394
  render();
28329
- this.onShouldRender.subscribe(() => {
28395
+ // this.onShouldRender.subscribe(() => {
28396
+ // render();
28397
+ // });
28398
+ this.onShouldRender.subscribe(CommonUtil.debounce(() => {
28330
28399
  render();
28331
- });
28400
+ }, 32));
28332
28401
  }
28333
28402
  /**
28334
28403
  * 留痕提示的容器框,用于渲染后重新计算纵向位置
@@ -28669,7 +28738,7 @@ class DocEditor {
28669
28738
  rule.setRuleOptions({ width: this.viewOptions.docPageSettings.width, pagePL, pagePR, docLeft });
28670
28739
  }
28671
28740
  version() {
28672
- return "2.1.6";
28741
+ return "2.1.8";
28673
28742
  }
28674
28743
  }
28675
28744