@hailin-zheng/editor-core 2.1.6 → 2.1.7

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
@@ -291,7 +291,8 @@ class RenderObject {
291
291
  data: {
292
292
  ns: "http://www.w3.org/2000/svg",
293
293
  attrs: {
294
- transform: `translate(${this.rect.x},${this.rect.y})`
294
+ //transform: `translate(${this.rect.x},${this.rect.y})`
295
+ translate: { x: this.rect.x, y: this.rect.y }
295
296
  }
296
297
  }
297
298
  };
@@ -668,6 +669,35 @@ class CommonUtil {
668
669
  }
669
670
  return true;
670
671
  }
672
+ static debounce(fn, wait) {
673
+ let timeout;
674
+ let lastExecTime = 0;
675
+ return function (...args) {
676
+ const context = this;
677
+ const elapsed = Date.now() - lastExecTime;
678
+ const shouldCallNow = elapsed >= wait;
679
+ clearTimeout(timeout);
680
+ if (shouldCallNow) {
681
+ fn.apply(context, args);
682
+ lastExecTime = Date.now();
683
+ }
684
+ else {
685
+ timeout = setTimeout(() => {
686
+ fn.apply(context, args);
687
+ lastExecTime = Date.now();
688
+ }, wait - elapsed);
689
+ }
690
+ };
691
+ }
692
+ static btoa(str) {
693
+ // 将SVG字符串转换为UTF-8编码的字节数组
694
+ const encoder = new TextEncoder();
695
+ encoder.encode(str);
696
+ // 将字节数组编码为Base64字符串
697
+ //return btoa(String.fromCharCode.apply(null, svgArray));
698
+ return btoa(unescape(encodeURIComponent(str)));
699
+ //return btoa(str.replace(/[\u00A0-\u2666]/g, c => `&#${c.charCodeAt(0)};`));
700
+ }
671
701
  }
672
702
 
673
703
  const docOpsMap = new Map();
