@hailin-zheng/editor-core 2.1.18 → 2.1.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.
Files changed (58) hide show
  1. package/index-cjs.d.ts +0 -1
  2. package/index-cjs.js +983 -1720
  3. package/index-cjs.js.map +1 -1
  4. package/index.d.ts +0 -1
  5. package/index.js +979 -1719
  6. package/index.js.map +1 -1
  7. package/med_editor/doc-editor.d.ts +2 -0
  8. package/med_editor/editor-core.d.ts +4 -0
  9. package/med_editor/framework/common-util.d.ts +1 -0
  10. package/med_editor/framework/document-arrange.d.ts +9 -4
  11. package/med_editor/framework/document-context.d.ts +0 -8
  12. package/med_editor/framework/document-paint.d.ts +3 -5
  13. package/med_editor/framework/document-print-offscreen.d.ts +4 -4
  14. package/med_editor/framework/document-svg.d.ts +10 -4
  15. package/med_editor/framework/element-define.d.ts +2 -4
  16. package/med_editor/framework/element-props.d.ts +23 -1
  17. package/med_editor/framework/element-reader.d.ts +6 -1
  18. package/med_editor/framework/event-subject.d.ts +9 -0
  19. package/med_editor/framework/impl/checkbox/checkbox-impl.d.ts +2 -3
  20. package/med_editor/framework/impl/comments/comment-content-impl.d.ts +1 -2
  21. package/med_editor/framework/impl/comments/comment-element-impl.d.ts +8 -2
  22. package/med_editor/framework/impl/comments/comments-container-impl.d.ts +3 -27
  23. package/med_editor/framework/impl/comments/validate-msg-impl.d.ts +1 -2
  24. package/med_editor/framework/impl/data-element/data-decorate-impl.d.ts +1 -2
  25. package/med_editor/framework/impl/data-element/data-element-barcode.d.ts +2 -5
  26. package/med_editor/framework/impl/data-element/data-element-base-impl.d.ts +0 -1
  27. package/med_editor/framework/impl/data-element/data-element-check-impl.d.ts +1 -2
  28. package/med_editor/framework/impl/data-element/data-element-group-impl.d.ts +1 -2
  29. package/med_editor/framework/impl/data-element/data-element-image-impl.d.ts +2 -7
  30. package/med_editor/framework/impl/decorate/fill-null-space-imple.d.ts +1 -2
  31. package/med_editor/framework/impl/document/doc-body-impl.d.ts +1 -2
  32. package/med_editor/framework/impl/document/doc-body-part-impl.d.ts +1 -2
  33. package/med_editor/framework/impl/document/doc-container-impl.d.ts +1 -2
  34. package/med_editor/framework/impl/document/doc-footer-impl.d.ts +1 -2
  35. package/med_editor/framework/impl/document/doc-header-impl.d.ts +1 -2
  36. package/med_editor/framework/impl/document/doc-impl.d.ts +21 -4
  37. package/med_editor/framework/impl/index.d.ts +1 -0
  38. package/med_editor/framework/impl/media-formula/menstrual-history.d.ts +1 -2
  39. package/med_editor/framework/impl/media-formula/permanent-teeth.d.ts +1 -2
  40. package/med_editor/framework/impl/paragraph/p-impl.d.ts +0 -2
  41. package/med_editor/framework/impl/picture/RectEle.d.ts +1 -6
  42. package/med_editor/framework/impl/picture/image-impl.d.ts +2 -7
  43. package/med_editor/framework/impl/radio/radio-impl.d.ts +1 -2
  44. package/med_editor/framework/impl/svg/svg-impl.d.ts +20 -0
  45. package/med_editor/framework/impl/symbol/br-symbol-impl.d.ts +1 -2
  46. package/med_editor/framework/impl/symbol/p-symbol-impl.d.ts +1 -2
  47. package/med_editor/framework/impl/symbol/page-br-symbol-impl.d.ts +1 -2
  48. package/med_editor/framework/impl/symbol/tab-symbol-impl.d.ts +1 -2
  49. package/med_editor/framework/impl/table/table-cell-impl.d.ts +1 -2
  50. package/med_editor/framework/impl/table/table-impl.d.ts +1 -2
  51. package/med_editor/framework/impl/table/table-row-impl.d.ts +1 -2
  52. package/med_editor/framework/impl/text/text-impl.d.ts +1 -2
  53. package/med_editor/framework/impl/text/track-run-impl.d.ts +1 -2
  54. package/med_editor/framework/range-util.d.ts +1 -1
  55. package/med_editor/framework/render-define.d.ts +0 -2
  56. package/med_editor/framework/selection-overlays.d.ts +4 -2
  57. package/package.json +1 -1
  58. package/med_editor/framework/document-images-loader.d.ts +0 -20
package/index.js CHANGED
@@ -246,8 +246,6 @@ class RenderObject {
246
246
  this.margin = new MarginProps();
247
247
  this.padding = new PaddingProps();
248
248
  }
249
- pagePaintCompleted(e) {
250
- }
251
249
  destroy() {
252
250
  //this.parent = null;
253
251
  //this.margin = null;
@@ -553,6 +551,16 @@ class CommonUtil {
553
551
  }
554
552
  return str;
555
553
  }
554
+ //随机生成rgb颜色
555
+ static randomRgbColor(opacity = -1) {
556
+ let r = Math.floor(Math.random() * 256); //随机生成256以内r值
557
+ let g = Math.floor(Math.random() * 256); //随机生成256以内g值
558
+ let b = Math.floor(Math.random() * 256); //随机生成256以内b值
559
+ if (opacity === -1) {
560
+ return `rgb(${r},${g},${b})`; //返回rgb(r,g,b)格式颜色
561
+ }
562
+ return `rgba(${r},${g},${b},${opacity})`; //返回rgba(r,g,b,a)格式颜色
563
+ }
556
564
  /**
557
565
  * 判断一个数值是否在另一个数值的增益区间中
558
566
  * @param val
@@ -1072,6 +1080,40 @@ class SubjectSubscription$1 extends Subscription$1 {
1072
1080
  function fromEvent(dom, type) {
1073
1081
  return new DOMEventSource(dom, type);
1074
1082
  }
1083
+ class EventBus {
1084
+ subs = new Map();
1085
+ on(event, handler) {
1086
+ let handlers = this.subs.get(event);
1087
+ if (!handlers) {
1088
+ handlers = [];
1089
+ this.subs.set(event, handlers);
1090
+ }
1091
+ const sub = new Subject$1();
1092
+ sub.subscribe(handler);
1093
+ handlers.push(sub);
1094
+ }
1095
+ off(event) {
1096
+ const subs = this.subs.get(event);
1097
+ if (subs) {
1098
+ subs.forEach(item => item.unsubscribe());
1099
+ }
1100
+ this.subs.delete(event);
1101
+ }
1102
+ emit(event, data) {
1103
+ const subs = this.subs.get(event);
1104
+ if (subs) {
1105
+ subs.forEach(item => item.next(data));
1106
+ }
1107
+ }
1108
+ clear() {
1109
+ this.subs.forEach((subs) => {
1110
+ subs.forEach((sub) => {
1111
+ sub.unsubscribe();
1112
+ });
1113
+ });
1114
+ this.subs.clear();
1115
+ }
1116
+ }
1075
1117
 
1076
1118
  class Rect {
1077
1119
  x = 0;
@@ -1676,17 +1718,7 @@ class ViewOptions {
1676
1718
  //两个页的间距
1677
1719
  docSpace = 0;
1678
1720
  //是否显示审阅窗口
1679
- _showReviewWindow = false;
1680
- get showReviewWindow() {
1681
- return this._showReviewWindow;
1682
- }
1683
- set showReviewWindow(value) {
1684
- if (value === this._showReviewWindow) {
1685
- return;
1686
- }
1687
- this._showReviewWindow = value;
1688
- // this.onChange.next();
1689
- }
1721
+ showReviewWindow = false;
1690
1722
  //审阅窗口宽度
1691
1723
  reviewWindowWidth = 200;
1692
1724
  //缩放
@@ -2189,6 +2221,32 @@ class PictureProps extends INotifyPropertyChanged {
2189
2221
  return props;
2190
2222
  }
2191
2223
  }
2224
+ class SVGProps extends INotifyPropertyChanged {
2225
+ title;
2226
+ width = 5;
2227
+ height = 5;
2228
+ value;
2229
+ clone(dest) {
2230
+ const clone = dest ?? new SVGProps();
2231
+ super.cloneAttachedProperty(clone);
2232
+ clone.width = this.width;
2233
+ clone.height = this.height;
2234
+ clone.value = this.value;
2235
+ clone.title = this.title;
2236
+ return clone;
2237
+ }
2238
+ getSerializeProps(viewOptions) {
2239
+ const props = {
2240
+ width: this.width,
2241
+ height: this.height,
2242
+ value: this.value,
2243
+ };
2244
+ if (this.title) {
2245
+ props['title'] = this.title;
2246
+ }
2247
+ return props;
2248
+ }
2249
+ }
2192
2250
  class DataDecorateProps extends INotifyPropertyChanged {
2193
2251
  content;
2194
2252
  size;
@@ -2371,32 +2429,47 @@ class CommContentProps extends INotifyPropertyChanged {
2371
2429
  createId;
2372
2430
  createName;
2373
2431
  createDate;
2432
+ text;
2374
2433
  clone(dest) {
2375
2434
  const clone = dest ?? new CommContentProps();
2376
2435
  super.cloneAttachedProperty(clone);
2377
2436
  clone.id = this.id;
2437
+ clone.text = this.text;
2378
2438
  return clone;
2379
2439
  }
2380
2440
  getSerializeProps(viewOptions) {
2381
2441
  return {
2382
- id: this.id
2442
+ id: this.id,
2443
+ text: this.text
2383
2444
  };
2384
2445
  }
2385
2446
  }
2386
2447
  class CommProps extends INotifyPropertyChanged {
2387
2448
  id;
2388
2449
  markType;
2450
+ text;
2451
+ userId;
2452
+ userName;
2453
+ date;
2389
2454
  clone(dest) {
2390
2455
  const clone = dest ?? new CommProps();
2391
2456
  super.cloneAttachedProperty(clone);
2392
2457
  clone.id = this.id;
2393
2458
  clone.markType = this.markType;
2459
+ clone.text = this.text;
2460
+ clone.userId = this.userId;
2461
+ clone.userName = this.userName;
2462
+ clone.date = this.date;
2394
2463
  return clone;
2395
2464
  }
2396
2465
  getSerializeProps(viewOptions) {
2397
2466
  return {
2398
2467
  id: this.id,
2399
- markType: this.markType
2468
+ markType: this.markType,
2469
+ text: this.text,
2470
+ userId: this.userId,
2471
+ userName: this.userName,
2472
+ date: this.date
2400
2473
  };
2401
2474
  }
2402
2475
  }
@@ -2724,76 +2797,11 @@ class CommsContainerElement extends BlockContainerElement {
2724
2797
  }
2725
2798
  return clone;
2726
2799
  }
2727
- markPairs = [];
2728
- /**
2729
- * 清除所有的批注标识组合
2730
- */
2731
- clearMarkItems() {
2732
- this.markPairs.length = 0;
2733
- }
2734
- identifyCommMark(markElement) {
2735
- const { id } = markElement.props;
2736
- let matchItem = this.markPairs.find(item => item.id === id);
2737
- if (!matchItem) {
2738
- matchItem = { id };
2739
- this.markPairs.push(matchItem);
2740
- }
2741
- matchItem[markElement.props.markType] = markElement;
2742
- }
2743
- /**
2744
- * 根据id,移除批注标记以及批注内容
2745
- * @param id
2746
- */
2747
- removeCommMark(id) {
2748
- const matchIndex = this.markPairs.findIndex(item => item.id === id);
2749
- if (matchIndex >= 0) {
2750
- const matchItem = this.markPairs[matchIndex];
2751
- matchItem.start?.remove();
2752
- matchItem.end?.remove();
2753
- this.markPairs.splice(matchIndex, 1);
2754
- }
2755
- const commContent = this.getCommContent(id);
2756
- if (commContent) {
2757
- commContent.remove();
2758
- }
2759
- }
2760
- /**
2761
- * 清除所有批注
2762
- */
2763
- clearAllComms() {
2764
- for (let i = 0; i < this.markPairs.length; i++) {
2765
- const { start, end } = this.markPairs[i];
2766
- if (start) {
2767
- start.remove();
2768
- }
2769
- if (end) {
2770
- end.remove();
2771
- }
2772
- }
2773
- this.clearItems();
2774
- }
2775
- getCommContent(id) {
2776
- for (let i = 0; i < this.length; i++) {
2777
- const commContent = this.getChild(i);
2778
- if (commContent.props.id === id) {
2779
- return commContent;
2780
- }
2781
- }
2782
- return null;
2783
- }
2784
2800
  }
2785
2801
  class CommsContainerRenderObject extends BlockContainerRenderObject {
2786
2802
  //批注内容是否已经重组,只要重新绘制的时候组合一次即可
2787
2803
  isMeasureComm;
2788
- selectedSet;
2789
- commentRangeStatus = [];
2790
2804
  commsMarks = [];
2791
- render(e) {
2792
- if (this.rect.height === 0) {
2793
- return;
2794
- }
2795
- e.render.contentContext.strokeRect(e.position.x, e.position.y, this.rect.width, this.rect.height, 'black', 0.5);
2796
- }
2797
2805
  clone() {
2798
2806
  const clone = new CommsContainerRenderObject(this.element);
2799
2807
  clone.rect = ElementUtil.cloneRect(this.rect);
@@ -2874,9 +2882,6 @@ class DataDecorateElement extends LeafElement {
2874
2882
  }
2875
2883
  }
2876
2884
  class DataDecorateRenderObject extends LeafRenderObject {
2877
- render(e) {
2878
- this.renderDecorRect(e.render, e.position);
2879
- }
2880
2885
  renderDecorRect(ctx, position) {
2881
2886
  if (ctx.drawMode === 'print') {
2882
2887
  return;
@@ -3086,10 +3091,6 @@ class ParagraphElement extends BlockContentElement {
3086
3091
  }
3087
3092
  }
3088
3093
  class ParagraphRenderObject extends MuiltBlockLineRenderObject {
3089
- render(e) {
3090
- e.nextRender();
3091
- this.drawProjectNumber(e.render, e.docCtx.viewOptions, e);
3092
- }
3093
3094
  /**
3094
3095
  * 绘制项目符号
3095
3096
  */
@@ -3167,8 +3168,6 @@ class ParagraphLineRectRenderObject extends BlockLineRectRenderObject {
3167
3168
  baseTopLine = 0;
3168
3169
  baseBottomLine = 0;
3169
3170
  startX = 0;
3170
- render(e) {
3171
- }
3172
3171
  clone() {
3173
3172
  const cloneRender = new ParagraphLineRectRenderObject(this.element);
3174
3173
  cloneRender.rect = ElementUtil.cloneRect(this.rect);
@@ -3242,7 +3241,7 @@ class DocumentElement extends BlockContainerElement {
3242
3241
  bodyElement;
3243
3242
  headerElement;
3244
3243
  footerElement;
3245
- commentsContainerElement;
3244
+ //commentsContainerElement!: CommsContainerElement;
3246
3245
  headerEditState = false;
3247
3246
  constructor() {
3248
3247
  super('doc');
@@ -3320,6 +3319,49 @@ class DocumentElement extends BlockContainerElement {
3320
3319
  ss.clear();
3321
3320
  this.refreshView();
3322
3321
  }
3322
+ markPairs = [];
3323
+ /**
3324
+ * 清除所有的批注标识组合
3325
+ */
3326
+ clearMarkItems() {
3327
+ this.markPairs.length = 0;
3328
+ }
3329
+ identifyCommMark(markElement) {
3330
+ const { id } = markElement.props;
3331
+ let matchItem = this.markPairs.find(item => item.id === id);
3332
+ if (!matchItem) {
3333
+ matchItem = { id };
3334
+ this.markPairs.push(matchItem);
3335
+ }
3336
+ matchItem[markElement.props.markType] = markElement;
3337
+ }
3338
+ /**
3339
+ * 根据id,移除批注标记以及批注内容
3340
+ * @param id
3341
+ */
3342
+ removeCommMark(id) {
3343
+ const matchIndex = this.markPairs.findIndex(item => item.id === id);
3344
+ if (matchIndex >= 0) {
3345
+ const matchItem = this.markPairs[matchIndex];
3346
+ matchItem.start?.remove();
3347
+ matchItem.end?.remove();
3348
+ this.markPairs.splice(matchIndex, 1);
3349
+ }
3350
+ }
3351
+ /**
3352
+ * 清除所有批注
3353
+ */
3354
+ clearAllComms() {
3355
+ for (let i = 0; i < this.markPairs.length; i++) {
3356
+ const { start, end } = this.markPairs[i];
3357
+ if (start) {
3358
+ start.remove();
3359
+ }
3360
+ if (end) {
3361
+ end.remove();
3362
+ }
3363
+ }
3364
+ }
3323
3365
  }
3324
3366
  class DocumentRenderObject extends BlockContainerRenderObject {
3325
3367
  constructor(ele) {
@@ -3327,21 +3369,6 @@ class DocumentRenderObject extends BlockContainerRenderObject {
3327
3369
  }
3328
3370
  headerLine;
3329
3371
  footerLine;
3330
- render(e) {
3331
- const { render, position, docCtx: { viewOptions } } = e;
3332
- const { width: docWidth, height: docHeight } = viewOptions.docPageSettings;
3333
- render.overlaysContext.fillRect(position.x, position.y, docWidth, this.rect.height, 'white', 5, 'black');
3334
- e.render.tran(() => {
3335
- e.render.contentContext.ctx.fillStyle = e.docCtx.viewOptions.defaultColor;
3336
- this.checkPrintMode(e);
3337
- e.nextRender();
3338
- this.drawCopyRight(viewOptions, render, position);
3339
- this.drawDocPageNum(render, viewOptions, position);
3340
- //绘制文档边距线
3341
- this.drawMarginLine(position, render, docWidth, docHeight);
3342
- this.drawWatermark(render, viewOptions, position);
3343
- });
3344
- }
3345
3372
  /**
3346
3373
  * 打印模式检查
3347
3374
  * 如果是续打模式,需要进行裁剪打印范围,页眉页脚都不需要打印
@@ -3777,45 +3804,6 @@ function getCurrOptions(ele) {
3777
3804
  return doc?.viewOptions;
3778
3805
  }
3779
3806
  class DataElementRenderObject extends InlineGroupRenderObject {
3780
- render(e) {
3781
- const { render, position, docCtx: { viewOptions } } = e;
3782
- this.paintPos = e.position;
3783
- //数据元不打印
3784
- if (!this.element.props.printable && render.drawMode === 'print') {
3785
- return;
3786
- }
3787
- render.contentContext.tran(() => {
3788
- //绘制数据元区域底色
3789
- let bgColor = '';
3790
- if (this.element.isMouseenter) {
3791
- bgColor = this.element.props.editable ? viewOptions.dataEleOverlaysColor : viewOptions.dataEleReadOnlyOverlayColor;
3792
- }
3793
- if (this.element.isFocused) {
3794
- bgColor = e.docCtx.viewOptions.dataEleFocusedBgColor;
3795
- }
3796
- if (this.element.errorTip) {
3797
- bgColor = viewOptions.dataEleErrorBgColor;
3798
- }
3799
- if (bgColor) {
3800
- render.contentContext.fillRect(position.x, position.y, this.rect.width, this.rect.height, bgColor);
3801
- }
3802
- if (this.element.props.secretBrowse && viewOptions.secretBrowse) {
3803
- render.contentContext.ctx.filter = "blur(10px)";
3804
- }
3805
- if (this.element.props.underline) {
3806
- const y = position.y + 2 + this.rect.height;
3807
- render.contentContext.strokeLines([{ x: position.x, y }, {
3808
- x: position.x + this.rect.width,
3809
- y
3810
- }], 1, '#595959');
3811
- }
3812
- e.nextRender();
3813
- this.drawCaption(e);
3814
- });
3815
- e.render.onRenderCompleted.subscribe(() => {
3816
- drawDecorator(e, this);
3817
- });
3818
- }
3819
3807
  exportHTML(event) {
3820
3808
  const node = super.exportHTML(event);
3821
3809
  exportDecoratorHTML(event, this);
@@ -4101,15 +4089,6 @@ class DocumentBodyElement extends BlockContainerElement {
4101
4089
  }
4102
4090
  }
4103
4091
  class DocumentBodyRenderObject extends MuiltBlockLineRenderObject {
4104
- render(e) {
4105
- const { render, position } = e;
4106
- render.tran(() => {
4107
- if (this.element.disableClick && render.drawMode === 'view') {
4108
- render.contentContext.setGlobalAlpha(0.5);
4109
- }
4110
- e.nextRender();
4111
- });
4112
- }
4113
4092
  clone(cloneData = true) {
4114
4093
  const cloneRender = new DocumentBodyRenderObject(this.element);
4115
4094
  cloneRender.rect = ElementUtil.cloneRect(this.rect);
@@ -4179,22 +4158,6 @@ class DocumentFooterElement extends BlockContainerElement {
4179
4158
  }
4180
4159
  }
4181
4160
  class DocumentFooterRenderObject extends BlockContainerRenderObject {
4182
- render(e) {
4183
- const { render, position } = e;
4184
- render.tran(() => {
4185
- //判断页眉是否为输入内容
4186
- const isFooterEmpty = ElementUtil.checkEmptyRenderContent(this);
4187
- if (this.element.disableClick && render.drawMode === 'view') {
4188
- if (isFooterEmpty) {
4189
- render.contentContext.setGlobalAlpha(0);
4190
- }
4191
- else {
4192
- render.contentContext.setGlobalAlpha(0.5);
4193
- }
4194
- }
4195
- e.nextRender();
4196
- });
4197
- }
4198
4161
  clone() {
4199
4162
  const cloneRender = new DocumentFooterRenderObject(this.element);
4200
4163
  cloneRender.rect = ElementUtil.cloneRect(this.rect);
@@ -4275,27 +4238,6 @@ class DocumentHeaderElement extends BlockContainerElement {
4275
4238
  }
4276
4239
  }
4277
4240
  class DocumentHeaderRenderObject extends BlockContainerRenderObject {
4278
- render(e) {
4279
- const { render, position } = e;
4280
- render.tran(() => {
4281
- //判断页眉是否为输入内容
4282
- const isHeaderEmpty = ElementUtil.checkEmptyRenderContent(this);
4283
- //存在输入内容时,绘制页眉-页体分割线
4284
- if (!isHeaderEmpty || !this.element.disableClick) {
4285
- const headerLineY = this.rect.height;
4286
- render.contentContext.drawHoriLine(position.x, position.y + headerLineY, this.rect.width, 'black', 0.5);
4287
- }
4288
- if (this.element.disableClick && render.drawMode === 'view') {
4289
- if (isHeaderEmpty) {
4290
- render.contentContext.setGlobalAlpha(0);
4291
- }
4292
- else {
4293
- render.contentContext.setGlobalAlpha(0.5);
4294
- }
4295
- }
4296
- e.nextRender();
4297
- });
4298
- }
4299
4241
  clone() {
4300
4242
  const cloneRender = new DocumentHeaderRenderObject(this.element);
4301
4243
  cloneRender.rect = ElementUtil.cloneRect(this.rect);
@@ -4375,13 +4317,6 @@ class PSymbolElement extends LeafElement {
4375
4317
  }
4376
4318
  }
4377
4319
  class PSymbolRenderObject extends LeafRenderObject {
4378
- render(e) {
4379
- const { render, position } = e;
4380
- if (render.drawMode === 'print' || !e.docCtx.viewOptions.showParaSymbol) {
4381
- return;
4382
- }
4383
- render.contentContext.drawText('↩', this.element.textProps, position.x, position.y, 20, this.rect.height);
4384
- }
4385
4320
  exportHTML(event) {
4386
4321
  if (!event.options.showEnterSymbol || event.mode === 'print') {
4387
4322
  return null;
@@ -4494,22 +4429,6 @@ class TableCellElement extends BlockContainerElement {
4494
4429
  }
4495
4430
  }
4496
4431
  class TableCellRenderObject extends InlineMuiltBlockLineRenderObject {
4497
- render(e) {
4498
- const { render, position } = e;
4499
- render.tran(() => {
4500
- render.contentContext.clip(position.x, position.y, this.rect.width, this.rect.height);
4501
- const { hMerge, vMerge, backgroundColor, diagonal } = this.element.props;
4502
- if (hMerge === 'continue' || vMerge === 'continue') {
4503
- render.contentContext.setGlobalAlpha(0);
4504
- render.overlaysContext.setGlobalAlpha(0);
4505
- }
4506
- if (backgroundColor && this.rect.width && this.rect.height) {
4507
- render.contentContext.fillRect(position.x, position.y, this.rect.width, this.rect.height, backgroundColor);
4508
- }
4509
- this.renderDiagonal(render, diagonal, position);
4510
- e.nextRender();
4511
- });
4512
- }
4513
4432
  /**
4514
4433
  * 绘制对角线
4515
4434
  * @private
@@ -4677,9 +4596,7 @@ class TableRowRenderObject extends MuiltBlockLineRenderObject {
4677
4596
  //被截断的行是否需要重新计算高度
4678
4597
  remeasureState = true;
4679
4598
  //当前行是否存在合并单元格
4680
- hasMergeCells = false;
4681
- render(e) {
4682
- }
4599
+ hasMergeCells = undefined;
4683
4600
  clone() {
4684
4601
  const cloneRender = new TableRowRenderObject(this.element);
4685
4602
  cloneRender.remeasureState = this.remeasureState;
@@ -4708,17 +4625,6 @@ class DocumentContainerRender extends BlockContainerRenderObject {
4708
4625
  constructor() {
4709
4626
  super(null);
4710
4627
  }
4711
- render(e) {
4712
- const { render, nextRender, docCtx: { viewOptions } } = e;
4713
- const { viewSettings, docPageSettings, viewBackcolor, scale } = viewOptions;
4714
- render.clear();
4715
- //render.overlaysContext.fillRect(0, 0, viewSettings.width, viewSettings.height, viewBackcolor);
4716
- render.tran(() => {
4717
- render.overlaysContext.ctx.scale(scale, scale);
4718
- render.contentContext.ctx.scale(scale, scale);
4719
- nextRender();
4720
- });
4721
- }
4722
4628
  clone() {
4723
4629
  throw new Error("Method not implemented.");
4724
4630
  }
@@ -4835,17 +4741,6 @@ class TextGroupElement extends LeafElement {
4835
4741
  }
4836
4742
  class TextGroupRenderObject extends LeafRenderObject {
4837
4743
  textMeasures;
4838
- render(e) {
4839
- const { render, position } = e;
4840
- //null-text不打印
4841
- if (render.drawMode === 'print' && this.element.isDecorate) {
4842
- return;
4843
- }
4844
- if (this.element.props.border) {
4845
- render.contentContext.strokeRect(position.x, position.y, this.rect.width, this.rect.height);
4846
- }
4847
- render.contentContext.drawTextUnits(this, position.x, position.y + (this.rect.height - this.element.props.fontSize) / 2);
4848
- }
4849
4744
  constructor(element) {
4850
4745
  super(element);
4851
4746
  }
@@ -5316,7 +5211,7 @@ class DocumentCursor {
5316
5211
  }
5317
5212
 
5318
5213
  class RangeUtil {
5319
- static getSelctionRange(startControl, startOffset, endControl, endOffset, ancestorCommonControl) {
5214
+ static getSectionRange(startControl, startOffset, endControl, endOffset, ancestorCommonControl) {
5320
5215
  if (ancestorCommonControl instanceof TableElement || ancestorCommonControl instanceof TableRowElement) {
5321
5216
  const tbElement = ancestorCommonControl instanceof TableElement ? ancestorCommonControl : ancestorCommonControl.parent;
5322
5217
  return this.getTableSelectionRange(startControl, startOffset, endControl, endOffset, tbElement);
@@ -5395,7 +5290,7 @@ class RangeUtil {
5395
5290
  });
5396
5291
  }
5397
5292
  else {
5398
- const cellRange = this.getSelctionRange(cellFirstLeafElement, 0, cellLastLeafElement, 1, cell);
5293
+ const cellRange = this.getSectionRange(cellFirstLeafElement, 0, cellLastLeafElement, 1, cell);
5399
5294
  cellRanges.push(cellRange);
5400
5295
  }
5401
5296
  }
@@ -6561,56 +6456,6 @@ class TableRenderObject extends MuiltBlockLineRenderObject {
6561
6456
  setRenderWidth(maxWidth) {
6562
6457
  super.setRenderWidth(maxWidth);
6563
6458
  }
6564
- render(e) {
6565
- const { render, position } = e;
6566
- //绘制表格线
6567
- const border = this.element.props.border;
6568
- if (border === 'none') {
6569
- return;
6570
- }
6571
- const lineDash = border === 'dashed' ? [2, 2] : [];
6572
- for (let i = 0; i < this.length; i++) {
6573
- const rowRender = this.getChild(i);
6574
- const rowPos = { x: rowRender.rect.x + position.x, y: rowRender.rect.y + position.y };
6575
- for (let j = 0; j < rowRender.length; j++) {
6576
- const cellRender = rowRender.getChild(j);
6577
- const cellPos = { x: cellRender.rect.x + rowPos.x, y: cellRender.rect.y + rowPos.y };
6578
- //绘制单元格上边框
6579
- if (i === 0) {
6580
- //ctx.contentContext.fillRect(cellPos.x, cellPos.y, cellRender.rect.width, 1);
6581
- render.contentContext.fillLines([{ x: cellPos.x, y: cellPos.y }, {
6582
- x: cellPos.x + cellRender.rect.width,
6583
- y: cellPos.y
6584
- }], 1, '#000', lineDash);
6585
- //this.drawLine(ctx, { x: cellPos.x, y: cellPos.y }, { x: cellPos.x + cellRender.rect.width, y: cellPos.y });
6586
- }
6587
- //绘制左边框
6588
- if (j === 0) {
6589
- //ctx.contentContext.fillRect(cellPos.x, cellPos.y, 1, cellRender.rect.height);
6590
- render.contentContext.fillLines([{ x: cellPos.x, y: cellPos.y }, {
6591
- x: cellPos.x,
6592
- y: cellPos.y + cellRender.rect.height
6593
- }], 1, '#000', lineDash);
6594
- //this.drawLine(ctx, { x: cellPos.x, y: cellPos.y }, { x: cellPos.x, y: cellPos.y + cellRender.rect.height });
6595
- }
6596
- //绘制右边框
6597
- //ctx.contentContext.fillRect(cellPos.x + cellRender.rect.width, cellPos.y, 1, cellRender.rect.height);
6598
- render.contentContext.fillLines([{
6599
- x: cellPos.x + cellRender.rect.width,
6600
- y: cellPos.y
6601
- }, { x: cellPos.x + cellRender.rect.width, y: cellPos.y + cellRender.rect.height }], 1, '#000', lineDash);
6602
- //this.drawLine(ctx, { x: cellPos.x + cellRender.rect.width, y: cellPos.y }, { x: cellPos.x + cellRender.rect.width, y: cellPos.y + cellRender.rect.height });
6603
- //绘制下边框
6604
- //ctx.contentContext.fillRect(cellPos.x, cellPos.y + cellRender.rect.height, cellRender.rect.width, 1);
6605
- render.contentContext.fillLines([{
6606
- x: cellPos.x,
6607
- y: cellPos.y + cellRender.rect.height
6608
- }, { x: cellPos.x + cellRender.rect.width, y: cellPos.y + cellRender.rect.height }], 1, '#000', lineDash);
6609
- //this.drawLine(ctx, { x: cellPos.x, y: cellPos.y + cellRender.rect.height }, { x: cellPos.x + cellRender.rect.width, y: cellPos.y + cellRender.rect.height });
6610
- //cellRender.beginRender(ctx, { x: position.x + cellRender.offsetX, y: position.y + cellRender.offsetY });
6611
- }
6612
- }
6613
- }
6614
6459
  exportTableBorder() {
6615
6460
  //绘制表格线
6616
6461
  const border = this.element.props.border;
@@ -6895,10 +6740,7 @@ class CheckBoxFactory extends ElementFactory {
6895
6740
  }
6896
6741
  }
6897
6742
  class CheckBoxRenderObject extends LeafRenderObject {
6898
- render(e) {
6899
- e.render.contentContext.drawCheckBox(e.position.x + 2, e.position.y, this.element.props.size, this.element.props.size, this.element.props.isChecked);
6900
- }
6901
- clone(cloneData = true) {
6743
+ clone() {
6902
6744
  const clone = new CheckBoxRenderObject(this.element);
6903
6745
  clone.rect = ElementUtil.cloneRect(this.rect);
6904
6746
  return clone;
@@ -6997,34 +6839,6 @@ class CommContentElement extends CommContentBaseElement {
6997
6839
  }
6998
6840
  }
6999
6841
  class CommContentRenderObject extends CommContentBaseRenderObject {
7000
- render(e) {
7001
- let borderColor = this.element.focus ? '#fa8c16' : '#ffd591';
7002
- e.render.contentContext.strokeRect(e.position.x, e.position.y, this.rect.width, this.rect.height, borderColor);
7003
- e.render.contentContext.fillRect(e.position.x, e.position.y, 8, this.rect.height, '#871400');
7004
- const docRender = ElementUtil.getParentRender(this.commMarkRender.render, DocumentRenderObject);
7005
- //获取审阅标记的绘制坐标
7006
- let commMarkPos = ElementUtil.getRenderAbsolutePaintPos(this.commMarkRender.render, {
7007
- x: 0,
7008
- y: -e.docCtx.viewOptions.pageOffset.y
7009
- });
7010
- const commMarkLinePos = ElementUtil.getParaLinePos(this.commMarkRender.render, commMarkPos);
7011
- commMarkPos.y = commMarkLinePos.y + 2;
7012
- const docRenderPos = ElementUtil.getRenderAbsolutePaintPos(docRender, {
7013
- x: 0,
7014
- y: -e.docCtx.viewOptions.pageOffset.y
7015
- });
7016
- const marginLeft = commMarkPos.x - docRenderPos.x - docRender.padding.left;
7017
- const marginRight = e.docCtx.viewOptions.docPageSettings.width - marginLeft - docRender.padding.right * 2;
7018
- e.render.overlaysContext.drawDashLine([commMarkPos, {
7019
- x: commMarkPos.x + marginRight,
7020
- y: commMarkPos.y
7021
- }], [1, 1], 'red');
7022
- e.render.overlaysContext.drawDashLine([{
7023
- x: commMarkPos.x + marginRight,
7024
- y: commMarkPos.y
7025
- }, e.position], [1, 1], 'red');
7026
- this.renderTitle(e.render, e.position);
7027
- }
7028
6842
  exportHTML(event) {
7029
6843
  const t = super.exportHTML(event);
7030
6844
  t.children = [];
@@ -7234,26 +7048,56 @@ class CommentsUtil {
7234
7048
  }
7235
7049
  }
7236
7050
 
7237
- class CommentElement extends LeafElement {
7238
- constructor() {
7239
- super('comm');
7240
- this.isDecorate = true;
7241
- this.disableClick = true;
7242
- this.props = new CommProps();
7243
- }
7244
- createRenderObject() {
7245
- const render = new CommentRenderObject(this);
7246
- render.rect.width = 0;
7247
- render.rect.height = 14;
7248
- return render;
7249
- }
7250
- serialize(viewOptions) {
7251
- if (this.isDecorate) {
7252
- return null;
7253
- }
7254
- return {
7255
- type: this.type,
7256
- props: {
7051
+ let activeEditorContext = null;
7052
+ function setActiveEditorContext(ctx) {
7053
+ activeEditorContext = ctx;
7054
+ }
7055
+ function getActiveEditorContext() {
7056
+ return activeEditorContext;
7057
+ }
7058
+ function createSignal(state) {
7059
+ let _state = state;
7060
+ const activeCtx = activeEditorContext;
7061
+ const signal = {
7062
+ get value() {
7063
+ return _state;
7064
+ },
7065
+ set value(v) {
7066
+ if (v === _state) {
7067
+ return;
7068
+ }
7069
+ _state = v;
7070
+ signal.onChange();
7071
+ },
7072
+ onChange: () => {
7073
+ activeCtx?.onChange();
7074
+ }
7075
+ };
7076
+ return signal;
7077
+ }
7078
+
7079
+ class CommentElement extends LeafElement {
7080
+ color;
7081
+ constructor() {
7082
+ super('comm');
7083
+ this.isDecorate = true;
7084
+ this.disableClick = true;
7085
+ this.props = new CommProps();
7086
+ this.color = CommonUtil.randomRgbColor(0.5);
7087
+ }
7088
+ createRenderObject() {
7089
+ const render = new CommentRenderObject(this);
7090
+ render.rect.width = 0;
7091
+ render.rect.height = 14;
7092
+ return render;
7093
+ }
7094
+ serialize(viewOptions) {
7095
+ if (this.isDecorate) {
7096
+ return null;
7097
+ }
7098
+ return {
7099
+ type: this.type,
7100
+ props: {
7257
7101
  ...this.props.getSerializeProps(viewOptions)
7258
7102
  }
7259
7103
  };
@@ -7265,16 +7109,6 @@ class CommentElement extends LeafElement {
7265
7109
  }
7266
7110
  }
7267
7111
  class CommentRenderObject extends LeafRenderObject {
7268
- //renderPos!: Position;
7269
- render(e) {
7270
- // if (!e.docCtx.viewOptions.showReviewWindow) {
7271
- // return;
7272
- // }
7273
- // this.renderPos = e.position;
7274
- // const paraLinePos = ElementUtil.getParaLinePos(this, {x: e.position.x, y: e.position.y});
7275
- // const color = '#ff4d4f';
7276
- // e.render.contentContext.fillRect(e.position.x - 1, paraLinePos.y, 2, paraLinePos.height, color)
7277
- }
7278
7112
  exportHTML(event) {
7279
7113
  const renderPos = { ...event.relativePagePos };
7280
7114
  const paraLinePos = ElementUtil.getParaLinePos(this, { x: renderPos.x, y: renderPos.y });
@@ -7292,6 +7126,7 @@ class CommentRenderObject extends LeafRenderObject {
7292
7126
  }
7293
7127
  }
7294
7128
  }];
7129
+ this.createCommentTips(event);
7295
7130
  return t;
7296
7131
  }
7297
7132
  clone() {
@@ -7299,6 +7134,90 @@ class CommentRenderObject extends LeafRenderObject {
7299
7134
  clone.rect = ElementUtil.cloneRect(this.rect);
7300
7135
  return clone;
7301
7136
  }
7137
+ createCommentTips(event) {
7138
+ if (this.element.props.markType === 'end') {
7139
+ return;
7140
+ }
7141
+ if (this.element.paintRenders.indexOf(this) !== 0) {
7142
+ return;
7143
+ }
7144
+ const appCtx = getActiveEditorContext();
7145
+ const opType = '批注:';
7146
+ const content = this.element.props.text;
7147
+ const left = 5;
7148
+ let sel = 'div.tg-container';
7149
+ const node = {
7150
+ sel,
7151
+ key: this.element.props.id,
7152
+ data: {
7153
+ style: {
7154
+ left: `${left}px`,
7155
+ top: `${event.globalPos.y}px`
7156
+ },
7157
+ on: {
7158
+ click: (e) => {
7159
+ e.stopPropagation();
7160
+ appCtx?.emit('comment-click', {
7161
+ ...this.element.props
7162
+ });
7163
+ //this.showCommentRange(appCtx!);
7164
+ },
7165
+ dblclick: (e) => {
7166
+ e.stopPropagation();
7167
+ appCtx?.emit('comment-dblclick', {
7168
+ ...this.element.props
7169
+ });
7170
+ }
7171
+ }
7172
+ },
7173
+ children: [{
7174
+ sel: 'div.header',
7175
+ data: {},
7176
+ children: [{
7177
+ sel: 'span.header-user',
7178
+ data: {},
7179
+ text: this.element.props.userName,
7180
+ }, {
7181
+ sel: 'span.header-date',
7182
+ data: {},
7183
+ text: this.element.props.date,
7184
+ }]
7185
+ }, {
7186
+ sel: 'div.content',
7187
+ data: {},
7188
+ text: opType + content
7189
+ }, {
7190
+ sel: 'div.bg',
7191
+ data: {
7192
+ style: {
7193
+ background: this.element.color
7194
+ }
7195
+ }
7196
+ }]
7197
+ };
7198
+ event.addChangeTips(node);
7199
+ // <div class="container">
7200
+ // <div class="header">
7201
+ // <span class="header-user">张三</span>
7202
+ // <span class="header-date">2023.1.21 16:06</span>
7203
+ // </div>
7204
+ // <div class="content">修改了字符串</div>
7205
+ // </div>
7206
+ }
7207
+ /**
7208
+ * 显示批注范围
7209
+ * @private
7210
+ */
7211
+ showCommentRange(appCtx) {
7212
+ const doc = ElementUtil.getParent(this.element, (item) => item.type === 'doc');
7213
+ const commPair = doc.treeFilter(item => item instanceof CommentElement && item.props.id === this.element.props.id);
7214
+ if (commPair.length === 2) {
7215
+ const range = new SelectionRange();
7216
+ range.setStart(commPair[0], 0);
7217
+ range.setEnd(commPair[1], 1);
7218
+ appCtx.selectionState.addRange(range);
7219
+ }
7220
+ }
7302
7221
  }
7303
7222
  class CommentFactory extends ElementFactory {
7304
7223
  match(type) {
@@ -7309,6 +7228,7 @@ class CommentFactory extends ElementFactory {
7309
7228
  const props = data.props;
7310
7229
  ele.props.id = props.id;
7311
7230
  ele.props.markType = props.markType;
7231
+ ele.props.text = props.text;
7312
7232
  return ele;
7313
7233
  }
7314
7234
  }
@@ -7354,31 +7274,6 @@ class ValidateElement extends CommContentBaseElement {
7354
7274
  }
7355
7275
  }
7356
7276
  class ValidateRenderObject extends CommContentBaseRenderObject {
7357
- render(e) {
7358
- let borderColor = this.element.focus ? '#fa8c16' : '#ffd591';
7359
- e.render.contentContext.strokeRect(e.position.x, e.position.y, this.rect.width, this.rect.height, borderColor);
7360
- e.render.contentContext.fillRect(e.position.x, e.position.y, 8, this.rect.height, '#871400');
7361
- const docRender = ElementUtil.getParentRender(this.commMarkRender.render, DocumentRenderObject);
7362
- //获取审阅标记的绘制坐标
7363
- let commMarkPos = ElementUtil.getRenderAbsolutePaintPos(this.commMarkRender.render, {
7364
- x: 0,
7365
- y: -e.docCtx.viewOptions.pageOffset.y
7366
- });
7367
- const commMarkLinePos = ElementUtil.getParaLinePos(this.commMarkRender.render, commMarkPos);
7368
- commMarkPos.y = commMarkLinePos.y + 2;
7369
- const docRenderPos = ElementUtil.getRenderAbsolutePaintPos(docRender, { x: 0, y: -e.docCtx.viewOptions.pageOffset.y });
7370
- const marginLeft = commMarkPos.x - docRenderPos.x - docRender.padding.left;
7371
- const marginRight = e.docCtx.viewOptions.docPageSettings.width - marginLeft - docRender.padding.right * 2;
7372
- e.render.overlaysContext.drawDashLine([commMarkPos, {
7373
- x: commMarkPos.x + marginRight,
7374
- y: commMarkPos.y
7375
- }], [1, 1], 'red');
7376
- e.render.overlaysContext.drawDashLine([{
7377
- x: commMarkPos.x + marginRight,
7378
- y: commMarkPos.y
7379
- }, e.position], [1, 1], 'red');
7380
- this.renderTitle(e.render, e.position);
7381
- }
7382
7277
  renderTitle(ctx, position) {
7383
7278
  const topPadding = 24;
7384
7279
  const textProps = new TextProps();
@@ -8304,40 +8199,11 @@ class DataElementBarcode extends DataElementLeaf {
8304
8199
  }
8305
8200
  }
8306
8201
  class DataElementBarcodeRenderObject extends ResizeLeafRenderObject {
8307
- render(e) {
8308
- // const barcodeEle = this.element as DataElementBarcode;
8309
- // barcodeEle.drawBarcode(e.render, e.position);
8310
- }
8311
8202
  clone() {
8312
8203
  const clone = new DataElementBarcodeRenderObject(this.element);
8313
8204
  clone.rect = ElementUtil.cloneRect(this.rect);
8314
8205
  return clone;
8315
8206
  }
8316
- pagePaintCompleted(e) {
8317
- if (this.element.isFocused) {
8318
- const { render, position: pos } = e;
8319
- const { width, height } = this.rect;
8320
- render.contentContext.strokeRect(pos.x, pos.y, this.rect.width, this.rect.height, '#1890ff', 0.5);
8321
- this.drawResizeCircle(render, pos.x, pos.y);
8322
- this.drawResizeCircle(render, pos.x + width, pos.y);
8323
- this.drawResizeCircle(render, pos.x, pos.y + height);
8324
- this.drawResizeCircle(render, pos.x + width, pos.y + height);
8325
- this.drawResizeCircle(render, pos.x + (Math.floor(width / 2)), pos.y);
8326
- this.drawResizeCircle(render, pos.x + (Math.floor(width / 2)), pos.y + height);
8327
- this.drawResizeCircle(render, pos.x, pos.y + (Math.floor(height / 2)));
8328
- this.drawResizeCircle(render, pos.x + width, pos.y + (Math.floor(height / 2)));
8329
- }
8330
- }
8331
- drawResizeCircle(ctx, x, y) {
8332
- const ctxNative = ctx.contentContext.ctx;
8333
- ctxNative.save();
8334
- ctxNative.fillStyle = '#69c0ff';
8335
- ctxNative.beginPath();
8336
- ctxNative.arc(x, y, Math.floor(4 / 5 * 4), 0, 2 * Math.PI);
8337
- ctxNative.closePath();
8338
- ctxNative.fill();
8339
- ctxNative.restore();
8340
- }
8341
8207
  exportHTML(event) {
8342
8208
  const t = super.exportHTML(event);
8343
8209
  if (this.element.props.type === 'qrcode') {
@@ -8502,27 +8368,6 @@ class DataElementCheckRenderObject extends LeafRenderObject {
8502
8368
  cloneRender.rect = ElementUtil.cloneRect(this.rect);
8503
8369
  return cloneRender;
8504
8370
  }
8505
- render(e) {
8506
- const { render, position } = e;
8507
- const element = this.element;
8508
- if (element.props.drawStateChar) {
8509
- const font = `${element.props.size - 2}px 微软雅黑`;
8510
- const str = element.props.checked ? element.props.trueChar : element.props.falseChar;
8511
- const color = element.props.checked ? element.props.trueStateColor : element.props.falseStateColor;
8512
- e.render.contentContext.drawText2(str, font, color, position.x, position.y, element.props.size, element.props.size);
8513
- if (element.props.border) {
8514
- e.render.contentContext.strokeRect(position.x + 2, position.y, element.props.size, element.props.size);
8515
- }
8516
- }
8517
- else {
8518
- if (element.props.multiSelect) {
8519
- render.contentContext.drawCheckBox(position.x + 2, position.y, element.props.size, element.props.size, element.props.checked);
8520
- }
8521
- else {
8522
- render.contentContext.drawRadioBox(position.x + 2, position.y, element.props.size, element.props.size, element.props.checked);
8523
- }
8524
- }
8525
- }
8526
8371
  exportHTML(event) {
8527
8372
  const t = super.exportHTML(event);
8528
8373
  const props = this.element.props;
@@ -8813,12 +8658,6 @@ class DataElementGroupElement extends InlineGroupInputElement {
8813
8658
  }
8814
8659
  }
8815
8660
  class DataElementGroupRenderObject extends InlineGroupRenderObject {
8816
- render(e) {
8817
- this.paintPos = e.position;
8818
- e.render.onRenderCompleted.subscribe(() => {
8819
- drawDecorator(e, this);
8820
- });
8821
- }
8822
8661
  clone() {
8823
8662
  const cloneRender = new DataElementGroupRenderObject(this.element);
8824
8663
  cloneRender.rect = ElementUtil.cloneRect(this.rect);
@@ -8872,18 +8711,6 @@ class DataElementImage extends DataElementLeaf {
8872
8711
  this.props.clone(clone.props);
8873
8712
  return clone;
8874
8713
  }
8875
- loadImage(ctx) {
8876
- if (this.status === 'no') {
8877
- this.status = 'loading';
8878
- const onCallback = (status) => {
8879
- this.status = status;
8880
- if (status === 'completed') {
8881
- this.refreshView();
8882
- }
8883
- };
8884
- ctx.imageLoader.loadImage(this.props.src, onCallback);
8885
- }
8886
- }
8887
8714
  destroy() {
8888
8715
  super.destroy();
8889
8716
  }
@@ -8898,70 +8725,11 @@ class DataElementImage extends DataElementLeaf {
8898
8725
  }
8899
8726
  }
8900
8727
  class DataImageRenderObject extends ResizeLeafRenderObject {
8901
- render(e) {
8902
- const { render, position, docCtx } = e;
8903
- const dataImgElement = this.element;
8904
- const picProps = dataImgElement.props;
8905
- if (dataImgElement.status === 'no') {
8906
- dataImgElement.loadImage(docCtx);
8907
- return;
8908
- }
8909
- if (dataImgElement.status === 'completed') {
8910
- const imageSource = docCtx.imageLoader.getImage(picProps.src);
8911
- if (!imageSource) {
8912
- return;
8913
- }
8914
- if (picProps.border === 'all') {
8915
- render.contentContext.strokeRect(position.x, position.y, this.rect.width, this.rect.height, 'black');
8916
- }
8917
- render.contentContext.ctx.drawImage(imageSource, 0, 0, imageSource.naturalWidth, imageSource.naturalHeight, position.x + 2, position.y + 2, picProps.width, picProps.height);
8918
- }
8919
- if (render.drawMode === 'view') {
8920
- let { x, y } = position;
8921
- const { width, height } = this.rect;
8922
- const lineWidth = 5;
8923
- const paintColor = '#0050b3';
8924
- render.contentContext.strokeLines([{ x: x + lineWidth, y }, { x, y }, { x, y: y + height }, {
8925
- x: x + lineWidth,
8926
- y: y + height
8927
- }], 1, paintColor);
8928
- x = x + width;
8929
- render.contentContext.strokeLines([{ x: x - lineWidth, y }, { x, y }, { x, y: y + height }, {
8930
- x: x - lineWidth,
8931
- y: y + height
8932
- }], 1, paintColor);
8933
- }
8934
- }
8935
8728
  clone() {
8936
8729
  const clone = new DataImageRenderObject(this.element);
8937
8730
  clone.rect = ElementUtil.cloneRect(this.rect);
8938
8731
  return clone;
8939
8732
  }
8940
- pagePaintCompleted(e) {
8941
- if (this.element.isFocused) {
8942
- const { render, position: pos } = e;
8943
- const { width, height } = this.rect;
8944
- render.contentContext.strokeRect(pos.x, pos.y, this.rect.width, this.rect.height, '#1890ff', 0.5);
8945
- this.drawResizeCircle(render, pos.x, pos.y);
8946
- this.drawResizeCircle(render, pos.x + width, pos.y);
8947
- this.drawResizeCircle(render, pos.x, pos.y + height);
8948
- this.drawResizeCircle(render, pos.x + width, pos.y + height);
8949
- this.drawResizeCircle(render, pos.x + (Math.floor(width / 2)), pos.y);
8950
- this.drawResizeCircle(render, pos.x + (Math.floor(width / 2)), pos.y + height);
8951
- this.drawResizeCircle(render, pos.x, pos.y + (Math.floor(height / 2)));
8952
- this.drawResizeCircle(render, pos.x + width, pos.y + (Math.floor(height / 2)));
8953
- }
8954
- }
8955
- drawResizeCircle(ctx, x, y) {
8956
- const ctxNative = ctx.contentContext.ctx;
8957
- ctxNative.save();
8958
- ctxNative.fillStyle = '#69c0ff';
8959
- ctxNative.beginPath();
8960
- ctxNative.arc(x, y, Math.floor(4 / 5 * 4), 0, 2 * Math.PI);
8961
- ctxNative.closePath();
8962
- ctxNative.fill();
8963
- ctxNative.restore();
8964
- }
8965
8733
  exportHTML(event) {
8966
8734
  const t = super.exportHTML(event);
8967
8735
  t.children = [{
@@ -9197,13 +8965,6 @@ class BreakElement extends LeafElement {
9197
8965
  }
9198
8966
  }
9199
8967
  class BreakRenderObject extends LeafRenderObject {
9200
- render(e) {
9201
- const { render, position } = e;
9202
- if (render.drawMode === 'print') {
9203
- return;
9204
- }
9205
- render.contentContext.drawText('↓', this.element.textProps, position.x, position.y, 20, this.rect.height);
9206
- }
9207
8968
  exportHTML(event) {
9208
8969
  if (!event.options.showEnterSymbol || event.mode === 'print') {
9209
8970
  return null;
@@ -9369,8 +9130,6 @@ class FillNullSpaceRenderObject extends LeafRenderObject {
9369
9130
  super(null);
9370
9131
  this.disableClick = true;
9371
9132
  }
9372
- render(e) {
9373
- }
9374
9133
  clone() {
9375
9134
  const clone = new FillNullSpaceRenderObject();
9376
9135
  clone.rect = ElementUtil.cloneRect(this.rect);
@@ -9431,11 +9190,6 @@ class DocumentBodyPartElement extends BlockContainerElement {
9431
9190
  }
9432
9191
  }
9433
9192
  class DocumentBodyPartRenderObject extends MuiltBlockLineRenderObject {
9434
- render(e) {
9435
- const { render, position } = e;
9436
- const bgColor = (this.element.isFocused || this.element.isMouseenter) ? '#d9d9d9' : '#ffffff';
9437
- render.overlaysContext.fillRect(position.x - 2, position.y - 2, this.rect.width + 4, this.rect.height + 4, bgColor, 5, 'black');
9438
- }
9439
9193
  clone(cloneData = true) {
9440
9194
  const cloneRender = new DocumentBodyPartRenderObject(this.element);
9441
9195
  cloneRender.rect = ElementUtil.cloneRect(this.rect);
@@ -9575,9 +9329,6 @@ function getMHItem(kind) {
9575
9329
  return mhLayoutItems[kindIndex];
9576
9330
  }
9577
9331
  class DataRenderMH extends LeafRenderObject {
9578
- render(e) {
9579
- renderMH(this.element, e.render, e.position, true);
9580
- }
9581
9332
  exportHTML(event) {
9582
9333
  const t = super.exportHTML(event);
9583
9334
  const children = [];
@@ -9807,80 +9558,16 @@ class PictureElement extends LeafElement {
9807
9558
  this.props.clone(clone.props);
9808
9559
  return clone;
9809
9560
  }
9810
- loadImage(ctx) {
9811
- if (this.status === 'no') {
9812
- this.status = 'loading';
9813
- //this.imageSource = new Image();
9814
- //this.imageSource.src = this.props.src;
9815
- // const onload = (e: any) => {
9816
- // this.isLoad = 'completed';
9817
- // this.refreshView('appearance');
9818
- // };
9819
- // const onerror = (e: any) => {
9820
- // this.isLoad = 'error';
9821
- // console.error(e);
9822
- // };
9823
- const onCallback = (status) => {
9824
- this.status = status;
9825
- if (status === 'completed') {
9826
- this.refreshView();
9827
- }
9828
- };
9829
- ctx.imageLoader.loadImage(this.props.src, onCallback);
9830
- }
9831
- }
9832
9561
  destroy() {
9833
9562
  super.destroy();
9834
9563
  }
9835
9564
  }
9836
9565
  class PictureRenderObject extends ResizeLeafRenderObject {
9837
- render(e) {
9838
- const { render, position, docCtx } = e;
9839
- const picElement = this.element;
9840
- const picProps = picElement.props;
9841
- if (picElement.status === 'no') {
9842
- picElement.loadImage(docCtx);
9843
- return;
9844
- }
9845
- if (picElement.status === 'completed') {
9846
- const imageSource = docCtx.imageLoader.getImage(picProps.src);
9847
- if (!imageSource) {
9848
- return;
9849
- }
9850
- if (picProps.border === 'all') {
9851
- render.contentContext.strokeRect(position.x, position.y, this.rect.width, this.rect.height, 'black');
9852
- }
9853
- render.contentContext.ctx.drawImage(imageSource, 0, 0, imageSource.naturalWidth, imageSource.naturalHeight, position.x + 2, position.y + 2, picProps.width, picProps.height);
9854
- }
9855
- }
9856
9566
  clone() {
9857
9567
  const clone = new PictureRenderObject(this.element);
9858
9568
  clone.rect = ElementUtil.cloneRect(this.rect);
9859
9569
  return clone;
9860
9570
  }
9861
- pagePaintCompleted(e) {
9862
- if (this.element.isFocused) {
9863
- const { render, position: pos } = e;
9864
- const { width, height } = this.rect;
9865
- render.contentContext.strokeRect(pos.x, pos.y, width, height, '#1890ff', 0.5);
9866
- this.drawResizeCircle(render, pos.x, pos.y);
9867
- this.drawResizeCircle(render, pos.x + width, pos.y);
9868
- this.drawResizeCircle(render, pos.x, pos.y + height);
9869
- this.drawResizeCircle(render, pos.x + width, pos.y + height);
9870
- this.drawResizeCircle(render, pos.x + (Math.floor(width / 2)), pos.y);
9871
- this.drawResizeCircle(render, pos.x + (Math.floor(width / 2)), pos.y + height);
9872
- this.drawResizeCircle(render, pos.x, pos.y + (Math.floor(height / 2)));
9873
- this.drawResizeCircle(render, pos.x + width, pos.y + (Math.floor(height / 2)));
9874
- }
9875
- }
9876
- drawResizeCircle(ctx, x, y) {
9877
- const ctxNative = ctx.contentContext.ctx;
9878
- ctxNative.fillStyle = '#69c0ff';
9879
- ctxNative.beginPath();
9880
- ctxNative.arc(x, y, Math.floor(4 / 5 * 4), 0, 2 * Math.PI);
9881
- ctxNative.closePath();
9882
- ctxNative.fill();
9883
- }
9884
9571
  exportHTML(event) {
9885
9572
  const picElement = this.element;
9886
9573
  const picProps = picElement.props;
@@ -10012,10 +9699,6 @@ class RadioBoxFactory extends ElementFactory {
10012
9699
  }
10013
9700
  }
10014
9701
  class RadioBoxRenderObject extends LeafRenderObject {
10015
- render(e) {
10016
- const { render, position } = e;
10017
- render.contentContext.drawRadioBox(position.x + 2, position.y, this.element.props.size, this.element.props.size, this.element.props.isChecked);
10018
- }
10019
9702
  clone(cloneData = true) {
10020
9703
  const clone = new RadioBoxRenderObject(this.element);
10021
9704
  clone.rect = ElementUtil.cloneRect(this.rect);
@@ -10054,13 +9737,6 @@ class PageBreakElement extends LeafElement {
10054
9737
  }
10055
9738
  }
10056
9739
  class PageBreakRenderObject extends LeafRenderObject {
10057
- render(e) {
10058
- const { render, position } = e;
10059
- if (render.drawMode === 'print') {
10060
- return;
10061
- }
10062
- render.contentContext.drawText('↩', this.element.textProps, position.x, position.y, 20, this.rect.height);
10063
- }
10064
9740
  clone() {
10065
9741
  const render = new PageBreakRenderObject(this.element);
10066
9742
  render.rect = ElementUtil.cloneRect(this.rect);
@@ -10097,13 +9773,6 @@ class TabElement extends LeafElement {
10097
9773
  }
10098
9774
  }
10099
9775
  class TabRenderObject extends LeafRenderObject {
10100
- render(e) {
10101
- const { render, position } = e;
10102
- if (render.drawMode === 'print') {
10103
- return;
10104
- }
10105
- //render.contentContext.fillRect(position.x,position.y,this.rect.width,this.rect.height,'red');
10106
- }
10107
9776
  clone() {
10108
9777
  const render = new TabRenderObject(this.element);
10109
9778
  render.rect = ElementUtil.cloneRect(this.rect);
@@ -10669,42 +10338,151 @@ class TableSplitCell {
10669
10338
  }
10670
10339
  }
10671
10340
 
10672
- class ElementSerialize {
10673
- /**
10674
- * 将当前文档对象构建并输出到标准的JSON对象
10675
- * @param element
10676
- * @param viewOptions
10677
- */
10678
- static serialize(element, viewOptions) {
10679
- const result = element.serialize(viewOptions);
10680
- if (!result) {
10681
- return null;
10682
- }
10683
- if (result.complete) {
10684
- return result;
10685
- }
10686
- if (element instanceof BranchElement) {
10687
- result.children = [];
10688
- let prevEle = null;
10689
- for (let i = 0; i < element.length; i++) {
10690
- const child = element.getChild(i);
10691
- const serializeChild = this.serialize(child, viewOptions);
10692
- if (child.type === 'text' && prevEle && prevEle.ele.type === 'text') {
10693
- if (child.props.equals(prevEle.ele.props)) {
10694
- prevEle.props.content += serializeChild.content;
10695
- continue;
10696
- }
10697
- }
10698
- if (serializeChild) {
10699
- delete serializeChild.complete;
10700
- serializeChild.props = serializeChild.props || {};
10701
- if (Object.keys(serializeChild.props).length === 0) {
10702
- delete serializeChild.props;
10703
- }
10704
- if (serializeChild.children && serializeChild.children.length === 0) {
10705
- delete serializeChild.children;
10706
- }
10707
- result.children.push(serializeChild);
10341
+ class SVGElement extends LeafElement {
10342
+ resizeable = true;
10343
+ constructor() {
10344
+ super('svg');
10345
+ this.props = new SVGProps();
10346
+ //this.addPropValueChangedSub(this.props);
10347
+ this.cursorType = 'move';
10348
+ this.focusable = true;
10349
+ }
10350
+ createRenderObject() {
10351
+ const render = new SVGRenderObject(this);
10352
+ render.rect.width = this.props.width;
10353
+ render.rect.height = this.props.height;
10354
+ return render;
10355
+ }
10356
+ serialize(options) {
10357
+ return {
10358
+ type: 'svg',
10359
+ props: {
10360
+ ...this.props.getSerializeProps(options)
10361
+ }
10362
+ };
10363
+ }
10364
+ clone(data) {
10365
+ const clone = new SVGElement();
10366
+ this.props.clone(clone.props);
10367
+ return clone;
10368
+ }
10369
+ destroy() {
10370
+ super.destroy();
10371
+ }
10372
+ }
10373
+ class SVGRenderObject extends ResizeLeafRenderObject {
10374
+ clone() {
10375
+ const clone = new SVGRenderObject(this.element);
10376
+ clone.rect = ElementUtil.cloneRect(this.rect);
10377
+ return clone;
10378
+ }
10379
+ drawResizeCircle(ctx, x, y) {
10380
+ const ctxNative = ctx.contentContext.ctx;
10381
+ ctxNative.fillStyle = '#69c0ff';
10382
+ ctxNative.beginPath();
10383
+ ctxNative.arc(x, y, Math.floor(4 / 5 * 4), 0, 2 * Math.PI);
10384
+ ctxNative.closePath();
10385
+ ctxNative.fill();
10386
+ }
10387
+ exportHTML(event) {
10388
+ const props = this.element.props;
10389
+ const t = super.exportHTML(event);
10390
+ t.children = [{
10391
+ sel: 'svg',
10392
+ data: {
10393
+ ns: "http://www.w3.org/2000/svg",
10394
+ attrs: {
10395
+ width: this.rect.width,
10396
+ height: this.rect.height
10397
+ }
10398
+ },
10399
+ children: [{
10400
+ sel: 'image',
10401
+ data: {
10402
+ ns: "http://www.w3.org/2000/svg",
10403
+ attrs: {
10404
+ "xlink:href": props.value,
10405
+ width: Math.min(this.rect.width, this.rect.height),
10406
+ height: Math.min(this.rect.width, this.rect.height)
10407
+ }
10408
+ }
10409
+ }]
10410
+ }];
10411
+ //绘制拖动圆圈
10412
+ if (this.element.isFocused) {
10413
+ const { width, height } = this.rect;
10414
+ const circlePoints = [{ x: 0, y: 0 }, { x: width, y: 0 }, { x: 0, y: height }, { x: width, y: height }, { x: Math.floor(width / 2), y: 0 }, { x: Math.floor(width / 2), y: height }, { x: 0, y: Math.floor(height / 2) }, { x: width, y: Math.floor(height / 2) }];
10415
+ circlePoints.forEach((p) => {
10416
+ t.children.push({
10417
+ sel: 'circle',
10418
+ data: {
10419
+ ns: "http://www.w3.org/2000/svg",
10420
+ attrs: {
10421
+ cx: p.x,
10422
+ cy: p.y,
10423
+ r: Math.floor(4 / 5 * 4),
10424
+ fill: '#69c0ff'
10425
+ }
10426
+ }
10427
+ });
10428
+ });
10429
+ }
10430
+ return t;
10431
+ }
10432
+ }
10433
+ class SVGFactory extends ElementFactory {
10434
+ match(type) {
10435
+ return type === 'svg';
10436
+ }
10437
+ createElement(data) {
10438
+ const props = data.props;
10439
+ const pic = new SVGElement();
10440
+ const picProps = pic.props;
10441
+ picProps.width = props.width;
10442
+ picProps.height = props.height;
10443
+ picProps.value = props.value;
10444
+ picProps.title = props.title;
10445
+ pic.props = picProps;
10446
+ return pic;
10447
+ }
10448
+ }
10449
+
10450
+ class ElementSerialize {
10451
+ /**
10452
+ * 将当前文档对象构建并输出到标准的JSON对象
10453
+ * @param element
10454
+ * @param viewOptions
10455
+ */
10456
+ static serialize(element, viewOptions) {
10457
+ const result = element.serialize(viewOptions);
10458
+ if (!result) {
10459
+ return null;
10460
+ }
10461
+ if (result.complete) {
10462
+ return result;
10463
+ }
10464
+ if (element instanceof BranchElement) {
10465
+ result.children = [];
10466
+ let prevEle = null;
10467
+ for (let i = 0; i < element.length; i++) {
10468
+ const child = element.getChild(i);
10469
+ const serializeChild = this.serialize(child, viewOptions);
10470
+ if (child.type === 'text' && prevEle && prevEle.ele.type === 'text') {
10471
+ if (child.props.equals(prevEle.ele.props)) {
10472
+ prevEle.props.content += serializeChild.content;
10473
+ continue;
10474
+ }
10475
+ }
10476
+ if (serializeChild) {
10477
+ delete serializeChild.complete;
10478
+ serializeChild.props = serializeChild.props || {};
10479
+ if (Object.keys(serializeChild.props).length === 0) {
10480
+ delete serializeChild.props;
10481
+ }
10482
+ if (serializeChild.children && serializeChild.children.length === 0) {
10483
+ delete serializeChild.children;
10484
+ }
10485
+ result.children.push(serializeChild);
10708
10486
  prevEle = { ele: child, props: serializeChild };
10709
10487
  }
10710
10488
  }
@@ -10721,6 +10499,9 @@ class ElementSerialize {
10721
10499
  if (element instanceof TextGroupElement && !element.isDecorate) {
10722
10500
  return element.text;
10723
10501
  }
10502
+ if (element instanceof PSymbolElement) {
10503
+ return '\n';
10504
+ }
10724
10505
  if (element instanceof BranchElement) {
10725
10506
  const items = [];
10726
10507
  for (let i = 0; i < element.length; i++) {
@@ -10871,32 +10652,6 @@ class TrackRunRenderObject extends InlineGroupRenderObject {
10871
10652
  constructor(ele) {
10872
10653
  super(ele);
10873
10654
  }
10874
- render(e) {
10875
- const { render, position, docCtx: { viewOptions } } = e;
10876
- render.tran(() => {
10877
- let fillColor = viewOptions.showTrackChanges ? this.element.type === 'ins-run' ? viewOptions.trackInsColor : viewOptions.trackDelColor : '';
10878
- if (fillColor) {
10879
- render.contentContext.ctx.fillStyle = fillColor;
10880
- }
10881
- e.nextRender();
10882
- });
10883
- const { x, y } = position;
10884
- //不显示痕迹
10885
- if (!viewOptions.showTrackChanges) {
10886
- return;
10887
- }
10888
- const color = this.element.type === 'ins-run' ? 'green' : 'red';
10889
- for (let i = 0; i < this.length; i++) {
10890
- const childRender = this.getChild(i);
10891
- const { rect } = childRender;
10892
- if (childRender.element && childRender.element.type === 'del-run') {
10893
- continue;
10894
- }
10895
- let lineY = y + rect.y + rect.height;
10896
- lineY = this.element.type === 'ins-run' ? lineY : lineY - rect.height / 2;
10897
- render.contentContext.drawHoriLine(x + rect.x, lineY, rect.width, color, 1);
10898
- }
10899
- }
10900
10655
  exportHTML(event) {
10901
10656
  const { options } = event;
10902
10657
  const t = super.exportHTML(event);
@@ -12459,9 +12214,9 @@ class ElementUtil {
12459
12214
  return this.getTextRenderOffset(render, x);
12460
12215
  }
12461
12216
  else {
12462
- if (render.element && render.element.type === 'psym') {
12463
- return 0;
12464
- }
12217
+ // if (render.element && render.element.type === 'psym') {
12218
+ // return 0;
12219
+ // }
12465
12220
  return (render.rect.width / 2) >= x ? 0 : 1;
12466
12221
  }
12467
12222
  }
@@ -13191,12 +12946,12 @@ class ElementPaint {
13191
12946
  }
13192
12947
  }
13193
12948
  });
13194
- docContainer.render({
13195
- render: this.renderCtx,
13196
- position: { x: docContainer.rect.x, y: docContainer.rect.y },
13197
- nextRender: nextRenderFn,
13198
- docCtx: this.docCtx
13199
- });
12949
+ // docContainer.render({
12950
+ // render: this.renderCtx,
12951
+ // position: { x: docContainer.rect.x, y: docContainer.rect.y },
12952
+ // nextRender: nextRenderFn,
12953
+ // docCtx: this.docCtx
12954
+ // })
13200
12955
  nextRenderFn();
13201
12956
  const { scale, viewSettings: { width, height } } = this.viewOptions;
13202
12957
  while (this.renderCtx.onRenderCompleted.subs.length > 0) {
@@ -13225,25 +12980,25 @@ class ElementPaint {
13225
12980
  this.drawRenderObject(child, currPosition, inViewPort);
13226
12981
  }
13227
12982
  });
13228
- const renderData = {
12983
+ ({
13229
12984
  position: currPosition,
13230
12985
  nextRender: nextRenderFn,
13231
12986
  render: this.renderCtx,
13232
12987
  docCtx: this.docCtx
13233
- };
13234
- renderObject.render(renderData);
12988
+ });
12989
+ //renderObject.render(renderData);
13235
12990
  nextRenderFn();
13236
12991
  }
13237
12992
  }
13238
12993
  else if (renderObject instanceof LeafRenderObject) {
13239
12994
  if (inViewPort) {
13240
- const renderData = {
12995
+ ({
13241
12996
  position: currPosition,
13242
12997
  nextRender: () => { },
13243
12998
  render: this.renderCtx,
13244
12999
  docCtx: this.docCtx
13245
- };
13246
- renderObject.render(renderData);
13000
+ });
13001
+ //renderObject.render(renderData);
13247
13002
  }
13248
13003
  }
13249
13004
  //处理选中拖蓝
@@ -13268,42 +13023,42 @@ class ElementPaint {
13268
13023
  this.renderCtx.contentContext.fillRect(currPosition.x, currPosition.y, renderObject.rect.width, renderObject.rect.height, this.viewOptions.selectionOverlaysColor);
13269
13024
  }
13270
13025
  }
13271
- if (inViewPort && this.viewOptions.showReviewWindow && this.docCtx.document.commentsContainerElement.cacheRender.selectedSet.has(element)) {
13272
- if (renderObject instanceof LeafRenderObject || renderObject instanceof DataElementRenderObject) {
13273
- const measureCommContainer = this.docCtx.document.commentsContainerElement.cacheRender;
13274
- const range = measureCommContainer.selectedSet.get(element);
13275
- if (range.isFullSelected) {
13276
- let commentRangePaintColor = '#ffd591';
13277
- for (let i = 0; i < measureCommContainer.commentRangeStatus.length; i++) {
13278
- const commentRangeStatus = measureCommContainer.commentRangeStatus[i];
13279
- if (commentRangeStatus.commContent.focus) {
13280
- if (RangeUtil.checkElementFullInRange(commentRangeStatus.range, element)) {
13281
- commentRangePaintColor = '#fa8c16';
13282
- }
13283
- }
13284
- }
13285
- const overlayRect = { x: currPosition.x, y: currPosition.y, width: rw, height: rh };
13286
- const paraLinePos = ElementUtil.getParaLinePos(renderObject, {
13287
- x: currPosition.x,
13288
- y: currPosition.y
13289
- });
13290
- this.renderCtx.overlaysContext.fillRect(overlayRect.x, paraLinePos.y, overlayRect.width, paraLinePos.height, commentRangePaintColor);
13291
- }
13292
- }
13293
- }
13026
+ // if (inViewPort && this.viewOptions.showReviewWindow && (<CommsContainerRenderObject>this.docCtx.document.commentsContainerElement.cacheRender).selectedSet.has(element)) {
13027
+ // if (renderObject instanceof LeafRenderObject || renderObject instanceof DataElementRenderObject) {
13028
+ // const measureCommContainer=<CommsContainerRenderObject>this.docCtx.document.commentsContainerElement.cacheRender;
13029
+ // const range = measureCommContainer.selectedSet.get(element) as SelectionContentRange;
13030
+ // if (range.isFullSelected) {
13031
+ // let commentRangePaintColor = '#ffd591';
13032
+ // for (let i = 0; i < measureCommContainer.commentRangeStatus.length; i++) {
13033
+ // const commentRangeStatus = measureCommContainer.commentRangeStatus[i];
13034
+ // if (commentRangeStatus.commContent.focus) {
13035
+ // if (RangeUtil.checkElementFullInRange(commentRangeStatus.range, element)) {
13036
+ // commentRangePaintColor = '#fa8c16';
13037
+ // }
13038
+ // }
13039
+ // }
13040
+ // const overlayRect = { x: currPosition.x, y: currPosition.y, width: rw, height: rh };
13041
+ // const paraLinePos = ElementUtil.getParaLinePos(renderObject, {
13042
+ // x: currPosition.x,
13043
+ // y: currPosition.y
13044
+ // });
13045
+ // this.renderCtx.overlaysContext.fillRect(overlayRect.x, paraLinePos.y, overlayRect.width, paraLinePos.height, commentRangePaintColor);
13046
+ // }
13047
+ // }
13048
+ // }
13294
13049
  }
13295
13050
  /**
13296
13051
  * 触发页面绘制结束事件
13297
13052
  */
13298
13053
  invokedPagePaintCompleted(renderObject, parent) {
13299
- const { x: rx, y: ry, width: rw, height: rh } = renderObject.rect;
13300
- const currPosition = { x: rx + parent.x, y: ry + parent.y };
13301
- renderObject.pagePaintCompleted({ render: this.renderCtx, position: currPosition, docCtx: this.docCtx });
13302
- if (renderObject instanceof BranchRenderObject) {
13303
- for (let i = 0; i < renderObject.length; i++) {
13304
- this.invokedPagePaintCompleted(renderObject.getChild(i), currPosition);
13305
- }
13306
- }
13054
+ // const { x: rx, y: ry, width: rw, height: rh } = renderObject.rect;
13055
+ // const currPosition = { x: rx + parent.x, y: ry + parent.y };
13056
+ // renderObject.pagePaintCompleted({ render: this.renderCtx, position: currPosition, docCtx: this.docCtx })
13057
+ // if (renderObject instanceof BranchRenderObject) {
13058
+ // for (let i = 0; i < renderObject.length; i++) {
13059
+ // this.invokedPagePaintCompleted(renderObject.getChild(i), currPosition);
13060
+ // }
13061
+ // }
13307
13062
  }
13308
13063
  static drawPage(renderCtx, docCtx, renderObject, parent) {
13309
13064
  const { x: rx, y: ry } = renderObject.rect;
@@ -13315,266 +13070,60 @@ class ElementPaint {
13315
13070
  this.drawPage(renderCtx, docCtx, child, currPosition);
13316
13071
  }
13317
13072
  });
13318
- const renderData = {
13319
- position: currPosition,
13320
- nextRender: nextRenderFn,
13321
- render: renderCtx,
13322
- docCtx
13323
- };
13324
- renderObject.render(renderData);
13073
+ //renderObject.render(renderData);
13325
13074
  nextRenderFn();
13326
13075
  }
13327
- else if (renderObject instanceof LeafRenderObject) {
13328
- const renderData = {
13329
- position: currPosition,
13330
- nextRender: () => { },
13331
- render: renderCtx,
13332
- docCtx: docCtx
13333
- };
13334
- renderObject.render(renderData);
13335
- }
13336
13076
  }
13337
13077
  }
13338
13078
 
13339
- /**
13340
- * 用于处理选区拖蓝
13341
- */
13342
- class SelectionOverlays {
13343
- selectionState;
13344
- selectionRange;
13345
- selectedSets = new Map();
13346
- constructor(selectionState) {
13347
- this.selectionState = selectionState;
13348
- }
13349
- getSelectionTreeData() {
13350
- let { ancestorCommonControl, startControl, startOffset, endControl, endOffset, collapsed } = this.selectionState;
13351
- this.selectedSets.clear();
13352
- if (this.selectionRange) {
13353
- this.selectionRange.selectedChildren.length = 0;
13354
- }
13355
- this.selectionRange = null;
13356
- if (!startControl || !endControl || !ancestorCommonControl) {
13357
- //this.selectionRange?.selectedChildren.length=0;
13358
- this.selectionState.selectedRange = null;
13359
- return;
13360
- }
13361
- if (collapsed) {
13362
- const commonRange = RangeUtil.getSelctionRange(startControl, startOffset, endControl, endOffset, ancestorCommonControl);
13363
- this.selectionState.selectedRange = commonRange;
13364
- this.selectedSets.clear();
13365
- return;
13366
- }
13367
- const fixStartElement = this.fixStartSelectionElement(startControl, startOffset, ancestorCommonControl);
13368
- startControl = fixStartElement.element;
13369
- startOffset = fixStartElement.offset;
13370
- const fixEndElement = this.fixEndSelectionElement(endControl, endOffset, ancestorCommonControl);
13371
- endControl = fixEndElement.element;
13372
- endOffset = fixEndElement.offset;
13373
- const commonRange = RangeUtil.getSelctionRange(startControl, startOffset, endControl, endOffset, ancestorCommonControl);
13374
- //console.log(commonRange);
13375
- this.selectionRange = commonRange;
13376
- this.convertSelectRangeToSet();
13377
- this.selectionState.selectedRange = commonRange;
13378
- }
13379
- convertSelectRangeToSet() {
13380
- this.selectedSets.clear();
13381
- if (this.selectionRange) {
13382
- SelectionOverlays.addToSets(this.selectionRange, this.selectedSets);
13383
- }
13079
+ class DocumentEvalFunc {
13080
+ docCtx;
13081
+ constructor(docCtx) {
13082
+ this.docCtx = docCtx;
13384
13083
  }
13385
- static addToSets(range, set) {
13386
- set.set(range.target, range);
13387
- for (let i = 0; i < range.selectedChildren.length; i++) {
13388
- //单元格全部选中效果,单元格整个拖蓝即可
13389
- if (range.isFullSelected && range.target.type === 'tbc') {
13390
- continue;
13084
+ scriptsFunc;
13085
+ /**
13086
+ * 实例化动态脚本
13087
+ */
13088
+ initScripts(scripts) {
13089
+ this.destroyScripts();
13090
+ if (scripts) {
13091
+ try {
13092
+ const func = new Function("docCtx", scripts);
13093
+ this.scriptsFunc = func(this.docCtx);
13094
+ }
13095
+ catch (e) {
13096
+ console.error("自定义标本解析错误", e);
13391
13097
  }
13392
- this.addToSets(range.selectedChildren[i], set);
13393
13098
  }
13099
+ // const func = (docCtx: DocumentContext) => {
13100
+ // const sexELe = docCtx.getControlById('NqoYI')
13101
+ // const dyEle = docCtx.getControlById('gTuBI');
13102
+ // return () => {
13103
+ // if (sexELe && dyEle) {
13104
+ // const sexValue = sexELe.getValue();
13105
+ // const dyValue = sexValue === '1' ? '男的吗' : sexValue === '2' ? '女的吗' : '难道是人妖吗';
13106
+ // dyEle.setValue(dyValue);
13107
+ // }
13108
+ // };
13109
+ // };
13394
13110
  }
13395
13111
  /**
13396
- * 添加到批注集合
13397
- * @param range
13398
- * @param set
13112
+ * 销毁动态脚本实例
13399
13113
  */
13400
- static addToCommentSets(range, set) {
13401
- set.set(range.target, range);
13402
- for (let i = 0; i < range.selectedChildren.length; i++) {
13403
- this.addToCommentSets(range.selectedChildren[i], set);
13114
+ destroyScripts() {
13115
+ if (this.scriptsFunc) {
13116
+ this.scriptsFunc = null;
13404
13117
  }
13405
13118
  }
13406
13119
  /**
13407
- * 修正开始选区内容
13408
- * 1.如果当前选区开始于表格内容,结束选区位于表格外,则需要开始选区内容重定位到单元格第一个元素
13409
- */
13410
- fixStartSelectionElement(element, offset, ancestorCommonControl) {
13411
- if (!(ancestorCommonControl instanceof TableElement)) {
13412
- const lookupParentCell = ElementUtil.getParentByType(element, TableCellElement);
13413
- if (lookupParentCell) {
13414
- if (!lookupParentCell.parent || !lookupParentCell.parent.parent) ;
13415
- const lookupParentTbIndex = ElementUtil.getControlIndex(lookupParentCell.parent.parent);
13416
- const ancestorCommonControlIndex = ElementUtil.getControlIndex(ancestorCommonControl);
13417
- if (ancestorCommonControlIndex < lookupParentTbIndex) {
13418
- const rowFirstLeafElement = ElementUtil.getFirstLeafElement(lookupParentCell.parent);
13419
- if (!rowFirstLeafElement) {
13420
- throw new Error('当前元素处于表格内元素,未能定位到当前单元格首个元素');
13421
- }
13422
- return {
13423
- element: rowFirstLeafElement,
13424
- offset: 0
13425
- };
13426
- }
13427
- }
13428
- }
13429
- return { element, offset };
13430
- }
13431
- /**
13432
- * 修正开始选区内容
13433
- * 1.如果当前选区开始于表格内容,结束选区位于表格外,则需要开始选区内容重定位到单元格第一个元素
13434
- */
13435
- fixEndSelectionElement(element, offset, ancestorCommonControl) {
13436
- if (!(ancestorCommonControl instanceof TableElement)) {
13437
- const lookupParentCell = ElementUtil.getParentByType(element, TableCellElement);
13438
- if (lookupParentCell) {
13439
- const lookupParentTbIndex = ElementUtil.getControlIndex(lookupParentCell.parent.parent);
13440
- const ancestorCommonControlIndex = ElementUtil.getControlIndex(ancestorCommonControl);
13441
- if (ancestorCommonControlIndex < lookupParentTbIndex) {
13442
- const rowLastLeafElement = ElementUtil.getLastLeafElement(lookupParentCell.parent);
13443
- if (!rowLastLeafElement) {
13444
- ElementUtil.getLastLeafElement(lookupParentCell.parent);
13445
- throw new Error('当前元素处于表格内元素,未能定位到当前单元格首个元素');
13446
- }
13447
- return {
13448
- element: rowLastLeafElement,
13449
- offset: 1
13450
- };
13451
- }
13452
- }
13453
- }
13454
- return { element, offset };
13455
- }
13456
- }
13457
-
13458
- class DocumentEvalFunc {
13459
- docCtx;
13460
- constructor(docCtx) {
13461
- this.docCtx = docCtx;
13462
- }
13463
- scriptsFunc;
13464
- /**
13465
- * 实例化动态脚本
13466
- */
13467
- initScripts(scripts) {
13468
- this.destroyScripts();
13469
- if (scripts) {
13470
- try {
13471
- const func = new Function("docCtx", scripts);
13472
- this.scriptsFunc = func(this.docCtx);
13473
- }
13474
- catch (e) {
13475
- console.error("自定义标本解析错误", e);
13476
- }
13477
- }
13478
- // const func = (docCtx: DocumentContext) => {
13479
- // const sexELe = docCtx.getControlById('NqoYI')
13480
- // const dyEle = docCtx.getControlById('gTuBI');
13481
- // return () => {
13482
- // if (sexELe && dyEle) {
13483
- // const sexValue = sexELe.getValue();
13484
- // const dyValue = sexValue === '1' ? '男的吗' : sexValue === '2' ? '女的吗' : '难道是人妖吗';
13485
- // dyEle.setValue(dyValue);
13486
- // }
13487
- // };
13488
- // };
13489
- }
13490
- /**
13491
- * 销毁动态脚本实例
13492
- */
13493
- destroyScripts() {
13494
- if (this.scriptsFunc) {
13495
- this.scriptsFunc = null;
13496
- }
13497
- }
13498
- /**
13499
- * 触发动态脚本
13120
+ * 触发动态脚本
13500
13121
  */
13501
13122
  invokedScripts() {
13502
13123
  this.scriptsFunc?.();
13503
13124
  }
13504
13125
  }
13505
13126
 
13506
- class DocumentImagesBaseLoader {
13507
- images = [];
13508
- clear() {
13509
- this.images.length = 0;
13510
- }
13511
- loadImage(src, onCallback) {
13512
- if (!src) {
13513
- return;
13514
- }
13515
- //已经存在的资源不需要重新加载
13516
- let matchItem = this.images.find(item => item.src === src);
13517
- if (matchItem) {
13518
- if (matchItem.loadStatus === 'no') {
13519
- matchItem.cbs.push(onCallback);
13520
- }
13521
- else {
13522
- onCallback(matchItem.loadStatus);
13523
- }
13524
- return;
13525
- }
13526
- const task = this.createRequestImage(src);
13527
- const imgItem = {
13528
- ele: undefined,
13529
- src,
13530
- cbs: [onCallback],
13531
- loadStatus: 'no',
13532
- task
13533
- };
13534
- this.images.push(imgItem);
13535
- // if (this.viewOptions.resourceMode === 'immediate') {
13536
- // ele.onload = (e) => { this.invokeImgLoad(src, 'completed'); };
13537
- // ele.onerror = (e) => { this.invokeImgLoad(src, 'error'); };
13538
- // }
13539
- }
13540
- invokeImgLoad(src, status, data) {
13541
- const img = this.images.find(item => item.src === src);
13542
- if (img) {
13543
- img.loadStatus = status;
13544
- img.cbs.forEach(cb => cb(status));
13545
- img.ele = data;
13546
- }
13547
- }
13548
- getLoadTasks() {
13549
- return this.images.map(item => item.task);
13550
- }
13551
- getImage(src) {
13552
- const img = this.images.find(item => item.src === src);
13553
- return img?.ele;
13554
- }
13555
- /**
13556
- * 判断图片是否都已经加载完毕
13557
- * 用于打印时判断,如果当前图片没有加载完毕就打印,图片是打印不出来
13558
- * @returns
13559
- */
13560
- imagesLoadCompleted() {
13561
- if (this.images.length === 0) {
13562
- return true;
13563
- }
13564
- return this.images.every(item => ['completed', 'error'].includes(item.loadStatus));
13565
- }
13566
- }
13567
- class DocumentImagesLoader extends DocumentImagesBaseLoader {
13568
- createRequestImage(url) {
13569
- const ele = new Image();
13570
- ele.src = url;
13571
- return new Promise((r, i) => {
13572
- ele.onload = (e) => { this.invokeImgLoad(url, 'completed', ele); r(); };
13573
- ele.onerror = (e) => { this.invokeImgLoad(url, 'error', ele); r(); };
13574
- });
13575
- }
13576
- }
13577
-
13578
13127
  /**
13579
13128
  * 当前打开的文档的上下文信息,当前文档所有的属性设置都暴露在上下文中
13580
13129
  */
@@ -13587,7 +13136,7 @@ class EditorContext {
13587
13136
  //文档刷新的订阅事件
13588
13137
  //refSub!: Subscription;
13589
13138
  syncRefresh;
13590
- imageLoader;
13139
+ //imageLoader: IImageLoader;
13591
13140
  dynamicFunc;
13592
13141
  docChange;
13593
13142
  clearPrevDocCb;
@@ -13597,7 +13146,7 @@ class EditorContext {
13597
13146
  this.selectionState = selectionState;
13598
13147
  this.viewOptions = viewOptions;
13599
13148
  this.dynamicFunc = new DocumentEvalFunc(this);
13600
- this.imageLoader = new DocumentImagesLoader();
13149
+ //this.imageLoader = new DocumentImagesLoader();
13601
13150
  this.selectionState.onChangedEvent.subscribe(() => {
13602
13151
  this.syncRefresh?.();
13603
13152
  });
@@ -13638,7 +13187,7 @@ class EditorContext {
13638
13187
  }
13639
13188
  clear() {
13640
13189
  this.selectionState.clear();
13641
- this.imageLoader.clear();
13190
+ //this.imageLoader.clear();
13642
13191
  this.dynamicFunc.destroyScripts();
13643
13192
  this.isDirty = false;
13644
13193
  }
@@ -13680,7 +13229,7 @@ class EditorContext {
13680
13229
  this.document.destroy();
13681
13230
  this.clearPrevDocCb?.();
13682
13231
  //this.ele_types_handlers.length = 0;
13683
- this.imageLoader.clear();
13232
+ //this.imageLoader.clear();
13684
13233
  this._document = null;
13685
13234
  }
13686
13235
  /**
@@ -13715,6 +13264,17 @@ class EditorContext {
13715
13264
  return this._document.modifyFlag === ModifyFlag$1.None ? 'appearance' : 'content';
13716
13265
  }
13717
13266
  }
13267
+ // export interface IImageLoader {
13268
+ // clear(): void;
13269
+ //
13270
+ // loadImage(src: string, onCallback: (status: ImgLoadStatus) => void): void;
13271
+ //
13272
+ // getImage(src: string): HTMLImageElement | undefined;
13273
+ //
13274
+ // imagesLoadCompleted(): boolean;
13275
+ //
13276
+ // getLoadTasks(): Array<Promise<void>>;
13277
+ // }
13718
13278
  /**
13719
13279
  * 文档上下文
13720
13280
  */
@@ -14608,13 +14168,139 @@ class ParagraphMeasure {
14608
14168
  }
14609
14169
  }
14610
14170
 
14171
+ /**
14172
+ * 用于处理选区拖蓝
14173
+ */
14174
+ class SelectionOverlays {
14175
+ selectionState;
14176
+ selectionRange;
14177
+ //选区对象集合
14178
+ selectionEleSets = new Map();
14179
+ //批注对象集合
14180
+ commRangeSets = new Map();
14181
+ constructor(selectionState) {
14182
+ this.selectionState = selectionState;
14183
+ }
14184
+ getSelectionTreeData() {
14185
+ let { ancestorCommonControl, startControl, startOffset, endControl, endOffset, collapsed } = this.selectionState;
14186
+ this.selectionEleSets.clear();
14187
+ if (this.selectionRange) {
14188
+ this.selectionRange.selectedChildren.length = 0;
14189
+ }
14190
+ this.selectionRange = null;
14191
+ if (!startControl || !endControl || !ancestorCommonControl) {
14192
+ //this.selectionRange?.selectedChildren.length=0;
14193
+ this.selectionState.selectedRange = null;
14194
+ return;
14195
+ }
14196
+ if (collapsed) {
14197
+ const commonRange = RangeUtil.getSectionRange(startControl, startOffset, endControl, endOffset, ancestorCommonControl);
14198
+ this.selectionState.selectedRange = commonRange;
14199
+ this.selectionEleSets.clear();
14200
+ return;
14201
+ }
14202
+ const fixStartElement = this.fixStartSelectionElement(startControl, startOffset, ancestorCommonControl);
14203
+ startControl = fixStartElement.element;
14204
+ startOffset = fixStartElement.offset;
14205
+ const fixEndElement = this.fixEndSelectionElement(endControl, endOffset, ancestorCommonControl);
14206
+ endControl = fixEndElement.element;
14207
+ endOffset = fixEndElement.offset;
14208
+ const commonRange = RangeUtil.getSectionRange(startControl, startOffset, endControl, endOffset, ancestorCommonControl);
14209
+ //console.log(commonRange);
14210
+ this.selectionRange = commonRange;
14211
+ this.convertSelectRangeToSet();
14212
+ this.selectionState.selectedRange = commonRange;
14213
+ }
14214
+ convertSelectRangeToSet() {
14215
+ this.selectionEleSets.clear();
14216
+ if (this.selectionRange) {
14217
+ SelectionOverlays.addToSets(this.selectionRange, this.selectionEleSets);
14218
+ }
14219
+ }
14220
+ static addToSets(range, set) {
14221
+ set.set(range.target, range);
14222
+ for (let i = 0; i < range.selectedChildren.length; i++) {
14223
+ //单元格全部选中效果,单元格整个拖蓝即可
14224
+ if (range.isFullSelected && range.target.type === 'tbc') {
14225
+ continue;
14226
+ }
14227
+ this.addToSets(range.selectedChildren[i], set);
14228
+ }
14229
+ }
14230
+ /**
14231
+ * 添加到批注集合
14232
+ * @param range
14233
+ * @param set
14234
+ * @param rangeColor 用以显示批注区间的颜色
14235
+ */
14236
+ static addToCommentSets(range, set, rangeColor) {
14237
+ range['rangeColor'] = rangeColor;
14238
+ set.set(range.target, range);
14239
+ for (let i = 0; i < range.selectedChildren.length; i++) {
14240
+ this.addToCommentSets(range.selectedChildren[i], set, rangeColor);
14241
+ }
14242
+ }
14243
+ /**
14244
+ * 修正开始选区内容
14245
+ * 1.如果当前选区开始于表格内容,结束选区位于表格外,则需要开始选区内容重定位到单元格第一个元素
14246
+ */
14247
+ fixStartSelectionElement(element, offset, ancestorCommonControl) {
14248
+ if (!(ancestorCommonControl instanceof TableElement)) {
14249
+ const lookupParentCell = ElementUtil.getParentByType(element, TableCellElement);
14250
+ if (lookupParentCell) {
14251
+ if (!lookupParentCell.parent || !lookupParentCell.parent.parent) ;
14252
+ const lookupParentTbIndex = ElementUtil.getControlIndex(lookupParentCell.parent.parent);
14253
+ const ancestorCommonControlIndex = ElementUtil.getControlIndex(ancestorCommonControl);
14254
+ if (ancestorCommonControlIndex < lookupParentTbIndex) {
14255
+ const rowFirstLeafElement = ElementUtil.getFirstLeafElement(lookupParentCell.parent);
14256
+ if (!rowFirstLeafElement) {
14257
+ throw new Error('当前元素处于表格内元素,未能定位到当前单元格首个元素');
14258
+ }
14259
+ return {
14260
+ element: rowFirstLeafElement,
14261
+ offset: 0
14262
+ };
14263
+ }
14264
+ }
14265
+ }
14266
+ return { element, offset };
14267
+ }
14268
+ /**
14269
+ * 修正开始选区内容
14270
+ * 1.如果当前选区开始于表格内容,结束选区位于表格外,则需要开始选区内容重定位到单元格第一个元素
14271
+ */
14272
+ fixEndSelectionElement(element, offset, ancestorCommonControl) {
14273
+ if (!(ancestorCommonControl instanceof TableElement)) {
14274
+ const lookupParentCell = ElementUtil.getParentByType(element, TableCellElement);
14275
+ if (lookupParentCell) {
14276
+ const lookupParentTbIndex = ElementUtil.getControlIndex(lookupParentCell.parent.parent);
14277
+ const ancestorCommonControlIndex = ElementUtil.getControlIndex(ancestorCommonControl);
14278
+ if (ancestorCommonControlIndex < lookupParentTbIndex) {
14279
+ const rowLastLeafElement = ElementUtil.getLastLeafElement(lookupParentCell.parent);
14280
+ if (!rowLastLeafElement) {
14281
+ ElementUtil.getLastLeafElement(lookupParentCell.parent);
14282
+ throw new Error('当前元素处于表格内元素,未能定位到当前单元格首个元素');
14283
+ }
14284
+ return {
14285
+ element: rowLastLeafElement,
14286
+ offset: 1
14287
+ };
14288
+ }
14289
+ }
14290
+ }
14291
+ return { element, offset };
14292
+ }
14293
+ }
14294
+
14611
14295
  class DocumentArrange {
14612
14296
  docCtx;
14613
14297
  renderCtx;
14298
+ seo;
14614
14299
  options;
14615
- constructor(docCtx, renderCtx) {
14300
+ constructor(docCtx, renderCtx, seo) {
14616
14301
  this.docCtx = docCtx;
14617
14302
  this.renderCtx = renderCtx;
14303
+ this.seo = seo;
14618
14304
  this.options = this.docCtx.viewOptions;
14619
14305
  }
14620
14306
  /**
@@ -14636,24 +14322,25 @@ class DocumentArrange {
14636
14322
  parser: new DynamicContextParser(doc, this.docCtx.selectionState),
14637
14323
  createParaFn: () => this.createDefaultPara()
14638
14324
  };
14639
- doc.commentsContainerElement.clearMarkItems();
14325
+ doc.clearMarkItems();
14640
14326
  this.clearPaintCache(doc, data);
14641
- this.docCtx.viewOptions.showReviewWindow = this.docCtx.document.commentsContainerElement.markPairs.length > 0;
14327
+ //this.docCtx.viewOptions.showReviewWindow = this.docCtx.document.commentsContainerElement.markPairs.length > 0;
14642
14328
  const docRenders = this.arrangeDoc();
14643
14329
  this.setMeasureCompletedModifyFlag(doc);
14644
14330
  this.cacheDocRenders(docRenders);
14331
+ this.generateCommRange();
14645
14332
  return docRenders;
14646
14333
  });
14647
14334
  }
14648
- commentsRender;
14335
+ //commentsRender!: CommsContainerRenderObject;
14649
14336
  arrangeDoc() {
14650
14337
  const doc = this.docCtx.document;
14651
14338
  const docRender = doc.createRenderObject();
14652
14339
  const innerRect = docRender.getInnerRect();
14653
14340
  const headerRender = this.measureControl(doc.headerElement, innerRect.width);
14654
14341
  const footerRender = this.measureControl(doc.footerElement, innerRect.width);
14655
- const commentsRender = this.measureControl(doc.commentsContainerElement, this.options.reviewWindowWidth);
14656
- this.commentsRender = commentsRender;
14342
+ //const commentsRender = this.measureControl(doc.commentsContainerElement, this.options.reviewWindowWidth) as CommsContainerRenderObject;
14343
+ //this.commentsRender = commentsRender;
14657
14344
  const { headerLine, footerLine } = docRender;
14658
14345
  let bodyMarginTop = headerLine + headerRender.rect.height + 6;
14659
14346
  let bodyMarginBottom = footerLine + footerRender.rect.height;
@@ -14748,15 +14435,15 @@ class DocumentArrange {
14748
14435
  cloneFooterRender.rect.x = limitRect.x;
14749
14436
  cloneFooterRender.rect.y = documentRender.rect.height - bodyMarginBottom;
14750
14437
  currColumn === 0 && documentRender.addChild(cloneFooterRender);
14751
- //审阅模式,添加审阅窗口
14752
- if (this.options.showReviewWindow && commentsRender) {
14753
- const commentsContainer = this.createRenderObject(commentsRender.element);
14754
- commentsContainer.padding.top = bodyMarginTop;
14755
- commentsContainer.rect.height = documentRender.rect.height;
14756
- documentRender.addChild(commentsContainer);
14757
- commentsContainer.rect.x = documentRender.rect.x + documentRender.rect.width;
14758
- documentRender.rect.width += this.options.reviewWindowWidth;
14759
- }
14438
+ // //审阅模式,添加审阅窗口
14439
+ // if (this.options.showReviewWindow && commentsRender) {
14440
+ // const commentsContainer = this.createRenderObject(commentsRender.element) as CommsContainerRenderObject;
14441
+ // commentsContainer.padding.top = bodyMarginTop;
14442
+ // commentsContainer.rect.height = documentRender.rect.height;
14443
+ // documentRender.addChild(commentsContainer);
14444
+ // commentsContainer.rect.x = documentRender.rect.x + documentRender.rect.width;
14445
+ // documentRender.rect.width += this.options.reviewWindowWidth;
14446
+ // }
14760
14447
  currColumn++;
14761
14448
  if (currColumn === docColumns) {
14762
14449
  currColumn = 0;
@@ -14784,8 +14471,7 @@ class DocumentArrange {
14784
14471
  }
14785
14472
  if (element instanceof BlockContentElement) {
14786
14473
  const pRange = new ParagraphMeasure(this.options, this.renderCtx);
14787
- const innerLineRects = pRange.measureParagraph(element, maxWidth);
14788
- return innerLineRects;
14474
+ return pRange.measureParagraph(element, maxWidth);
14789
14475
  }
14790
14476
  else if (element instanceof BlockContainerElement) {
14791
14477
  const renders = [];
@@ -14923,7 +14609,6 @@ class DocumentArrange {
14923
14609
  * 切割渲染元素
14924
14610
  * @param tbRender 被切割的对象
14925
14611
  * @param limitHeight
14926
- * @param addFunc
14927
14612
  * @returns
14928
14613
  */
14929
14614
  cutTable(tbRender, limitHeight) {
@@ -14951,8 +14636,13 @@ class DocumentArrange {
14951
14636
  let currRow = rows[j];
14952
14637
  const cutRows = [];
14953
14638
  while (currRow) {
14639
+ const minHeight = currRow.element.props.minHeight;
14954
14640
  const rowContentHeight = this.getBlockLineHeight(currRow);
14955
14641
  if (rowContentHeight + sumHeight > limitHeight) {
14642
+ //行存在最小高度,且当前行内容的高度小于最小高度,且当前行跨页的情况下,不截断该行
14643
+ if (minHeight > 0 && minHeight > rowContentHeight) {
14644
+ break;
14645
+ }
14956
14646
  //限制的外框尺寸
14957
14647
  const availHeight = limitHeight - sumHeight;
14958
14648
  const limitRenderInnerHeight = ElementUtil.innerRectMaxHeight(tbRender, availHeight);
@@ -15193,7 +14883,7 @@ class DocumentArrange {
15193
14883
  }
15194
14884
  identifyComment(ele) {
15195
14885
  if (ele instanceof CommentElement) {
15196
- this.docCtx.document.commentsContainerElement.identifyCommMark(ele);
14886
+ this.docCtx.document.identifyCommMark(ele);
15197
14887
  }
15198
14888
  }
15199
14889
  cacheDoc;
@@ -15204,6 +14894,22 @@ class DocumentArrange {
15204
14894
  });
15205
14895
  this.cacheDoc = null;
15206
14896
  }
14897
+ /**
14898
+ * 生成批注区间信息
14899
+ * @param renderTree
14900
+ */
14901
+ generateCommRange() {
14902
+ this.seo.commRangeSets.clear();
14903
+ const commMarks = this.docCtx.document.markPairs;
14904
+ for (let i = 0; i < commMarks.length; i++) {
14905
+ const commMark = commMarks[i];
14906
+ if (commMark.start && commMark.end) {
14907
+ const ancestor = DocumentSelection.getAncestorCommonControl(commMark.start, commMark.end);
14908
+ const range = RangeUtil.getSectionRange(commMark.start, 0, commMark.end, 1, ancestor);
14909
+ SelectionOverlays.addToCommentSets(range, this.seo.commRangeSets, commMark.start.color);
14910
+ }
14911
+ }
14912
+ }
15207
14913
  cacheRenders(renderTree) {
15208
14914
  if (renderTree.element) {
15209
14915
  renderTree.element.paintRenders.push(renderTree);
@@ -15676,644 +15382,157 @@ class ElementMeasure {
15676
15382
  if (this.containPostPunctuation(render.textMeasures[i + 1]?.char)) {
15677
15383
  i--;
15678
15384
  }
15679
- else {
15680
- i++;
15681
- }
15682
- }
15683
- else {
15684
- if (i > 1 && this.containPostPunctuation(render.textMeasures[i]?.char)) {
15685
- i--;
15686
- }
15687
- }
15688
- return i;
15689
- }
15690
- /**
15691
- * 是否包含后置标点
15692
- * @param str
15693
- * @returns
15694
- */
15695
- containPostPunctuation(str) {
15696
- return '!),.:;?]}¨·ˇˉ―‖’”…∶、。〃々〉》」』】〕〗!"'),.:;?]`|}~¢'.indexOf(str) > -1;
15697
- }
15698
- //是否包含前置标点
15699
- containLeadingPunctuation(str) {
15700
- return '‘“〈《「『【〔〖([{£'.indexOf(str) > -1;
15701
- }
15702
- /**
15703
- * 文本开头是否包含后置标点
15704
- * @param render
15705
- * @returns
15706
- */
15707
- containerStartSymbolInTextStart(render) {
15708
- //return false;
15709
- if (render instanceof TextGroupRenderObject) {
15710
- if (render.textMeasures.length > 0) {
15711
- return this.containPostPunctuation(render.textMeasures[0].char);
15712
- }
15713
- }
15714
- return false;
15715
- }
15716
- cutFillNullRender(render, limitWidth) {
15717
- if (limitWidth === 0) {
15718
- return { firstItem: null, lastItem: null };
15719
- }
15720
- if (render.rect.width > limitWidth) {
15721
- const cutRender = new FillNullSpaceRenderObject();
15722
- cutRender.rect.width = limitWidth;
15723
- cutRender.rect.height = render.rect.height;
15724
- render.rect.width = render.rect.width - limitWidth;
15725
- return { firstItem: cutRender, lastItem: render };
15726
- }
15727
- else {
15728
- return { firstItem: render, lastItem: null };
15729
- }
15730
- }
15731
- /**
15732
- * 行内编组元素超出行内可用空间,需要根据剩余空间长度进行截断
15733
- */
15734
- cutInlineGroupRenderItem(render, limitWidth, emptyLine, inCloseBody) {
15735
- const cutRender = render.element.createRenderObject({ options: this.options, renderCtx: this.renderCtx });
15736
- let x = 0;
15737
- let br = false;
15738
- const items = [...render.getItems()];
15739
- for (let i = 0; i < items.length; i++) {
15740
- const child = items[i];
15741
- if (child instanceof LeafRenderObject) {
15742
- if (x + child.rect.width > limitWidth) {
15743
- const { firstItem, lastItem, br: childBr } = this.cutRenderItem(child, items[i + 1], limitWidth - x, emptyLine && cutRender.length === 0, inCloseBody);
15744
- if (firstItem) {
15745
- cutRender.addChild(firstItem);
15746
- }
15747
- br = childBr || br;
15748
- break;
15749
- }
15750
- else {
15751
- render.removeChild(child);
15752
- cutRender.addChild(child);
15753
- }
15754
- //软换行符
15755
- if (child.element && child.element.type === 'br') {
15756
- br = true;
15757
- break;
15758
- }
15759
- }
15760
- else if (child instanceof InlineGroupRenderObject) {
15761
- if (x + child.rect.width > limitWidth) {
15762
- const { firstItem, br: childBr } = this.cutInlineGroupRenderItem(child, limitWidth - x, emptyLine && cutRender.length === 0, inCloseBody);
15763
- if (firstItem) {
15764
- cutRender.addChild(firstItem);
15765
- }
15766
- br = childBr || br;
15767
- break;
15768
- }
15769
- else {
15770
- render.removeChild(child);
15771
- cutRender.addChild(child);
15772
- }
15773
- }
15774
- x += child.rect.width;
15775
- }
15776
- if (!cutRender.length) {
15777
- return { firstItem: null, lastItem: null };
15778
- }
15779
- ElementUtil.remeasureInlineGroupRender(cutRender);
15780
- ElementUtil.remeasureInlineGroupRender(render);
15781
- return { firstItem: cutRender, lastItem: render.length ? render : null, br };
15782
- }
15783
- /**
15784
- * 修改测量完毕后的元素状态
15785
- * @param ele
15786
- */
15787
- setMeasureCompletedModifyFlag(ele) {
15788
- if (ele instanceof BranchElement) {
15789
- for (let i = 0; i < ele.length; i++) {
15790
- this.setMeasureCompletedModifyFlag(ele.getChild(i));
15791
- }
15792
- }
15793
- ele.modifyFlag = ModifyFlag$1.None;
15794
- }
15795
- clearPaintCache(ele, data) {
15796
- ele.beginMeasure(data);
15797
- if (ele instanceof BranchElement) {
15798
- for (let i = 0; i < ele.length; i++) {
15799
- this.clearPaintCache(ele.getChild(i), data);
15800
- }
15801
- }
15802
- }
15803
- endMeasures(ele) {
15804
- if (ele instanceof BranchElement) {
15805
- for (let i = 0; i < ele.length; i++) {
15806
- this.endMeasures(ele.getChild(i));
15807
- }
15808
- }
15809
- }
15810
- }
15811
-
15812
- class ElementRenderCut {
15813
- options;
15814
- renderContext;
15815
- constructor(options, renderContext) {
15816
- this.options = options;
15817
- this.renderContext = renderContext;
15818
- }
15819
- cutPage(documentRender, documentElement) {
15820
- if (this.options.fullPageView) {
15821
- return this.getFullViewDocRender(documentRender, documentElement);
15822
- }
15823
- const headerRender = documentRender.getChild(0);
15824
- const bodyRender = documentRender.getChild(1).clone();
15825
- const footerRender = documentRender.getChild(2);
15826
- const commentsRender = documentRender.getChild(3);
15827
- const { headerLine, footerLine } = documentRender;
15828
- let bodyMarginTop = headerLine + headerRender.rect.height + 6;
15829
- let bodyMarginBottom = footerLine + footerRender.rect.height;
15830
- const { top: bodyTop, bottom: bodyBottom } = documentRender.padding;
15831
- bodyMarginTop = bodyMarginTop > bodyTop ? bodyMarginTop : bodyTop;
15832
- bodyMarginBottom = bodyMarginBottom > bodyBottom ? bodyMarginBottom : bodyBottom;
15833
- documentRender.padding.top = bodyMarginTop;
15834
- documentRender.padding.bottom = bodyMarginBottom;
15835
- const bodyLimitRect = this.getDocInnerRect(documentRender);
15836
- const bodyArray = [];
15837
- let { emptyBody: pageBodyRender, innerRect: bodyInnerLimitRect } = this.createEmptyBodyRender(bodyRender, bodyLimitRect);
15838
- bodyArray.push(pageBodyRender);
15839
- const createBodyHolder = () => {
15840
- const { emptyBody, innerRect } = this.createEmptyBodyRender(bodyRender, bodyLimitRect);
15841
- pageBodyRender = emptyBody;
15842
- bodyInnerLimitRect = innerRect;
15843
- bodyArray.push(pageBodyRender);
15844
- };
15845
- const appendToBody = (item) => {
15846
- item.rect.y = bodyInnerLimitRect.height + item.margin.top;
15847
- pageBodyRender.addChild(item);
15848
- bodyInnerLimitRect.height += item.rect.height + item.margin.top + item.margin.bottom;
15849
- //上一个元素的bottom-margin
15850
- //bodyInnerLimitRect.prevMargin = item.margin.bottom;
15851
- ElementUtil.updateRenderHeightByInnerRect(pageBodyRender, bodyInnerLimitRect);
15852
- };
15853
- let i = 0;
15854
- let cloneBlockContentRender = bodyRender.getChild(i);
15855
- while (cloneBlockContentRender) {
15856
- if (bodyInnerLimitRect.maxHeight - bodyInnerLimitRect.height - cloneBlockContentRender.rect.height - cloneBlockContentRender.margin.bottom - cloneBlockContentRender.margin.top < 0) {
15857
- //限制的外框尺寸
15858
- const bodyAvailHeight = bodyInnerLimitRect.maxHeight - bodyInnerLimitRect.height - cloneBlockContentRender.margin.bottom - cloneBlockContentRender.margin.top;
15859
- //限制的内框尺寸
15860
- const limitRenderInnterHeight = ElementUtil.innerRectMaxHeight(cloneBlockContentRender, bodyAvailHeight);
15861
- const cutRenderObject = this.cutRenderItem(cloneBlockContentRender, limitRenderInnterHeight);
15862
- //至少有一个块级行元素被切割出来
15863
- if (cutRenderObject) {
15864
- appendToBody(cutRenderObject);
15865
- }
15866
- createBodyHolder();
15867
- }
15868
- else {
15869
- appendToBody(cloneBlockContentRender);
15870
- if (++i < bodyRender.length) {
15871
- cloneBlockContentRender = bodyRender.getChild(i);
15872
- }
15873
- else {
15874
- cloneBlockContentRender = null;
15875
- }
15876
- }
15877
- }
15878
- const docPages = [];
15879
- let pageY = this.options.docSpace;
15880
- for (let i = 0; i < bodyArray.length; i++) {
15881
- const body = bodyArray[i];
15882
- const documentRender = documentElement.createRenderObject();
15883
- docPages.push(documentRender);
15884
- documentRender.rect.y = pageY;
15885
- const limitRect = documentRender.getInnerRect();
15886
- const cloneHeaderRender = headerRender.clone();
15887
- cloneHeaderRender.rect.x = limitRect.x;
15888
- cloneHeaderRender.rect.y = headerLine;
15889
- documentRender.addChild(cloneHeaderRender);
15890
- body.rect.x = limitRect.x;
15891
- body.rect.y = bodyMarginTop;
15892
- body.rect.height = bodyInnerLimitRect.maxHeight;
15893
- documentRender.addChild(body);
15894
- pageY += documentRender.rect.height + this.options.docSpace;
15895
- const cloneFooterRender = footerRender.clone();
15896
- cloneFooterRender.rect.x = limitRect.x;
15897
- cloneFooterRender.rect.y = documentRender.rect.height - bodyMarginBottom;
15898
- documentRender.addChild(cloneFooterRender);
15899
- //审阅模式,添加审阅窗口
15900
- if (this.options.showReviewWindow && commentsRender) {
15901
- const commentsContainer = commentsRender.element.createRenderObject({
15902
- options: this.options,
15903
- renderCtx: this.renderContext
15904
- });
15905
- commentsContainer.padding.top = bodyMarginTop;
15906
- commentsContainer.rect.height = documentRender.rect.height;
15907
- documentRender.addChild(commentsContainer);
15908
- commentsContainer.rect.x = documentRender.rect.x + documentRender.rect.width;
15909
- documentRender.rect.width += this.options.reviewWindowWidth;
15910
- }
15911
- }
15912
- return docPages;
15913
- }
15914
- getDocInnerRect(documentRender) {
15915
- const render = documentRender.element.createRenderObject({
15916
- options: this.options,
15917
- renderCtx: this.renderContext
15918
- });
15919
- render.padding = documentRender.padding;
15920
- return render.getInnerRect();
15921
- }
15922
- getFullViewDocRender(documentRender, documentElement) {
15923
- const commentsRender = documentRender.getChild(3);
15924
- const commentsContainer = commentsRender.element.createRenderObject({
15925
- options: this.options,
15926
- renderCtx: this.renderContext
15927
- });
15928
- documentRender.rect.height -= commentsContainer.rect.height;
15929
- const bodyRender = documentRender.getChild(1);
15930
- if (this.options.showReviewWindow) {
15931
- documentRender.removeChild(commentsRender);
15932
- documentRender.addChild(commentsContainer);
15933
- commentsContainer.padding.top = bodyRender.rect.y;
15934
- commentsContainer.rect.height = documentRender.rect.height;
15935
- commentsContainer.rect.x = documentRender.rect.x + documentRender.rect.width;
15936
- documentRender.rect.width += this.options.reviewWindowWidth;
15937
- }
15938
- return [documentRender];
15939
- }
15940
- createEmptyBodyRender(bodyRender, limitRect) {
15941
- const pageBodyRender = bodyRender.element.createRenderObject({
15942
- options: this.options,
15943
- renderCtx: this.renderContext
15944
- });
15945
- pageBodyRender.rect.width = limitRect.width;
15946
- const bodyInnerLimitRect = pageBodyRender.getInnerRect();
15947
- if (this.options.fullPageView) {
15948
- bodyInnerLimitRect.height = Number.MAX_VALUE;
15949
- }
15950
- return {
15951
- emptyBody: pageBodyRender,
15952
- innerRect: { ...bodyInnerLimitRect, prevMargin: 0, maxWidth: limitRect.width, maxHeight: limitRect.height }
15953
- };
15954
- }
15955
- /**
15956
- * 切割渲染元素
15957
- * @param render 被切割的对象
15958
- * @param limitHeight
15959
- * @returns
15960
- */
15961
- cutRenderItem(render, limitHeight) {
15962
- if (render instanceof TableRowRenderObject) {
15963
- return this.cutRowRenderItem(render, limitHeight);
15964
- }
15965
- if (render instanceof TableRenderObject) {
15966
- return this.cutTable(render, limitHeight);
15967
- }
15968
- const cloneRender = render.element.createRenderObject({
15969
- options: this.options,
15970
- renderCtx: this.renderContext
15971
- });
15972
- cloneRender.setRenderWidth(render.rect.width);
15973
- if (render instanceof MuiltBlockLineRenderObject) {
15974
- let sumHeight = 0;
15975
- const children = [...render.getItems()];
15976
- let j = 0;
15977
- let blockLine = children[j];
15978
- while (blockLine) {
15979
- //sumHeight = ElementUtil.remeasure(cloneRender);
15980
- const calcBlockLineHeight = this.getBlockLineHeight(blockLine);
15981
- if (calcBlockLineHeight + sumHeight > limitHeight) {
15982
- if (blockLine instanceof MuiltBlockLineRenderObject) {
15983
- //限制的外框尺寸
15984
- const availHeight = limitHeight - sumHeight;
15985
- //限制的内框尺寸
15986
- const limitRenderInnterHeight = ElementUtil.innerRectMaxHeight(render, availHeight);
15987
- const cutRenderObject = this.cutRenderItem(blockLine, limitRenderInnterHeight);
15988
- if (cutRenderObject) {
15989
- cloneRender.addChild(cutRenderObject);
15990
- sumHeight += cutRenderObject.rect.height;
15991
- blockLine = children[++j];
15992
- break;
15993
- }
15994
- else {
15995
- break;
15996
- }
15997
- }
15998
- else {
15999
- break;
16000
- }
16001
- }
16002
- else {
16003
- render.removeChild(blockLine);
16004
- cloneRender.addChild(blockLine);
16005
- sumHeight += blockLine.rect.height;
16006
- blockLine = children[++j];
16007
- }
16008
- }
16009
- ElementUtil.remeasure(cloneRender);
16010
- ElementUtil.remeasure(render);
16011
- if (cloneRender.length === 0) {
16012
- return null;
16013
- }
16014
- else {
16015
- return cloneRender;
16016
- }
16017
- }
16018
- else {
16019
- throw new Error('未实现');
16020
- }
16021
- }
16022
- /**
16023
- * 切割渲染元素
16024
- * @param tbRender 被切割的对象
16025
- * @param limitHeight
16026
- * @param addFunc
16027
- * @returns
16028
- */
16029
- cutTable(tbRender, limitHeight) {
16030
- const cloneTbRender = tbRender.element.createRenderObject();
16031
- cloneTbRender.setRenderWidth(tbRender.rect.width);
16032
- let sumHeight = 0;
16033
- const rows = [...tbRender.getItems()];
16034
- //获取跨页需要重复显示的行
16035
- const headerRows = this.getHeaderRows(tbRender);
16036
- //跨页头的高度
16037
- const headerHeight = headerRows.reduce((prev, curr) => prev + curr.rect.height, 0);
16038
- if (headerHeight > limitHeight) {
16039
- return null;
16040
- }
16041
- const copyHeaderRows = headerRows.map(item => item.clone());
16042
- //获取最后一个截断行,需要根据截断行判断最后一个截断的行位置
16043
- const cutOffRows = rows.filter(row => limitHeight >= row.rect.y && limitHeight <= row.rect.y + row.rect.height)
16044
- .map((row) => ({ rowIndex: row.element.getIndex(), row }))
16045
- .sort((first, second) => second.rowIndex - first.rowIndex);
16046
- if (cutOffRows.length === 0) {
16047
- throw new Error('无法获取截断行');
16048
- }
16049
- const joinRow = cutOffRows[0].row;
16050
- let j = 0;
16051
- let currRow = rows[j];
16052
- const cutRows = [];
16053
- while (currRow) {
16054
- const rowContentHeight = this.getBlockLineHeight(currRow);
16055
- if (rowContentHeight + sumHeight > limitHeight) {
16056
- if (currRow instanceof MuiltBlockLineRenderObject) {
16057
- //限制的外框尺寸
16058
- const availHeight = limitHeight - sumHeight;
16059
- //限制的内框尺寸
16060
- const limitRenderInnterHeight = ElementUtil.innerRectMaxHeight(tbRender, availHeight);
16061
- const cutRow = this.cutRowRenderItem(currRow, limitRenderInnterHeight);
16062
- if (cutRow) {
16063
- cloneTbRender.addChild(cutRow);
16064
- sumHeight += cutRow.rect.height;
16065
- cutRows.push(currRow);
16066
- if (currRow === joinRow) {
16067
- break;
16068
- }
16069
- currRow = rows[++j];
16070
- }
16071
- else {
16072
- break;
16073
- }
16074
- }
16075
- else {
16076
- break;
16077
- }
16078
- }
16079
- else {
16080
- tbRender.removeChild(currRow);
16081
- cloneTbRender.addChild(currRow);
16082
- sumHeight += currRow.rect.height;
16083
- currRow = rows[++j];
16084
- }
16085
- }
16086
- this.fixCutTable(tbRender, cutRows);
16087
- ElementUtil.remeasure(cloneTbRender);
16088
- //存在跨页需要重复显示的行头,则需要重新放置行头
16089
- if (copyHeaderRows.length) {
16090
- copyHeaderRows.forEach((r, i) => tbRender.insertChild(r, i));
16091
- }
16092
- ElementUtil.remeasure(tbRender);
16093
- if (cloneTbRender.length === 0) {
16094
- return null;
16095
- }
16096
- else {
16097
- return cloneTbRender;
16098
- }
16099
- }
16100
- cutRowRenderItem(render, limitHeight) {
16101
- if (render.element.props.minHeight > 0 && render.rect.height > limitHeight) {
16102
- return null;
16103
- }
16104
- const cloneRowRender = render.element.createRenderObject();
16105
- cloneRowRender.rect.width = render.rect.width;
16106
- render.remeasureState = true;
16107
- //cloneRowRender.rect.maxWidth = render.rect.height;
16108
- const cellRenders = [...render.getItems()];
16109
- const cutCellRenders = [];
16110
- for (let i = 0; i < cellRenders.length; i++) {
16111
- const cellRender = cellRenders[i];
16112
- this.markMergeRowRenderDirty(cellRender);
16113
- if (cellRender.rect.height > limitHeight) {
16114
- //限制的内框尺寸
16115
- const limitCellHeight = ElementUtil.innerRectMaxHeight(cellRender, limitHeight);
16116
- const cutCellRender = this.cutRenderItem(cellRender, limitCellHeight);
16117
- if (cutCellRender) {
16118
- cutCellRenders.push(cutCellRender);
16119
- }
16120
- else {
16121
- cutCellRenders.push(null);
16122
- }
16123
- }
16124
- else {
16125
- const cloneCellRender = cellRender;
16126
- render.removeChild(cellRender);
16127
- cutCellRenders.push(cloneCellRender);
16128
- }
16129
- }
16130
- ElementUtil.remeasure(render);
16131
- if (cutCellRenders.filter(item => item).length === 0) {
16132
- return null;
16133
- }
16134
- else {
16135
- //补齐单元格
16136
- for (let i = 0; i < cutCellRenders.length; i++) {
16137
- let cellRender = cutCellRenders[i];
16138
- if (!cellRender) {
16139
- cellRender = cellRenders[i].element.createRenderObject({
16140
- options: this.options,
16141
- renderCtx: this.renderContext
16142
- });
16143
- cellRender.rect = ElementUtil.cloneRect(cellRenders[i].rect);
16144
- ElementUtil.remeasure(cellRender);
16145
- }
16146
- cloneRowRender.addChild(cellRender);
16147
- }
16148
- ElementUtil.remeasure(cloneRowRender);
16149
- return cloneRowRender;
16150
- }
16151
- }
16152
- /**
16153
- * 标记合并单元格所在行需要重新计算
16154
- * @param cellRender
16155
- * @private
16156
- */
16157
- markMergeRowRenderDirty(cellRender) {
16158
- const cellEle = cellRender.element;
16159
- if (cellEle.props.vMerge !== 'restart') {
16160
- return;
16161
- }
16162
- const rowRender = cellRender.parent;
16163
- rowRender.element;
16164
- const tb = rowRender.parent;
16165
- const cellYPos = cellRender.rect.y;
16166
- for (let i = rowRender.getIndex() + 1; i < tb.length; i++) {
16167
- const nextRowRender = tb.getChild(i);
16168
- if (nextRowRender.rect.y <= cellYPos) {
16169
- nextRowRender.remeasureState = true;
16170
- nextRowRender.getItems().forEach(item => {
16171
- this.markMergeRowRenderDirty(item);
16172
- });
16173
- }
16174
- else {
16175
- break;
16176
- }
16177
- }
16178
- }
16179
- /**
16180
- * 修复->已经截断的合并单元格要向下移动到合适的位置
16181
- * @param tbRender
16182
- * @param cutRows
16183
- * @returns
16184
- */
16185
- fixCutTable(tbRender, cutRows) {
16186
- if (!cutRows.length) {
16187
- return;
16188
- }
16189
- const tbEle = tbRender.element;
16190
- const belowMergeRows = new Set();
16191
- for (let i = 0; i < tbRender.length; i++) {
16192
- const row = tbRender.getChild(i);
16193
- const nextRow = tbRender.getChild(i + 1);
16194
- if (!nextRow) {
16195
- break;
16196
- }
16197
- if (!cutRows.some(item => item === row)) {
16198
- break;
16199
- }
16200
- if (row.length === tbEle.getColsCount()) {
16201
- break;
16202
- }
16203
- if (this.checkFullRow(row)) {
16204
- break;
16205
- }
16206
- for (let j = 0; j < row.length; j++) {
16207
- const cell = row.getChild(j);
16208
- const cellEle = cell.element;
16209
- const colIndex = cellEle.getIndex();
16210
- if (!this.existsCellRender(nextRow, colIndex)) {
16211
- const insertColIndex = this.getRowInsertCellIndex(cell, nextRow);
16212
- if (insertColIndex === -1) {
16213
- this.getRowInsertCellIndex(cell, nextRow);
16214
- throw new Error('未在紧挨下方找到可以放置的位置');
16215
- }
16216
- //row.removeChild(cell);
16217
- nextRow.insertChild(cell, insertColIndex);
16218
- belowMergeRows.add(row);
16219
- ElementUtil.remeasure(nextRow);
16220
- }
15385
+ else {
15386
+ i++;
16221
15387
  }
16222
15388
  }
16223
- if (belowMergeRows.size) {
16224
- for (const row of belowMergeRows) {
16225
- tbRender.removeChild(row);
16226
- row.clear();
15389
+ else {
15390
+ if (i > 1 && this.containPostPunctuation(render.textMeasures[i]?.char)) {
15391
+ i--;
16227
15392
  }
16228
- ElementUtil.remeasure(tbRender);
16229
15393
  }
15394
+ return i;
16230
15395
  }
16231
15396
  /**
16232
- * 校验当前是否是一个完整的行,没有Null单元格,检查当前是否还需要向下合并
16233
- * @param row
15397
+ * 是否包含后置标点
15398
+ * @param str
15399
+ * @returns
16234
15400
  */
16235
- checkFullRow(row) {
16236
- let x = 0;
16237
- for (let i = 0; i < row.length; i++) {
16238
- const cell = row.getChild(i);
16239
- if (cell.rect.x !== x) {
16240
- return false;
16241
- }
16242
- x += cell.rect.width;
16243
- }
16244
- return x === row.rect.width;
15401
+ containPostPunctuation(str) {
15402
+ return '!),.:;?]}¨·ˇˉ―‖’”…∶、。〃々〉》」』】〕〗!"'),.:;?]`|}~¢'.indexOf(str) > -1;
16245
15403
  }
16246
- existsCellRender(rowRender, cellIndex) {
16247
- for (let i = 0; i < rowRender.length; i++) {
16248
- const cellRender = rowRender.getChild(i);
16249
- const cellEle = cellRender.element;
16250
- if (cellEle.getIndex() === cellIndex) {
16251
- return true;
15404
+ //是否包含前置标点
15405
+ containLeadingPunctuation(str) {
15406
+ return '‘“〈《「『【〔〖([{£'.indexOf(str) > -1;
15407
+ }
15408
+ /**
15409
+ * 文本开头是否包含后置标点
15410
+ * @param render
15411
+ * @returns
15412
+ */
15413
+ containerStartSymbolInTextStart(render) {
15414
+ //return false;
15415
+ if (render instanceof TextGroupRenderObject) {
15416
+ if (render.textMeasures.length > 0) {
15417
+ return this.containPostPunctuation(render.textMeasures[0].char);
16252
15418
  }
16253
15419
  }
16254
15420
  return false;
16255
15421
  }
16256
- getBlockLineHeight(render) {
16257
- if (render instanceof TableRowRenderObject) {
16258
- let maxCellHeight = 0;
16259
- for (let i = 0; i < render.length; i++) {
16260
- const itemHeight = render.getChild(i).rect.height;
16261
- if (itemHeight > maxCellHeight) {
16262
- maxCellHeight = itemHeight;
15422
+ cutFillNullRender(render, limitWidth) {
15423
+ if (limitWidth === 0) {
15424
+ return { firstItem: null, lastItem: null };
15425
+ }
15426
+ if (render.rect.width > limitWidth) {
15427
+ const cutRender = new FillNullSpaceRenderObject();
15428
+ cutRender.rect.width = limitWidth;
15429
+ cutRender.rect.height = render.rect.height;
15430
+ render.rect.width = render.rect.width - limitWidth;
15431
+ return { firstItem: cutRender, lastItem: render };
15432
+ }
15433
+ else {
15434
+ return { firstItem: render, lastItem: null };
15435
+ }
15436
+ }
15437
+ /**
15438
+ * 行内编组元素超出行内可用空间,需要根据剩余空间长度进行截断
15439
+ */
15440
+ cutInlineGroupRenderItem(render, limitWidth, emptyLine, inCloseBody) {
15441
+ const cutRender = render.element.createRenderObject({ options: this.options, renderCtx: this.renderCtx });
15442
+ let x = 0;
15443
+ let br = false;
15444
+ const items = [...render.getItems()];
15445
+ for (let i = 0; i < items.length; i++) {
15446
+ const child = items[i];
15447
+ if (child instanceof LeafRenderObject) {
15448
+ if (x + child.rect.width > limitWidth) {
15449
+ const { firstItem, lastItem, br: childBr } = this.cutRenderItem(child, items[i + 1], limitWidth - x, emptyLine && cutRender.length === 0, inCloseBody);
15450
+ if (firstItem) {
15451
+ cutRender.addChild(firstItem);
15452
+ }
15453
+ br = childBr || br;
15454
+ break;
15455
+ }
15456
+ else {
15457
+ render.removeChild(child);
15458
+ cutRender.addChild(child);
15459
+ }
15460
+ //软换行符
15461
+ if (child.element && child.element.type === 'br') {
15462
+ br = true;
15463
+ break;
16263
15464
  }
16264
15465
  }
16265
- return maxCellHeight;
15466
+ else if (child instanceof InlineGroupRenderObject) {
15467
+ if (x + child.rect.width > limitWidth) {
15468
+ const { firstItem, br: childBr } = this.cutInlineGroupRenderItem(child, limitWidth - x, emptyLine && cutRender.length === 0, inCloseBody);
15469
+ if (firstItem) {
15470
+ cutRender.addChild(firstItem);
15471
+ }
15472
+ br = childBr || br;
15473
+ break;
15474
+ }
15475
+ else {
15476
+ render.removeChild(child);
15477
+ cutRender.addChild(child);
15478
+ }
15479
+ }
15480
+ x += child.rect.width;
16266
15481
  }
16267
- return render.rect.height;
15482
+ if (!cutRender.length) {
15483
+ return { firstItem: null, lastItem: null };
15484
+ }
15485
+ ElementUtil.remeasureInlineGroupRender(cutRender);
15486
+ ElementUtil.remeasureInlineGroupRender(render);
15487
+ return { firstItem: cutRender, lastItem: render.length ? render : null, br };
16268
15488
  }
16269
- getRowInsertCellIndex(sourceCell, destRow) {
16270
- for (let i = 0; i < destRow.length; i++) {
16271
- const cell = destRow.getChild(i);
16272
- const rect = cell.rect;
16273
- if (sourceCell.rect.x < rect.x) {
16274
- return i;
15489
+ /**
15490
+ * 修改测量完毕后的元素状态
15491
+ * @param ele
15492
+ */
15493
+ setMeasureCompletedModifyFlag(ele) {
15494
+ if (ele instanceof BranchElement) {
15495
+ for (let i = 0; i < ele.length; i++) {
15496
+ this.setMeasureCompletedModifyFlag(ele.getChild(i));
16275
15497
  }
16276
15498
  }
16277
- const lastCell = destRow.getChild(destRow.length - 1);
16278
- if (sourceCell.rect.x >= lastCell.rect.x + lastCell.rect.width) {
16279
- return destRow.length;
16280
- }
16281
- return -1;
15499
+ ele.modifyFlag = ModifyFlag$1.None;
16282
15500
  }
16283
- getHeaderRows(tb) {
16284
- const rows = [];
16285
- for (let i = 0; i < tb.length; i++) {
16286
- const rowRender = tb.getChild(i);
16287
- const rowEle = rowRender.element;
16288
- if (rowEle.props.headerRow) {
16289
- rows.push(rowRender);
15501
+ clearPaintCache(ele, data) {
15502
+ ele.beginMeasure(data);
15503
+ if (ele instanceof BranchElement) {
15504
+ for (let i = 0; i < ele.length; i++) {
15505
+ this.clearPaintCache(ele.getChild(i), data);
16290
15506
  }
16291
- else {
16292
- break;
15507
+ }
15508
+ }
15509
+ endMeasures(ele) {
15510
+ if (ele instanceof BranchElement) {
15511
+ for (let i = 0; i < ele.length; i++) {
15512
+ this.endMeasures(ele.getChild(i));
16293
15513
  }
16294
15514
  }
16295
- return rows;
16296
15515
  }
16297
15516
  }
16298
15517
 
16299
15518
  class DocumentPaint {
16300
15519
  renderContext;
16301
15520
  docCtx;
16302
- selectedSets;
15521
+ seo;
16303
15522
  elementMeasure;
16304
- elementRenderCut;
15523
+ //elementRenderCut: ElementRenderCut;
16305
15524
  elementPaint;
16306
15525
  docPages;
16307
15526
  docContainer;
16308
15527
  //commsContainer!: CommsContainerRenderObject;
16309
15528
  viewOptions;
16310
- constructor(renderContext, docCtx, selectedSets) {
15529
+ constructor(renderContext, docCtx, seo) {
16311
15530
  this.renderContext = renderContext;
16312
15531
  this.docCtx = docCtx;
16313
- this.selectedSets = selectedSets;
15532
+ this.seo = seo;
16314
15533
  this.viewOptions = this.docCtx.viewOptions;
16315
15534
  this.elementMeasure = new ElementMeasure(this.docCtx, this.renderContext);
16316
- this.elementRenderCut = new ElementRenderCut(this.viewOptions, this.renderContext);
15535
+ //this.elementRenderCut = new ElementRenderCut(this.viewOptions, this.renderContext);
16317
15536
  this.elementPaint = new ElementPaint(this.renderContext, this.docCtx);
16318
15537
  }
16319
15538
  rePages() {
@@ -16332,7 +15551,7 @@ class DocumentPaint {
16332
15551
  // //console.timeEnd('排版计时');
16333
15552
  // //console.time('断页计时');
16334
15553
  // const docPages = this.elementRenderCut.cutPage(documentRender, this.docCtx.document);
16335
- const newMeasure = new DocumentArrange(this.docCtx, this.renderContext);
15554
+ const newMeasure = new DocumentArrange(this.docCtx, this.renderContext, this.seo);
16336
15555
  const docPages = newMeasure.measureDoc();
16337
15556
  // this.commsContainer = newMeasure.commentsRender as CommsContainerRenderObject;
16338
15557
  // if (this.commsContainer) {
@@ -16429,7 +15648,7 @@ class DocumentPaint {
16429
15648
  }
16430
15649
  }
16431
15650
  refreshView() {
16432
- this.elementPaint.drawPages(this.docContainer, this.selectedSets);
15651
+ this.elementPaint.drawPages(this.docContainer, this.seo.selectionEleSets);
16433
15652
  }
16434
15653
  getDocPages() {
16435
15654
  return this.docPages;
@@ -16444,31 +15663,31 @@ class DocumentPaint {
16444
15663
  if (!this.viewOptions.showReviewWindow) {
16445
15664
  return;
16446
15665
  }
16447
- const cce = this.docCtx.document.commentsContainerElement;
16448
- const set = new Map();
16449
- const commentRangeStatus = [];
16450
- for (let i = 0; i < cce.length; i++) {
16451
- const commContent = cce.getChild(i);
16452
- const commMarkPair = cce.markPairs.find(item => item.id === commContent.props.id);
16453
- if (commMarkPair) {
16454
- if (commMarkPair.start) {
16455
- commContent.startMark = commMarkPair.start;
16456
- }
16457
- if (commMarkPair.end) {
16458
- commContent.endMark = commMarkPair.end;
16459
- }
16460
- }
16461
- const { startMark, endMark, props: { id }, focus } = commContent;
16462
- const ancestorCommonControl = DocumentSelection.getAncestorCommonControl(startMark, endMark);
16463
- const commonRange = RangeUtil.getSelctionRange(startMark, 0, endMark, 1, ancestorCommonControl);
16464
- SelectionOverlays.addToCommentSets(commonRange, set);
16465
- commentRangeStatus.push({
16466
- commContent,
16467
- range: commonRange
16468
- });
16469
- }
16470
- cce.cacheRender.selectedSet = set;
16471
- cce.cacheRender.commentRangeStatus = commentRangeStatus;
15666
+ // const cce = this.docCtx.document.commentsContainerElement;
15667
+ // const set = new Map<Element, SelectionContentRange>();
15668
+ // const commentRangeStatus: Array<CommentRangeStatus> = [];
15669
+ // for (let i = 0; i < cce.length; i++) {
15670
+ // const commContent = cce.getChild(i) as CommContentElement;
15671
+ // const commMarkPair = cce.markPairs.find(item => item.id === commContent.props.id);
15672
+ // if (commMarkPair) {
15673
+ // if (commMarkPair.start) {
15674
+ // commContent.startMark = commMarkPair.start;
15675
+ // }
15676
+ // if (commMarkPair.end) {
15677
+ // commContent.endMark = commMarkPair.end;
15678
+ // }
15679
+ // }
15680
+ // const {startMark, endMark, props: {id}, focus} = commContent;
15681
+ // const ancestorCommonControl = DocumentSelection.getAncestorCommonControl(startMark, endMark);
15682
+ // const commonRange = RangeUtil.getSectionRange(startMark, 0, endMark, 1, ancestorCommonControl);
15683
+ // SelectionOverlays.addToCommentSets(commonRange, set);
15684
+ // commentRangeStatus.push({
15685
+ // commContent,
15686
+ // range: commonRange
15687
+ // })
15688
+ // }
15689
+ // (<CommsContainerRenderObject>cce.cacheRender).selectedSet = set;
15690
+ // (<CommsContainerRenderObject>cce.cacheRender).commentRangeStatus = commentRangeStatus;
16472
15691
  }
16473
15692
  }
16474
15693
 
@@ -16507,8 +15726,6 @@ class PermanentTeethElement extends LeafElement {
16507
15726
  }
16508
15727
  }
16509
15728
  class PermanentTeethRenderObject extends LeafRenderObject {
16510
- render(e) {
16511
- }
16512
15729
  clone() {
16513
15730
  const clone = new PermanentTeethRenderObject(this.element);
16514
15731
  clone.rect = ElementUtil.cloneRect(this.rect);
@@ -16640,6 +15857,7 @@ class ElementReader {
16640
15857
  this.addFactory(PageBreakFactory);
16641
15858
  this.addFactory(TabFactory);
16642
15859
  this.addFactory(PermanentTeethFactory);
15860
+ this.addFactory(SVGFactory);
16643
15861
  // this.registerReadFunc<TrackRunProps>('ins-run', (data) => {
16644
15862
  // const props = new TrackRunProps(data.type);
16645
15863
  // props.userId = data.userId;
@@ -16668,15 +15886,15 @@ class ElementReader {
16668
15886
  document.bodyElement = document.find((item) => item instanceof DocumentBodyElement);
16669
15887
  document.headerElement = document.find((item) => item instanceof DocumentHeaderElement);
16670
15888
  document.footerElement = document.find((item) => item instanceof DocumentFooterElement);
16671
- document.commentsContainerElement = document.find((item) => item instanceof CommsContainerElement);
16672
- if (!document.commentsContainerElement) {
16673
- document.commentsContainerElement = new CommsContainerElement();
16674
- }
15889
+ // document.commentsContainerElement = document.find((item) => item instanceof CommsContainerElement) as CommsContainerElement;
15890
+ // if (!document.commentsContainerElement) {
15891
+ // document.commentsContainerElement = new CommsContainerElement();
15892
+ // }
16675
15893
  document.clearItems();
16676
15894
  document.addChild(document.headerElement);
16677
15895
  document.addChild(document.bodyElement);
16678
15896
  document.addChild(document.footerElement);
16679
- document.addChild(document.commentsContainerElement);
15897
+ //document.addChild(document.commentsContainerElement);
16680
15898
  this.docCtx.document = document;
16681
15899
  document.viewOptions = this.docCtx.viewOptions;
16682
15900
  const width = Math.floor(document.props.width * this.docCtx.viewOptions.mmToPixelsRatio);
@@ -16684,7 +15902,7 @@ class ElementReader {
16684
15902
  this.docCtx.viewOptions.docPageSettings = new PageOptions(width, height, document.props.orient);
16685
15903
  //this.viewOptions.viewSettings.width = this.viewOptions.docPageSettings.width + 10;
16686
15904
  }
16687
- readElement(data) {
15905
+ readElement(data, strictMode = false) {
16688
15906
  if (typeof data === 'string') {
16689
15907
  data = JSON.parse(data);
16690
15908
  }
@@ -16699,19 +15917,27 @@ class ElementReader {
16699
15917
  const children = data.children || [];
16700
15918
  for (const child of children) {
16701
15919
  //element.addChild(this.readElement(child));
16702
- childArr.push(this.readElement(child));
15920
+ const childEle = this.readElement(child);
15921
+ childEle && childArr.push(childEle);
16703
15922
  }
16704
15923
  }
16705
15924
  factory.readCompleted(element, childArr);
16706
15925
  return element;
16707
15926
  }
16708
15927
  }
16709
- throw new Error('未知的元素类型:' + type);
15928
+ if (strictMode) {
15929
+ throw new Error('未知的元素类型:' + type, data);
15930
+ }
15931
+ else {
15932
+ console.error('未知的元素类型:' + type, data);
15933
+ return null;
15934
+ }
16710
15935
  }
16711
- // propsReadFuncs: Map<string, (data: any) => any> = new Map();
16712
- // registerReadFunc<T>(propName: string, func: (data: T) => T): void {
16713
- // this.propsReadFuncs.set(propName, func);
16714
- // }
15936
+ /**
15937
+ * 读取扩展属性
15938
+ * @param data
15939
+ * @param element
15940
+ */
16715
15941
  readExtendsProps(data, element) {
16716
15942
  if (!data.props) {
16717
15943
  return;
@@ -17772,7 +16998,10 @@ class DocumentEvent {
17772
16998
  if (renderObject instanceof LeafRenderObject) {
17773
16999
  if (CommonUtil.isInsideRectByPosition(renderObjectRect, hitPos)) {
17774
17000
  const x = hitPos.x - renderObjectRect.x;
17775
- const offset = ElementUtil.getHitRenderOffset(renderObject, x);
17001
+ let offset = ElementUtil.getHitRenderOffset(renderObject, x);
17002
+ if (!this.ismousedown && renderObject.element && renderObject.element.type === 'psym') {
17003
+ offset = 0;
17004
+ }
17776
17005
  return {
17777
17006
  render: renderObject,
17778
17007
  offset,
@@ -17864,7 +17093,10 @@ class DocumentEvent {
17864
17093
  else {
17865
17094
  x = position.x - adjacentRender.rect.x;
17866
17095
  }
17867
- const offset = ElementUtil.getHitRenderOffset(adjacentRender.render, x);
17096
+ let offset = ElementUtil.getHitRenderOffset(adjacentRender.render, x);
17097
+ if (!this.ismousedown && renderObject.element && renderObject.element.type === 'psym') {
17098
+ offset = 0;
17099
+ }
17868
17100
  return {
17869
17101
  render: adjacentRender.render,
17870
17102
  absoluteRenderRect: adjacentRender.rect,
@@ -17954,6 +17186,7 @@ class DocumentEvent {
17954
17186
  startHitInfo: this.startHitInfo,
17955
17187
  endHitInfo: this.endHitInfo
17956
17188
  });
17189
+ console.log(this.endHitInfo);
17957
17190
  }
17958
17191
  /**
17959
17192
  * 获取鼠标所在的渲染元素对象
@@ -19559,7 +18792,7 @@ class DocumentChange {
19559
18792
  return paragraph;
19560
18793
  }
19561
18794
  const last = ElementUtil.getLastLeafElement(paragraph);
19562
- const selectedParaRange = RangeUtil.getSelctionRange(startControl, startOffset, last, 1, paragraph);
18795
+ const selectedParaRange = RangeUtil.getSectionRange(startControl, startOffset, last, 1, paragraph);
19563
18796
  selectedParaRange.isFullSelected = false;
19564
18797
  const breakPara = ElementUtil.cloneRange(selectedParaRange, true);
19565
18798
  ElementUtil.fixParagraphContent(paragraph);
@@ -20181,22 +19414,26 @@ class DocumentChange {
20181
19414
  const id = nanoid(5);
20182
19415
  const startCommMark = new CommentElement();
20183
19416
  startCommMark.props.id = id;
19417
+ startCommMark.props.userId = this.viewOptions.editUser.id;
19418
+ startCommMark.props.userName = this.viewOptions.editUser.name;
19419
+ startCommMark.props.date = CommonUtil.formatNow('YYYY-MM-DD HH:mm:ss');
20184
19420
  startCommMark.props.markType = 'start';
20185
19421
  const endCommMark = new CommentElement();
20186
19422
  endCommMark.props.id = id;
20187
19423
  endCommMark.props.markType = 'end';
20188
19424
  this.insertElement(endControl, endOffset, [endCommMark]);
20189
19425
  this.insertElement(startControl, startOffset, [startCommMark]);
20190
- const commContent = new CommContentElement();
20191
- commContent.props.id = id;
20192
- commContent.props.createId = this.viewOptions.editUser.id;
20193
- commContent.props.createName = this.viewOptions.editUser.name;
20194
- commContent.props.createDate = new Date();
20195
- const pos = this.docComment.getCommMarkIndex(startCommMark);
20196
- if (pos < 0) {
20197
- throw new Error('获取插入的批注位置不正确');
20198
- }
20199
- this.docCtx.document.commentsContainerElement.addChild(commContent, pos);
19426
+ startCommMark.props.text = '插入测试批注信息' + new Date();
19427
+ // const commContent = new CommContentElement();
19428
+ // commContent.props.id = id;
19429
+ // commContent.props.createId = this.viewOptions.editUser.id;
19430
+ // commContent.props.createName = this.viewOptions.editUser.name;
19431
+ // commContent.props.createDate = new Date();
19432
+ // const pos = this.docComment.getCommMarkIndex(startCommMark);
19433
+ // if (pos < 0) {
19434
+ // throw new Error('获取插入的批注位置不正确');
19435
+ // }
19436
+ // this.docCtx.document.commentsContainerElement.addChild(commContent, pos);
20200
19437
  this.selectionState.clear();
20201
19438
  }
20202
19439
  validate() {
@@ -20220,8 +19457,8 @@ class DocumentChange {
20220
19457
  validateElement.props.title = caption + '验证';
20221
19458
  validateElement.props.id = id;
20222
19459
  validateElement.setContent(item.error);
20223
- const pos = this.docComment.getCommMarkIndex(startCommMark);
20224
- this.docCtx.document.commentsContainerElement.addChild(validateElement, pos);
19460
+ this.docComment.getCommMarkIndex(startCommMark);
19461
+ //this.docCtx.document.commentsContainerElement.addChild(validateElement, pos);
20225
19462
  });
20226
19463
  this.docCtx.selectionState.clear();
20227
19464
  return false;
@@ -20647,7 +19884,6 @@ class DocumentComment {
20647
19884
  // }
20648
19885
  // this.commMarkList = commList;
20649
19886
  // this.commContentList = commContentList;
20650
- this.docCtx.viewOptions.showReviewWindow = this.docCtx.document.commentsContainerElement.markPairs.length > 0;
20651
19887
  this.isDirty = false;
20652
19888
  }
20653
19889
  /**
@@ -20683,28 +19919,46 @@ class DocumentComment {
20683
19919
  if (!endRange) {
20684
19920
  return;
20685
19921
  }
20686
- const commPairs = [];
20687
- const markPairs = this.docCtx.document.commentsContainerElement.markPairs;
20688
- for (let i = 0; i < markPairs.length; i++) {
20689
- const { start: startMark, end: endMark } = markPairs[i];
20690
- if (!startMark || !endMark) {
20691
- continue;
20692
- }
20693
- const commPair = {
20694
- startMark,
20695
- endMark,
20696
- startMarkStatus: RangeUtil.checkElementFullInRange(selectedRange, startMark),
20697
- endMarkStatus: RangeUtil.checkElementFullInRange(selectedRange, endMark),
20698
- };
20699
- commPairs.push(commPair);
20700
- }
20701
- for (let i = 0; i < commPairs.length; i++) {
20702
- const commPair = commPairs[i];
20703
- if (commPair.endMarkStatus) {
20704
- this.removeComment(commPair.endMark.props.id);
19922
+ const selectedComms = [];
19923
+ RangeUtil.recursionTraversalRangeHandler(selectedRange, (range) => {
19924
+ if (range.target instanceof CommentElement && range.isFullSelected) {
19925
+ selectedComms.push(range.target);
20705
19926
  }
20706
- else if (commPair.startMarkStatus) ;
19927
+ });
19928
+ if (selectedComms.length > 0) {
19929
+ const ids = selectedComms.map(item => item.props.id);
19930
+ const commList = this.docCtx.document.treeFilter(item => item.type === 'comm' && ids.indexOf(item.props.id) >= 0);
19931
+ commList.forEach(item => item.remove());
19932
+ return;
20707
19933
  }
19934
+ return;
19935
+ // const commPairs: Array<CommMarkSelectedStatus> = [];
19936
+ // const markPairs = this.docCtx.document.commentsContainerElement.markPairs;
19937
+ // for (let i = 0; i < markPairs.length; i++) {
19938
+ // const {start: startMark, end: endMark} = markPairs[i];
19939
+ // if (!startMark || !endMark) {
19940
+ // continue;
19941
+ // }
19942
+ // const commPair: CommMarkSelectedStatus = {
19943
+ // startMark,
19944
+ // endMark,
19945
+ // startMarkStatus: RangeUtil.checkElementFullInRange(selectedRange, startMark),
19946
+ // endMarkStatus: RangeUtil.checkElementFullInRange(selectedRange, endMark),
19947
+ // };
19948
+ // commPairs.push(commPair)
19949
+ // }
19950
+ //
19951
+ // for (let i = 0; i < commPairs.length; i++) {
19952
+ // const commPair = commPairs[i];
19953
+ // if (commPair.endMarkStatus) {
19954
+ // this.removeComment(commPair.endMark.props.id);
19955
+ // } else if (commPair.startMarkStatus) {
19956
+ // // const newStartMark = new CommentElement();
19957
+ // // newStartMark.props.id = commPair.startMark.props.id;
19958
+ // // commPair.startMark.isDecorate = false;
19959
+ // // DocumentChange.insertElement(endRange.target, endRange.endOffset, [newStartMark]);
19960
+ // }
19961
+ // }
20708
19962
  }
20709
19963
  }
20710
19964
  /**
@@ -20712,7 +19966,7 @@ class DocumentComment {
20712
19966
  * @param id
20713
19967
  */
20714
19968
  removeComment(id) {
20715
- this.docCtx.document.commentsContainerElement.removeCommMark(id);
19969
+ this.docCtx.document.removeCommMark(id);
20716
19970
  }
20717
19971
  getCommMarkIndex(commMark) {
20718
19972
  const markType = commMark.props.markType;
@@ -20724,7 +19978,7 @@ class DocumentComment {
20724
19978
  * 清除所有批注
20725
19979
  */
20726
19980
  clearAllComments() {
20727
- this.docCtx.document.commentsContainerElement.clearAllComms();
19981
+ this.docCtx.document.clearAllComms();
20728
19982
  this.docCtx.selectionState.clear();
20729
19983
  }
20730
19984
  /**
@@ -21150,15 +20404,15 @@ class ElementTrackManage {
21150
20404
 
21151
20405
  class DocumentSvg {
21152
20406
  viewOptions;
21153
- selectedSets;
20407
+ sso;
21154
20408
  renderCtx;
21155
20409
  highlights = [];
21156
20410
  mode = "view";
21157
20411
  //当前页位置
21158
20412
  pagePos;
21159
- constructor(viewOptions, selectedSets, renderCtx) {
20413
+ constructor(viewOptions, sso, renderCtx) {
21160
20414
  this.viewOptions = viewOptions;
21161
- this.selectedSets = selectedSets;
20415
+ this.sso = sso;
21162
20416
  this.renderCtx = renderCtx;
21163
20417
  }
21164
20418
  getVNode(render, selectionRects, parentPos) {
@@ -21168,22 +20422,8 @@ class DocumentSvg {
21168
20422
  width: render.rect.width,
21169
20423
  height: render.rect.height
21170
20424
  };
21171
- if (this.selectedSets.has(render.element)) {
21172
- const range = this.selectedSets.get(render.element);
21173
- if (render.element && render instanceof LeafRenderObject) {
21174
- if (range.isFullSelected) {
21175
- selectionRects.push(currPos);
21176
- }
21177
- else {
21178
- if (render.element instanceof TextGroupElement && range.endOffset > range.startOffset) {
21179
- const { startX, endX } = ElementUtil.getTextRenderHorX(render, range.startOffset, range.endOffset);
21180
- const width = endX - startX;
21181
- const x = currPos.x + startX;
21182
- selectionRects.push({ x, y: currPos.y, width, height: currPos.height });
21183
- }
21184
- }
21185
- }
21186
- }
20425
+ //处理选区遮罩
20426
+ this.createSelectionRect(render, selectionRects, currPos);
21187
20427
  //审阅窗口重新计算位置
21188
20428
  if (this.viewOptions.showReviewWindow && render instanceof CommsContainerRenderObject) {
21189
20429
  CommentsUtil.arrangeComments(render);
@@ -21247,12 +20487,18 @@ class DocumentSvg {
21247
20487
  if (selectionRectsTemp.length > 0) {
21248
20488
  const startX = selectionRectsTemp[0].x;
21249
20489
  const endX = selectionRectsTemp[selectionRectsTemp.length - 1].x + selectionRectsTemp[selectionRectsTemp.length - 1].width;
21250
- selectionRects.push({ x: startX, y: currPos.y, width: endX - startX, height: currPos.height });
20490
+ selectionRects.push({
20491
+ x: startX,
20492
+ y: currPos.y,
20493
+ width: endX - startX,
20494
+ height: currPos.height,
20495
+ color: selectionRectsTemp[0].color
20496
+ });
21251
20497
  selectionRectsTemp.length = 0;
21252
20498
  }
21253
20499
  }
21254
20500
  else if (render instanceof TableCellRenderObject) {
21255
- if (this.selectedSets.has(render.element) && this.selectedSets.get(render.element)?.isFullSelected) {
20501
+ if (this.sso.selectionEleSets.has(render.element) && this.sso.selectionEleSets.get(render.element)?.isFullSelected) {
21256
20502
  selectionRects.push(currPos);
21257
20503
  selectionRectsTemp.length = 0;
21258
20504
  }
@@ -21294,11 +20540,39 @@ class DocumentSvg {
21294
20540
  }
21295
20541
  return currVNode;
21296
20542
  }
20543
+ createSelectionRect(render, selectionRects, currPos) {
20544
+ const items = [this.sso.selectionEleSets, this.sso.commRangeSets];
20545
+ for (const item of items) {
20546
+ if (item.has(render.element)) {
20547
+ const range = item.get(render.element);
20548
+ if (render.element && render instanceof LeafRenderObject) {
20549
+ if (range.isFullSelected) {
20550
+ selectionRects.push({ ...currPos, color: range['rangeColor'] });
20551
+ }
20552
+ else {
20553
+ if (render.element instanceof TextGroupElement && range.endOffset > range.startOffset) {
20554
+ const { startX, endX } = ElementUtil.getTextRenderHorX(render, range.startOffset, range.endOffset);
20555
+ const width = endX - startX;
20556
+ const x = currPos.x + startX;
20557
+ // @ts-ignore
20558
+ selectionRects.push({
20559
+ x,
20560
+ y: currPos.y,
20561
+ width,
20562
+ height: currPos.height,
20563
+ color: range['rangeColor']
20564
+ });
20565
+ }
20566
+ }
20567
+ }
20568
+ }
20569
+ }
20570
+ }
21297
20571
  getHTMLVNode(docRenders) {
21298
20572
  this.counterMap = {};
21299
- const pageNodes = docRenders.filter(item => this.checkInViewBox(item)).map(item => {
20573
+ return docRenders.filter(item => this.checkInViewBox(item)).map(item => {
21300
20574
  const pageSvg = this.getPageSvgVNode(item);
21301
- const pageUnit = {
20575
+ return {
21302
20576
  sel: 'div.page-unit',
21303
20577
  data: {
21304
20578
  style: {
@@ -21313,9 +20587,7 @@ class DocumentSvg {
21313
20587
  },
21314
20588
  children: [pageSvg]
21315
20589
  };
21316
- return pageUnit;
21317
20590
  });
21318
- return pageNodes;
21319
20591
  }
21320
20592
  /**
21321
20593
  * 判断当前元素是否在视窗内
@@ -21353,7 +20625,7 @@ class DocumentSvg {
21353
20625
  ns: 'http://www.w3.org/2000/svg',
21354
20626
  attrs: {
21355
20627
  stroke: 'none',
21356
- fill: 'rgb(85,165,255)',
20628
+ fill: item.color ?? 'rgb(85,165,255)',
21357
20629
  'paint-order': 'stroke fill markers',
21358
20630
  d: `M${item.x} ${item.y} L${item.x + item.width} ${item.y} L${item.x + item.width} ${item.y + item.height} L${item.x} ${item.y + item.height} Z`,
21359
20631
  'fill-opacity': '0.5'
@@ -26363,7 +25635,10 @@ class DocumentPrintOffscreenBase {
26363
25635
  const ss = new SelectionState();
26364
25636
  this.docCtx = new EditorContext(ss, this.viewOptions);
26365
25637
  this.renderCtx = this.createRenderCtx(ctx, this.viewOptions, this.docCtx);
26366
- this.documentPaint = new DocumentPaint(this.renderCtx, this.docCtx, new Map());
25638
+ this.documentPaint = new DocumentPaint(this.renderCtx, this.docCtx, {
25639
+ selectionEleSets: new Map(),
25640
+ commRangeSets: new Map()
25641
+ });
26367
25642
  this.elementReader = new ElementReader(this.docCtx);
26368
25643
  this.docCtx.syncRefresh = () => {
26369
25644
  };
@@ -26378,8 +25653,8 @@ class DocumentPrintOffscreenBase {
26378
25653
  // const docProps = this.docCtx.document.props;
26379
25654
  // printNodes(canvasNodes, {...docProps});
26380
25655
  // }
26381
- async print(data, ranges = null) {
26382
- await this.prepare(data);
25656
+ print(data, ranges = null) {
25657
+ this.prepare(data);
26383
25658
  const canvasNodes = this.getSvgNodes(this.documentPaint.docPages, ranges);
26384
25659
  if (!canvasNodes.length) {
26385
25660
  console.warn('无可打印页');
@@ -26394,7 +25669,7 @@ class DocumentPrintOffscreenBase {
26394
25669
  /**
26395
25670
  * 续打
26396
25671
  */
26397
- async printForContinuation(data, options) {
25672
+ printForContinuation(data, options) {
26398
25673
  this.afterRenderEvent.subscribe((event) => {
26399
25674
  const { index, renderCtx, docRender, pageSvgVNode } = event;
26400
25675
  if (index === options.startDocIndex && options.startY !== 0) {
@@ -26408,7 +25683,7 @@ class DocumentPrintOffscreenBase {
26408
25683
  pageSvgVNode.data.attrs['clip-path'] = `url(#${'page-clip-' + index})`;
26409
25684
  }
26410
25685
  });
26411
- await this.prepare(data);
25686
+ this.prepare(data);
26412
25687
  const printRanges = new Array(this.documentPaint.docPages.length).fill(0).map((item, index) => index).filter(index => index >= options.startDocIndex);
26413
25688
  let svgNodes = this.getSvgNodes(this.documentPaint.docPages, printRanges);
26414
25689
  if (!svgNodes.length) {
@@ -26433,8 +25708,8 @@ class DocumentPrintOffscreenBase {
26433
25708
  // }
26434
25709
  // return canvasNodes.map(node => node.toDataURL());
26435
25710
  // }
26436
- async getPrintNodes(data, ranges = null) {
26437
- await this.prepare(data);
25711
+ getPrintNodes(data, ranges = null) {
25712
+ this.prepare(data);
26438
25713
  const canvasNodes = this.getSvgNodes(this.documentPaint.docPages, ranges);
26439
25714
  return canvasNodes;
26440
25715
  }
@@ -26445,11 +25720,11 @@ class DocumentPrintOffscreenBase {
26445
25720
  * 读取数据,排版
26446
25721
  * @param data
26447
25722
  */
26448
- async prepare(data) {
25723
+ prepare(data) {
26449
25724
  //将doc的json格式数据读取转化为DocumentElement的树
26450
25725
  this.elementReader.read(data);
26451
25726
  this.documentPaint.rePages();
26452
- await Promise.all(this.docCtx.imageLoader.getLoadTasks());
25727
+ //await Promise.all(this.docCtx.imageLoader.getLoadTasks());
26453
25728
  const { scale, docPageSettings: { width, height } } = this.viewOptions;
26454
25729
  this.renderCtx.update({ scale, width, height });
26455
25730
  ElementUtil.setCanvasProps(this.renderCtx.mainContext.ctx.canvas, this.renderCtx.mainContext.ctx, {
@@ -26484,7 +25759,10 @@ class DocumentPrintOffscreenBase {
26484
25759
  // return canvasList;
26485
25760
  // }
26486
25761
  getSvgNodes(docRenders, printRanges = null) {
26487
- const docSvgHelper = new DocumentSvg(this.viewOptions, new Map(), this.renderCtx); //.getHTMLVNode(docRenders) as Array<EditorVNodeObject>;
25762
+ const docSvgHelper = new DocumentSvg(this.viewOptions, {
25763
+ selectionEleSets: new Map,
25764
+ commRangeSets: new Map()
25765
+ }, this.renderCtx); //.getHTMLVNode(docRenders) as Array<EditorVNodeObject>;
26488
25766
  docSvgHelper.mode = 'print';
26489
25767
  const patch = init([
26490
25768
  modules.class,
@@ -26528,31 +25806,6 @@ class DocumentPrintOffscreen extends DocumentPrintOffscreenBase {
26528
25806
  }
26529
25807
  }
26530
25808
 
26531
- let activeEditorContext = null;
26532
- function setActiveEditorContext(ctx) {
26533
- activeEditorContext = ctx;
26534
- }
26535
- function createSignal(state) {
26536
- let _state = state;
26537
- const activeCtx = activeEditorContext;
26538
- const signal = {
26539
- get value() {
26540
- return _state;
26541
- },
26542
- set value(v) {
26543
- if (v === _state) {
26544
- return;
26545
- }
26546
- _state = v;
26547
- signal.onChange();
26548
- },
26549
- onChange: () => {
26550
- activeCtx?.onChange();
26551
- }
26552
- };
26553
- return signal;
26554
- }
26555
-
26556
25809
  /**
26557
25810
  * 渲染日历虚拟节点处理类
26558
25811
  */
@@ -27421,6 +26674,8 @@ class DocEditor {
27421
26674
  onDestroy = new Subject$1();
27422
26675
  beforeNodePatch = new Subject$1();
27423
26676
  afterNodePatch = new Subject$1();
26677
+ //自定义事件传递消息
26678
+ eventBus;
27424
26679
  editInput;
27425
26680
  scrollContainer;
27426
26681
  constructor(svgContainer) {
@@ -27451,13 +26706,14 @@ class DocEditor {
27451
26706
  this.renderContext.init({ width: 500, height: 500, scale: 1 });
27452
26707
  this.selectionState = this.documentSelection.selectionState;
27453
26708
  this.selectionOverlays = new SelectionOverlays(this.documentSelection.selectionState);
27454
- this.documentPaint = new DocumentPaint(this.renderContext, this.docCtx, this.selectionOverlays.selectedSets);
26709
+ this.documentPaint = new DocumentPaint(this.renderContext, this.docCtx, this.selectionOverlays);
27455
26710
  this.documentInput = new DocumentInput(this.docCtx);
27456
26711
  this.docComment = new DocumentComment(this.docCtx);
27457
26712
  this.elementReader = new ElementReader(this.docCtx);
27458
26713
  this.documentChange = new DocumentChange(this.elementReader, this.docCtx, this.docComment, this.documentInput);
27459
26714
  this.documentEvent = new DocumentEvent(this.documentPaint, this.docCtx, this.documentInput);
27460
26715
  this.historyMange = new ElementTrackManage(this.docCtx, this.elementReader);
26716
+ this.eventBus = new EventBus();
27461
26717
  this.createPatch();
27462
26718
  this.documentEvent.hitInfoChanged.subscribe((hitInfo) => {
27463
26719
  this.hitInfoChanged(hitInfo);
@@ -28042,6 +27298,7 @@ class DocEditor {
28042
27298
  this.docCtx.destroy();
28043
27299
  this.documentEvent.clearSubEvent();
28044
27300
  this.selectionState.destroy();
27301
+ this.eventBus.clear();
28045
27302
  this.destroyDOM();
28046
27303
  this.flushTask = null;
28047
27304
  Object.keys(this).forEach(key => {
@@ -28555,7 +27812,7 @@ class DocEditor {
28555
27812
  this.tipContainer = tipsContainer;
28556
27813
  docContent.data.style.height = this.documentPaint.getDocumentContainerHeight().height + 'px';
28557
27814
  const docRenders = this.documentPaint.docContainer.getItems();
28558
- const svgGenerator = new DocumentSvg(this.viewOptions, this.selectionOverlays.selectedSets, this.renderContext);
27815
+ const svgGenerator = new DocumentSvg(this.viewOptions, this.selectionOverlays, this.renderContext);
28559
27816
  const vNode = svgGenerator.getHTMLVNode(docRenders);
28560
27817
  const children = docContent.children;
28561
27818
  children.push(tipsContainer);
@@ -28862,7 +28119,7 @@ class DocEditor {
28862
28119
  rule.setRuleOptions({ width: this.viewOptions.docPageSettings.width, pagePL, pagePR, docLeft });
28863
28120
  }
28864
28121
  version() {
28865
- return "2.1.18";
28122
+ return "2.1.20";
28866
28123
  }
28867
28124
  switchPageHeaderEditor() {
28868
28125
  this.docCtx.document.switchPageHeaderEditor(this.selectionState, null);
@@ -28870,7 +28127,10 @@ class DocEditor {
28870
28127
  getTextContent() {
28871
28128
  const paras = this.docCtx.document.treeFilter(item => item instanceof ParagraphElement);
28872
28129
  const paraTexts = paras.map(item => ElementSerialize.serializeString(item, { all: false }));
28873
- return paraTexts.join('\n');
28130
+ return paraTexts.join('');
28131
+ }
28132
+ emit(event, args) {
28133
+ this.eventBus.emit(event, args);
28874
28134
  }
28875
28135
  }
28876
28136
 
@@ -29043,5 +28303,5 @@ function removeDuplicatesEvent(events) {
29043
28303
  return arr;
29044
28304
  }
29045
28305
 
29046
- export { BlockContainerElement, BlockContainerRenderObject, BlockContentElement, BlockContentRenderObject, BlockLineRectRenderObject, BodyPartProps, BooleanEnum, BorderProps, BranchElement, BranchRenderObject, BreakElement, BreakFactory, BreakRenderObject, CheckBoxElement, CheckBoxFactory, CheckBoxProps, CheckBoxRenderObject, ColumnPatchUtil, CommContentBaseElement, CommContentBaseRenderObject, CommContentElement, CommContentProps, CommContentRenderObject, CommProps, CommentContentFactory, CommentElement, CommentFactory, CommentRenderObject, CommentsFactory, CommentsUtil, CommonUtil, CommsContainerElement, CommsContainerRenderObject, ContentMenuItem, ContextMenuElementEvent, CopyElementEvent, DOMEventSource, DOMSubscription, DataDecorateElement, DataDecorateProps, DataDecorateRenderObject, DataEleBaseProps, DataEleBaseTextProps, DataEleCheckProps, DataEleDateProps, DataEleImageProps, DataEleListProps, DataEleMHProps, DataElementBarcode, DataElementBarcodeFactory, DataElementBarcodeProps, DataElementBarcodeRenderObject, DataElementBaseFactory, DataElementCheck, DataElementCheckFactory, DataElementCheckRenderObject, DataElementDate, DataElementDateFactory, DataElementDateRenderObject, DataElementGroupElement, DataElementGroupFactory, DataElementGroupProps, DataElementGroupRenderObject, DataElementImage, DataElementImgFactory, DataElementInlineGroup, DataElementLeaf, DataElementList, DataElementListFactory, DataElementListRenderObject, DataElementMH, DataElementMHFactory, DataElementRenderObject, DataElementText, DataElementTextFactory, DataElementTextRenderObject, DataImageRenderObject, DataRenderMH, DocEditor, DocMode, DocumentBodyElement, DocumentBodyFactory, DocumentBodyPartElement, DocumentBodyPartFactory, DocumentBodyPartRenderObject, DocumentBodyRenderObject, DocumentChange, DocumentCombine, DocumentComment, DocumentContainerRender, DocumentContext, DocumentCursor, DocumentElement, DocumentEvalFunc, DocumentEvent, DocumentFactory, DocumentFooterElement, DocumentFooterFactory, DocumentFooterRenderObject, DocumentHeaderElement, DocumentHeaderFactory, DocumentHeaderRenderObject, DocumentImagesBaseLoader, DocumentImagesLoader, DocumentInput, DocumentPaint, DocumentPrintOffscreen, DocumentPrintOffscreenBase, DocumentProps, DocumentRenderObject, DocumentSelection, DocumentTemplate, DropElementEvent, EditMode, EditorContext, Element, ElementEvent, ElementFactory, ElementPaint, ElementReader, ElementSerialize, ElementUtil, EventMap, EventSourceCore$1 as EventSourceCore, FillNullSpaceElement, FillNullSpaceRenderObject, GetTrackTipsEvent, GotCursorEvent, IDispose, INotifyPropertyChanged, InlineBlockContainer, InlineGroupElement, InlineGroupInputElement, InlineGroupRenderObject, InlineMuiltBlockLineRenderObject, InputElementEvent, IsInSideDataElement, IsInSideInlineGroupInputElement, KeyboradElementEvent, LeafElement, LeafRenderObject, LostCursorEvent, MarginProps, ModifyFlag$1 as ModifyFlag, MouseElementEvent, MousedownElementEvent, MuiltBlockLineRenderObject, OnceSubject, PSymbolElement, PSymbolRenderObject, PaddingProps, PageBreakElement, PageBreakFactory, PageBreakRenderObject, PageOptions, PaintContent, ParagraphElement, ParagraphFactory, ParagraphLineRectRenderObject, ParagraphNumberType, ParagraphProps, ParagraphRenderObject, PasteElementEvent, PictureElement, PictureFactory, PictureProps, PictureRenderObject, RadioBoxElement, RadioBoxFactory, RadioBoxProps, RadioBoxRenderObject, RangeUtil, Rect, RenderContext, RenderObject, RenderObjectType, ResizeLeafRenderObject, RunElementFactory, SelectionOverlays, SelectionRange, SelectionState, Subject$1 as Subject, SubjectSubscription$1 as SubjectSubscription, Subscription$1 as Subscription, TabElement, TabFactory, TabRenderObject, TableCellElement, TableCellFactory, TableCellProps, TableCellRenderObject, TableElement, TableFactory, TableProps, TableRenderObject, TableRowElement, TableRowFactory, TableRowProps, TableRowRenderObject, TableSplitCell, TableUtil, TextGroupElement, TextGroupFactory, TextGroupRenderObject, TextProps, TrackRunElement, TrackRunProps, TrackRunRenderObject, TrackRunTypeEnum, ValidateCondition, ValidateElement, ValidateProps, ValidateRenderObject, ViewOptions, clearChildrenRenderCache, clearTraces, createPrintTemplate, defaultParaHanging, deleteCurrentParagraph, docOpsMap, documentPrint, drawDecorator, elementTypeEventHandler, exportDecoratorHTML, falseChar, fontMapFunc, formatEle, fromEvent, generatePatch, getCalleeName, getFocusTextSegment, inputText, insertEle, invokeTypeHandler, isDate, logUpdateEleProps, objectToString$4 as objectToString, onTableContextmenu, onceTask, parser, printNodes, reactiveMap, removeEle, removeText, runTextLineRender, setChildrenModifyFlag, setDataElementProps, setNotifyChangedCallback, setTraceTrackingFlag, suppressTracking, targetMaps, textLineRenderMode, toRawType, toTypeString, trueChar, validateDataEle, validateDataEleRenderObj, validateInlineInputRenderObj, watchChanged };
28306
+ export { BlockContainerElement, BlockContainerRenderObject, BlockContentElement, BlockContentRenderObject, BlockLineRectRenderObject, BodyPartProps, BooleanEnum, BorderProps, BranchElement, BranchRenderObject, BreakElement, BreakFactory, BreakRenderObject, CheckBoxElement, CheckBoxFactory, CheckBoxProps, CheckBoxRenderObject, ColumnPatchUtil, CommContentBaseElement, CommContentBaseRenderObject, CommContentElement, CommContentProps, CommContentRenderObject, CommProps, CommentContentFactory, CommentElement, CommentFactory, CommentRenderObject, CommentsFactory, CommentsUtil, CommonUtil, CommsContainerElement, CommsContainerRenderObject, ContentMenuItem, ContextMenuElementEvent, CopyElementEvent, DOMEventSource, DOMSubscription, DataDecorateElement, DataDecorateProps, DataDecorateRenderObject, DataEleBaseProps, DataEleBaseTextProps, DataEleCheckProps, DataEleDateProps, DataEleImageProps, DataEleListProps, DataEleMHProps, DataElementBarcode, DataElementBarcodeFactory, DataElementBarcodeProps, DataElementBarcodeRenderObject, DataElementBaseFactory, DataElementCheck, DataElementCheckFactory, DataElementCheckRenderObject, DataElementDate, DataElementDateFactory, DataElementDateRenderObject, DataElementGroupElement, DataElementGroupFactory, DataElementGroupProps, DataElementGroupRenderObject, DataElementImage, DataElementImgFactory, DataElementInlineGroup, DataElementLeaf, DataElementList, DataElementListFactory, DataElementListRenderObject, DataElementMH, DataElementMHFactory, DataElementRenderObject, DataElementText, DataElementTextFactory, DataElementTextRenderObject, DataImageRenderObject, DataRenderMH, DocEditor, DocMode, DocumentBodyElement, DocumentBodyFactory, DocumentBodyPartElement, DocumentBodyPartFactory, DocumentBodyPartRenderObject, DocumentBodyRenderObject, DocumentChange, DocumentCombine, DocumentComment, DocumentContainerRender, DocumentContext, DocumentCursor, DocumentElement, DocumentEvalFunc, DocumentEvent, DocumentFactory, DocumentFooterElement, DocumentFooterFactory, DocumentFooterRenderObject, DocumentHeaderElement, DocumentHeaderFactory, DocumentHeaderRenderObject, DocumentInput, DocumentPaint, DocumentPrintOffscreen, DocumentPrintOffscreenBase, DocumentProps, DocumentRenderObject, DocumentSelection, DocumentTemplate, DropElementEvent, EditMode, EditorContext, Element, ElementEvent, ElementFactory, ElementPaint, ElementReader, ElementSerialize, ElementUtil, EventBus, EventMap, EventSourceCore$1 as EventSourceCore, FillNullSpaceElement, FillNullSpaceRenderObject, GetTrackTipsEvent, GotCursorEvent, IDispose, INotifyPropertyChanged, InlineBlockContainer, InlineGroupElement, InlineGroupInputElement, InlineGroupRenderObject, InlineMuiltBlockLineRenderObject, InputElementEvent, IsInSideDataElement, IsInSideInlineGroupInputElement, KeyboradElementEvent, LeafElement, LeafRenderObject, LostCursorEvent, MarginProps, ModifyFlag$1 as ModifyFlag, MouseElementEvent, MousedownElementEvent, MuiltBlockLineRenderObject, OnceSubject, PSymbolElement, PSymbolRenderObject, PaddingProps, PageBreakElement, PageBreakFactory, PageBreakRenderObject, PageOptions, PaintContent, ParagraphElement, ParagraphFactory, ParagraphLineRectRenderObject, ParagraphNumberType, ParagraphProps, ParagraphRenderObject, PasteElementEvent, PictureElement, PictureFactory, PictureProps, PictureRenderObject, RadioBoxElement, RadioBoxFactory, RadioBoxProps, RadioBoxRenderObject, RangeUtil, Rect, RenderContext, RenderObject, RenderObjectType, ResizeLeafRenderObject, RunElementFactory, SVGElement, SVGFactory, SVGProps, SVGRenderObject, SelectionOverlays, SelectionRange, SelectionState, Subject$1 as Subject, SubjectSubscription$1 as SubjectSubscription, Subscription$1 as Subscription, TabElement, TabFactory, TabRenderObject, TableCellElement, TableCellFactory, TableCellProps, TableCellRenderObject, TableElement, TableFactory, TableProps, TableRenderObject, TableRowElement, TableRowFactory, TableRowProps, TableRowRenderObject, TableSplitCell, TableUtil, TextGroupElement, TextGroupFactory, TextGroupRenderObject, TextProps, TrackRunElement, TrackRunProps, TrackRunRenderObject, TrackRunTypeEnum, ValidateCondition, ValidateElement, ValidateProps, ValidateRenderObject, ViewOptions, clearChildrenRenderCache, clearTraces, createPrintTemplate, defaultParaHanging, deleteCurrentParagraph, docOpsMap, documentPrint, drawDecorator, elementTypeEventHandler, exportDecoratorHTML, falseChar, fontMapFunc, formatEle, fromEvent, generatePatch, getCalleeName, getFocusTextSegment, inputText, insertEle, invokeTypeHandler, isDate, logUpdateEleProps, objectToString$4 as objectToString, onTableContextmenu, onceTask, parser, printNodes, reactiveMap, removeEle, removeText, runTextLineRender, setChildrenModifyFlag, setDataElementProps, setNotifyChangedCallback, setTraceTrackingFlag, suppressTracking, targetMaps, textLineRenderMode, toRawType, toTypeString, trueChar, validateDataEle, validateDataEleRenderObj, validateInlineInputRenderObj, watchChanged };
29047
28307
  //# sourceMappingURL=index.js.map