@@ -838,7 +868,7 @@ function getExactDiffProps(oldProps, newProps) {
838
868
  function generatePatch(doc) {
839
869
  const insertOpsMap = new Map();
840
870
  const formatOpsMap = new Map();
841
- const patchs = [];
871
+ const patches = [];
842
872
  const ops = docOpsMap.get(doc);
843
873
  if (!ops || !ops.length) {
844
874
  return [];
@@ -869,11 +899,14 @@ function generatePatch(doc) {
869
899
  // op.prevIndex = log.prevIndex;
870
900
  // op.parentIndex = log.parentIndex;
871
901
  // }
872
- patchs.push({ index: op.index, parentIndex: op.parentIndex, prevIndex: op.prevIndex, ops: op.ops });
902
+ if ('insert' in op.ops) {
903
+ op.ops.insert = ele.clone(true);
904
+ }
905
+ patches.push({ index: op.index, parentIndex: op.parentIndex, prevIndex: op.prevIndex, ops: op.ops });
873
906
  }
874
907
  //清空
875
908
  ops.length = 0;
876
- return patchs;
909
+ return patches;
877
910
  }
878
911
  /**
879
912
  * 获取删除元素的操作
@@ -1049,7 +1082,10 @@ var ModifyFlag$1;
1049
1082
  const elementTypeEventHandler = [];
1050
1083
  function invokeTypeHandler(ele, eventName, e, useCapture = false) {
1051
1084
  const predicate = (ele, th) => {
1052
- if (CommonUtil.isConstructor(th.elementType)) {
1085
+ if (!th.elementTypeCategory) {
1086
+ th.elementTypeCategory = CommonUtil.isConstructor(th.elementType) ? 'constructor' : 'function';
1087
+ }
1088
+ if (th.elementTypeCategory === 'constructor') {
1053
1089
  return ele instanceof th.elementType;
1054
1090
  }
1055
1091
  else {
@@ -1112,6 +1148,7 @@ class Element {
1112
1148
  logUpdateEleProps(this, p, oldValue, newValue);
1113
1149
  this.pubOnChange('self');
1114
1150
  }
1151
+ key;
1115
1152
  //元素是否禁止复制,例如批注元素
1116
1153
  //forbidCopy: boolean;
1117
1154
  constructor(type) {
@@ -1123,6 +1160,7 @@ class Element {
1123
1160
  this.addEvent('ElementMouseLeave', (evt) => {
1124
1161
  this.isMouseenter = false;
1125
1162
  });
1163
+ this.key = nanoid(5);
1126
1164
  }
1127
1165
  destroy() {
1128
1166
  this._eventMap?.clear(this);
@@ -1542,6 +1580,9 @@ class ViewOptions {
1542
1580
  trackDelColor = '#000';
1543
1581
  showLineRect;
1544
1582
  showCharRect;
1583
+ //数据元交互修饰模式
1584
+ dataEleDecoratorMode = 'outline';
1585
+ dataEleDecoratorColor = '#0050b3';
1545
1586
  showTabChar;
1546
1587
  showSpaceChar;
1547
1588
  showLineBreak;
@@ -3453,9 +3494,10 @@ class DocumentRenderObject extends BlockContainerRenderObject {
3453
3494
  data: {
3454
3495
  ns: "http://www.w3.org/2000/svg",
3455
3496
  attrs: {
3497
+ "xmlns": "http://www.w3.org/2000/svg",
3456
3498
  width: this.rect.width,
3457
- height: this.rect.height,
3458
- viewBox: `0 0 ${this.rect.width} ${this.rect.height}`,
3499
+ height: this.rect.height - 1,
3500
+ viewBox: `0 0 ${this.rect.width} ${this.rect.height - 1}`,
3459
3501
  overflow: "hidden"
3460
3502
  },
3461
3503
  },
@@ -3897,8 +3939,21 @@ function drawDecorator(e, r) {
3897
3939
  }
3898
3940
  function exportDecoratorHTML(event, r) {
3899
3941
  const canPaint = r.element.isMouseenter || r.element.isFocused;
3900
- if (canPaint) {
3901
- const strokeColor = '#0050b3';
3942
+ if (!canPaint) {
3943
+ return;
3944
+ }
3945
+ const mode = event.options.dataEleDecoratorMode;
3946
+ const color = event.options.dataEleDecoratorColor;
3947
+ if (mode === 'none') {
3948
+ return;
3949
+ }
3950
+ if (mode === 'overlay') {
3951
+ const bgX = event.relativePagePos.x;
3952
+ const bgY = event.relativePagePos.y;
3953
+ event.highlights.push(ElementUtil.getFillSvgRect(bgX, bgY, r.rect.width, r.rect.height, color));
3954
+ return;
3955
+ }
3956
+ else if (mode === 'outline') {
3902
3957
  const verOffset = 0;
3903
3958
  const renderPosMap = getCurrentParaGroupRenders(r).map(item => ({ pos: getRenderPosToDoc(item), render: item }));
3904
3959
  if (renderPosMap.length > 1) {
@@ -3932,7 +3987,7 @@ function exportDecoratorHTML(event, r) {
3932
3987
  ns: 'http://www.w3.org/2000/svg',
3933
3988
  attrs: {
3934
3989
  d: path,
3935
- stroke: strokeColor,
3990
+ stroke: color,
3936
3991
  fill: 'none',
3937
3992
  'stroke-width': 1
3938
3993
  }
@@ -4048,15 +4103,7 @@ class DocumentBodyRenderObject extends MuiltBlockLineRenderObject {
4048
4103
  return cloneRender;
4049
4104
  }
4050
4105
  exportHTML(event) {
4051
- const t = {
4052
- sel: "g",
4053
- data: {
4054
- ns: "http://www.w3.org/2000/svg",
4055
- attrs: {
4056
- transform: `translate(${this.rect.x},${this.rect.y})`
4057
- }
4058
- }
4059
- };
4106
+ const t = super.exportHTML(event);
4060
4107
  if (this.element.disableClick && event.mode === 'view') {
4061
4108
  t.data.attrs['opacity'] = 0.5;
4062
4109
  }
@@ -4260,16 +4307,7 @@ class DocumentHeaderRenderObject extends BlockContainerRenderObject {
4260
4307
  }
4261
4308
  };
4262
4309
  }
4263
- const t = {
4264
- sel: "g",
4265
- data: {
4266
- ns: "http://www.w3.org/2000/svg",
4267
- attrs: {
4268
- transform: `translate(${this.rect.x},${this.rect.y})`
4269
- }
4270
- },
4271
- children: []
4272
- };
4310
+ const t = super.exportHTML(event);
4273
4311
  // if (this.element.disableClick && event.mode === 'view') {
4274
4312
  // t.data.attrs.opacity = 0.5;
4275
4313
  // }
@@ -4838,7 +4876,8 @@ class TextGroupRenderObject extends LeafRenderObject {
4838
4876
  data: {
4839
4877
  ns: "http://www.w3.org/2000/svg",
4840
4878
  attrs: {
4841
- "transform": `translate(0,${(height - props.fontSize) / 2})`,
4879
+ //"transform": `translate(0,${(height - props.fontSize) / 2})`,
4880
+ "translate": { x: 0, y: (height - props.fontSize) / 2 },
4842
4881
  'dominant-baseline': 'hanging',
4843
4882
  'font-family': this.element.props.fontName,
4844
4883
  'font-size': fontSize,
@@ -7222,7 +7261,7 @@ class CommentRenderObject extends LeafRenderObject {
7222
7261
  data: {
7223
7262
  ns: 'http://www.w3.org/2000/svg',
7224
7263
  attrs: {
7225
- transform: `translate(0, ${paraLinePos.y - renderPos.y})`,
7264
+ translate: { x: 0, y: paraLinePos.y - renderPos.y },
7226
7265
  width: 2,
7227
7266
  height: paraLinePos.height,
7228
7267
  fill: color
@@ -8611,7 +8650,7 @@ class DataElementDate extends DataElementInlineGroup {
8611
8650
  return super.cloneSelf(data, DataElementDate);
8612
8651
  }
8613
8652
  setValue(val) {
8614
- if (val === null) {
8653
+ if (val === null || typeof val === 'undefined') {
8615
8654
  this.clearInnerItems();
8616
8655
  this.props.value = '';
8617
8656
  return;
@@ -9615,7 +9654,7 @@ function renderMHHTML(event, element, isPaint, nodes = []) {
9615
9654
  data: {
9616
9655
  ns: "http://www.w3.org/2000/svg",
9617
9656
  attrs: {
9618
- transform: `translate(${x},${y + (height - leftRect.height) / 2})`,
9657
+ translate: { x, y: y + (height - leftRect.height) / 2 },
9619
9658
  'dominant-baseline': 'Hanging',
9620
9659
  'font-family': defaultTextProps.fontName,
9621
9660
  'font-size': defaultTextProps.fontSize,
@@ -9632,7 +9671,7 @@ function renderMHHTML(event, element, isPaint, nodes = []) {
9632
9671
  data: {
9633
9672
  ns: "http://www.w3.org/2000/svg",
9634
9673
  attrs: {
9635
- transform: `translate(${x + (middleWidth - topRect.width) / 2},${y - 2})`,
9674
+ translate: { x: x + (middleWidth - topRect.width) / 2, y: y - 2 },
9636
9675
  'dominant-baseline': 'Hanging',
9637
9676
  'font-family': defaultTextProps.fontName,
9638
9677
  'font-size': defaultTextProps.fontSize,
@@ -9651,7 +9690,7 @@ function renderMHHTML(event, element, isPaint, nodes = []) {
9651
9690
  data: {
9652
9691
  ns: "http://www.w3.org/2000/svg",
9653
9692
  attrs: {
9654
- transform: `translate(${x + (middleWidth - bottomRect.width) / 2},${y + topRect.height + 2})`,
9693
+ translate: { x: x + (middleWidth - bottomRect.width) / 2, y: y + topRect.height + 2 },
9655
9694
  'dominant-baseline': 'Hanging',
9656
9695
  'font-family': defaultTextProps.fontName,
9657
9696
  'font-size': defaultTextProps.fontSize,
@@ -9668,7 +9707,7 @@ function renderMHHTML(event, element, isPaint, nodes = []) {
9668
9707
  data: {
9669
9708
  ns: "http://www.w3.org/2000/svg",
9670
9709
  attrs: {
9671
- transform: `translate(${x},${y + (height - leftRect.height) / 2})`,
9710
+ translate: { x, y: y + (height - leftRect.height) / 2 },
9672
9711
  'dominant-baseline': 'Hanging',
9673
9712
  'font-family': defaultTextProps.fontName,
9674
9713
  'font-size': defaultTextProps.fontSize,
@@ -19936,10 +19975,7 @@ class DocumentChange {
19936
19975
  insertSoftBr() {
19937
19976
  let { startControl, startOffset } = this.selectionState;
19938
19977
  const lastEle = this.insertElement(startControl, startOffset, [new BreakElement()]);
19939
- const focusEle = ElementUtil.getNextSiblingElement(lastEle);
19940
- if (focusEle) {
19941
- this.selectionState.resetRange(focusEle, 0);
19942
- }
19978
+ this.selectionState.resetRange(lastEle, -1);
19943
19979
  }
19944
19980
  insertPageBreakSymbol() {
19945
19981
  let { startControl, startOffset } = this.selectionState;
@@ -20257,19 +20293,20 @@ function createPrintTemplate({ width, height, orient }) {
20257
20293
  -moz-box-sizing: border-box;
20258
20294
  }
20259
20295
  @page {
20260
- size: ${orient};
20296
+ size: ${width}px ${height - 1}px ${orient};
20261
20297
  margin: 0;
20262
20298
  }
20263
20299
  div {
20264
- width: ${width}mm;
20265
- min-height: ${height}mm;
20300
+ width: ${width}px;
20301
+ min-height: ${height - 1}px;
20302
+ overflow: hidden;
20266
20303
  font-size: 0;
20267
20304
  }
20268
20305
  @media print {
20269
20306
  html,
20270
20307
  body {
20271
- width: ${width}mm;
20272
- height: ${height}mm;
20308
+ width: ${width}px;
20309
+ height: ${height - 1}px;
20273
20310
  }
20274
20311
  div {
20275
20312
  width: initial;
@@ -20300,7 +20337,7 @@ function printNodes(printNodes, options, printEvent = null) {
20300
20337
  console.warn('无可打印节点');
20301
20338
  return;
20302
20339
  }
20303
- const printSize = new PageOptions(options.width, options.height, options.orient);
20340
+ const printSize = options;
20304
20341
  const iframeHTML = createPrintTemplate(printSize);
20305
20342
  printIFrame.contentWindow?.document.write(iframeHTML);
20306
20343
  printIFrame.contentWindow?.document.close();
@@ -20326,18 +20363,6 @@ function printNodes(printNodes, options, printEvent = null) {
20326
20363
  }
20327
20364
  printIFrame.onload = () => {
20328
20365
  setTimeout(() => {
20329
- printIFrame.contentWindow?.window.matchMedia('print').addListener(function (query) {
20330
- if (!query.matches) {
20331
- console.log('用户已经打印');
20332
- // 执行打印完成后需要执行的代码
20333
- }
20334
- });
20335
- printIFrame.contentWindow?.window.matchMedia('screen').addListener(function (query) {
20336
- if (!query.matches) {
20337
- console.log('用户已经打印');
20338
- // 执行打印完成后需要执行的代码
20339
- }
20340
- });
20341
20366
  printIFrame.contentWindow?.print();
20342
20367
  printIFrame.parentNode?.removeChild(printIFrame);
20343
20368
  }, 0);
@@ -21098,6 +21123,40 @@ class DocumentSvg {
21098
21123
  }
21099
21124
  }
21100
21125
  selectionRects.push(...selectionRectsTemp);
21126
+ // if (currVNode && currVNode.data?.attrs?.transform) {
21127
+ // currVNode.data.attrs.transform = `translate(${currVNode.data?.attrs?.transform.x},${currVNode.data?.attrs?.transform.y})`
21128
+ // }
21129
+ if (currVNode && currVNode.children) {
21130
+ let translateX = 0, translateY = 0;
21131
+ let line = false;
21132
+ if (render instanceof ParagraphLineRectRenderObject) {
21133
+ translateX = render.rect.x;
21134
+ translateY = render.rect.y;
21135
+ line = true;
21136
+ }
21137
+ currVNode.children.forEach(item => {
21138
+ if (item && item.data?.attrs?.translate && !item.data?.attrs?.transform) {
21139
+ item.data.attrs.transform = `translate(${item.data.attrs.translate.x + translateX},${item.data.attrs.translate.y + translateY})`;
21140
+ delete item.data.attrs.translate;
21141
+ }
21142
+ if (line && !item.data.attrs.transform) {
21143
+ item.data.attrs.transform = `translate(${translateX},${translateY})`;
21144
+ }
21145
+ // if (item && item.data?.attrs?.transform && typeof item.data?.attrs?.transform === 'object') {
21146
+ // item.data.attrs.transform = `translate(${item.data.attrs.transform.x + translateX},${item.data.attrs.transform.y + translateY})`
21147
+ // } else {
21148
+ // if (line && !item.data.attrs.transform) {
21149
+ // item.data.attrs.transform = `translate(${translateX},${translateY})`;
21150
+ // }
21151
+ // }
21152
+ });
21153
+ if (line) {
21154
+ return currVNode.children;
21155
+ }
21156
+ }
21157
+ if (currVNode && render.element) {
21158
+ currVNode.key = render.element.key + render.element.paintRenders.indexOf(render);
21159
+ }
21101
21160
  return currVNode;
21102
21161
  }
21103
21162
  getHTMLVNode(docRenders) {
@@ -21115,11 +21174,7 @@ class DocumentSvg {
21115
21174
  position: 'absolute',
21116
21175
  background: 'white',
21117
21176
  "box-shadow": "rgba(158, 161, 165, 0.4) 0px 2px 12px 0px",
21118
- },
21119
- hook: {
21120
- insert: (vnode) => {
21121
- }
21122
- },
21177
+ }
21123
21178
  },
21124
21179
  children: [pageSvg]
21125
21180
  };
@@ -21129,8 +21184,8 @@ class DocumentSvg {
21129
21184
  }
21130
21185
  /**
21131
21186
  * 判断当前元素是否在视窗内
21132
- * @param rect
21133
21187
  * @private
21188
+ * @param item
21134
21189
  */
21135
21190
  checkInViewBox(item) {
21136
21191
  if (!this.viewOptions.virtualViewMode || this.mode === 'print') {
@@ -26205,46 +26260,31 @@ class DocumentPrintOffscreenBase {
26205
26260
  * 续打
26206
26261
  */
26207
26262
  async printForContinuation(data, options) {
26208
- // const sub = this.beforeRenderEvent.subscribe((event) => {
26209
- // const {index, renderCtx, docRender, pageSvgVNode} = event;
26210
- // if (index === options.startDocIndex) {
26211
- // const bodyRender = docRender.getChild(1);
26212
- // let x = 0, y = options.startY, width = bodyRender.rect.width,
26213
- // height = bodyRender.rect.height - (options.startY - bodyRender.rect.y);
26214
- // if (options.startDocIndex === options.endDocIndex) {
26215
- // height = options.endY - options.startY;
26216
- // }
26217
- // renderCtx.mainContext.clip(x, y, width, height);
26218
- // }
26219
- // });
26220
26263
  this.afterRenderEvent.subscribe((event) => {
26221
26264
  const { index, renderCtx, docRender, pageSvgVNode } = event;
26222
26265
  if (index === options.startDocIndex && options.startY !== 0) {
26223
26266
  const bodyRender = docRender.getChild(1);
26224
- let x = bodyRender.rect.x, y = options.startY, width = bodyRender.rect.width, height = bodyRender.rect.height - (options.startY - bodyRender.rect.y);
26225
- // if (options.startDocIndex === options.endDocIndex) {
26226
- // height = options.endY - options.startY;
26227
- // }
26267
+ let x = bodyRender.rect.x, y = options.startY, width = bodyRender.rect.width,
26268
+ //由于body下面紧跟着页脚线,由于虚打不需要绘制该线,因此要裁剪掉2个像素
26269
+ height = bodyRender.rect.height - (options.startY - bodyRender.rect.y) - 2;
26228
26270
  const pageClip = ElementUtil.createClipPath('page-clip-' + index, width, height, x, y);
26229
26271
  //pageSvgVNode.children?.push(pageClip)
26230
26272
  pageSvgVNode.children?.push(pageClip);
26231
26273
  pageSvgVNode.data.attrs['clip-path'] = `url(#${'page-clip-' + index})`;
26232
26274
  }
26233
- // if (options.startDocIndex !== options.endDocIndex && index === options.endDocIndex) {
26234
- // const bodyRender = docRender.getChild(1);
26235
- // const height = bodyRender.rect.height - (options.endY - bodyRender.rect.y);
26236
- // renderCtx.contentContext.clearRect(bodyRender.rect.x, options.endY, bodyRender.rect.width, height);
26237
- // }
26238
26275
  });
26239
26276
  await this.prepare(data);
26240
26277
  const printRanges = new Array(this.documentPaint.docPages.length).fill(0).map((item, index) => index).filter(index => index >= options.startDocIndex);
26241
- const canvasNodes = this.getSvgNodes(this.documentPaint.docPages, printRanges);
26242
- if (!canvasNodes.length) {
26278
+ let svgNodes = this.getSvgNodes(this.documentPaint.docPages, printRanges);
26279
+ if (!svgNodes.length) {
26243
26280
  console.warn('无可打印页');
26244
26281
  return;
26245
26282
  }
26246
- const docProps = this.docCtx.document.props;
26247
- printNodes(canvasNodes, { ...docProps });
26283
+ const docProps = this.docCtx.viewOptions.docPageSettings;
26284
+ // if (docProps.orient === 'landscape') {
26285
+ // 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"/>`);
26286
+ // }
26287
+ printNodes(svgNodes, docProps);
26248
26288
  }
26249
26289
  // /**
26250
26290
  // * 获取绘制的图片,格式为Base64编码
@@ -26263,6 +26303,9 @@ class DocumentPrintOffscreenBase {
26263
26303
  const canvasNodes = this.getSvgNodes(this.documentPaint.docPages, ranges);
26264
26304
  return canvasNodes;
26265
26305
  }
26306
+ Encode64(str) {
26307
+ return btoa(encodeURIComponent(str));
26308
+ }
26266
26309
  /**
26267
26310
  * 读取数据,排版
26268
26311
  * @param data
@@ -26312,7 +26355,7 @@ class DocumentPrintOffscreenBase {
26312
26355
  modules.class,
26313
26356
  modules.props,
26314
26357
  modules.attributes,
26315
- modules.style
26358
+ modules.style,
26316
26359
  ]);
26317
26360
  // const pageSvgVNodes = docRenders.filter((item, index) =>
26318
26361
  // !printRanges || printRanges.indexOf(index) >= 0)
@@ -26624,6 +26667,17 @@ class EditorCalendarVNode {
26624
26667
  sel: 'div.editor-calendar-footer-right',
26625
26668
  data: {},
26626
26669
  children: [{
26670
+ sel: 'div.editor-calendar-footer-right-btn',
26671
+ data: {
26672
+ on: {
26673
+ click: () => {
26674
+ this.onSetValue.next(undefined);
26675
+ }
26676
+ }
26677
+ },
26678
+ text: '清除'
26679
+ },
26680
+ {
26627
26681
  sel: 'div.editor-calendar-footer-right-btn',
26628
26682
  data: {
26629
26683
  on: {
@@ -27653,10 +27707,22 @@ class DocEditor {
27653
27707
  * 处理全选当前段落
27654
27708
  */
27655
27709
  docDblClickHandle(evt) {
27656
- const res = getFocusTextSegment(this.selectionState);
27657
- if (res) {
27710
+ //1.如果在数据元中双击,则默认选中数据元内部的所有内容
27711
+ const currDataEle = this.getCurrentDataElement();
27712
+ if (currDataEle && currDataEle instanceof DataElementInlineGroup && currDataEle.length > 2) {
27713
+ const range = new SelectionRange();
27714
+ range.setStart(currDataEle.startDecorate, 1);
27715
+ range.setEnd(currDataEle.endDecorate, 0);
27716
+ this.selectionState.addRange(range);
27658
27717
  this.flushToSchedule();
27659
27718
  }
27719
+ else {
27720
+ //2.默认选词
27721
+ const res = getFocusTextSegment(this.selectionState);
27722
+ if (res) {
27723
+ this.flushToSchedule();
27724
+ }
27725
+ }
27660
27726
  this.updateSelection();
27661
27727
  this.onDblClickEvent.next(evt);
27662
27728
  }
@@ -28297,9 +28363,12 @@ class DocEditor {
28297
28363
  //console.timeEnd('patch');
28298
28364
  };
28299
28365
  render();
28300
- this.onShouldRender.subscribe(() => {
28366
+ // this.onShouldRender.subscribe(() => {
28367
+ // render();
28368
+ // });
28369
+ this.onShouldRender.subscribe(CommonUtil.debounce(() => {
28301
28370
  render();
28302
- });
28371
+ }, 32));
28303
28372
  }
28304
28373
  /**
28305
28374
  * 留痕提示的容器框,用于渲染后重新计算纵向位置
@@ -28640,7 +28709,7 @@ class DocEditor {
28640
28709
  rule.setRuleOptions({ width: this.viewOptions.docPageSettings.width, pagePL, pagePR, docLeft });
28641
28710
  }
28642
28711
  version() {
28643
- return "2.1.6";
28712
+ return "2.1.7";
28644
28713
  }
28645
28714
  }
28646
28715