@hailin-zheng/editor-core 2.2.32 → 2.2.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -231,8 +231,8 @@ const toRawType = (value) => {
231
231
  */
232
232
  class RenderObject {
233
233
  element;
234
- margin;
235
- padding;
234
+ // margin!: MarginProps;
235
+ // padding!: PaddingProps;
236
236
  rect = new Rect();
237
237
  parent;
238
238
  /**
@@ -241,8 +241,8 @@ class RenderObject {
241
241
  disableClick;
242
242
  constructor(element) {
243
243
  this.element = element;
244
- this.margin = new MarginProps();
245
- this.padding = new PaddingProps();
244
+ // this.margin = new MarginProps();
245
+ // this.padding = new PaddingProps();
246
246
  }
247
247
  destroy() {
248
248
  //this.parent = null;
@@ -251,34 +251,34 @@ class RenderObject {
251
251
  //this.rect = null;
252
252
  //this.element = null;
253
253
  }
254
- /**
255
- * 获取内容区域框体
256
- * @param render
257
- * @returns
258
- */
259
- getInnerRect() {
260
- const { padding } = this;
261
- const rect = new Rect();
262
- rect.x = padding.left;
263
- rect.y = padding.top;
264
- rect.width = this.rect.width - padding.left - padding.right;
265
- rect.height = this.rect.height - padding.top - padding.bottom;
266
- return rect;
267
- }
268
- getInnerMaxWidth() {
269
- const { padding, margin } = this;
270
- return this.rect.width - padding.left - padding.right - margin.left - margin.right;
271
- }
272
- /**
273
- * 根据内框内容高度,更新外框框体高度
274
- * @param innerRect
275
- */
276
- updateRenderHeight(innerRect) {
277
- const innerHeight = typeof innerRect === 'number' ? innerRect : innerRect.height;
278
- const { padding, margin } = this;
279
- //外层容器高度等于内容高度+外边距+内边距
280
- this.rect.height = innerHeight + padding.top + padding.bottom;
281
- }
254
+ // /**
255
+ // * 获取内容区域框体
256
+ // * @param render
257
+ // * @returns
258
+ // */
259
+ // getInnerRect(): Rect {
260
+ // const { padding } = this;
261
+ // const rect = new Rect();
262
+ // rect.x = padding.left;
263
+ // rect.y = padding.top;
264
+ // rect.width = this.rect.width - padding.left - padding.right;
265
+ // rect.height = this.rect.height - padding.top - padding.bottom;
266
+ // return rect;
267
+ // }
268
+ // getInnerMaxWidth(): number {
269
+ // const { padding, margin } = this;
270
+ // return this.rect.width - padding.left - padding.right - margin.left - margin.right;
271
+ // }
272
+ // /**
273
+ // * 根据内框内容高度,更新外框框体高度
274
+ // * @param innerRect
275
+ // */
276
+ // updateRenderHeight(innerRect: Rect | number): void {
277
+ // const innerHeight = typeof innerRect === 'number' ? innerRect : (<Rect>innerRect).height;
278
+ // const { padding, margin } = this;
279
+ // //外层容器高度等于内容高度+外边距+内边距
280
+ // this.rect.height = innerHeight + padding.top + padding.bottom;
281
+ // }
282
282
  getIndex() {
283
283
  if (this.parent) {
284
284
  return this.parent.getChildIndex(this);
@@ -382,10 +382,45 @@ class BranchRenderObject extends RenderObject {
382
382
  * 块级渲染元素
383
383
  */
384
384
  class BlockContentRenderObject extends BranchRenderObject {
385
+ margin;
386
+ padding;
387
+ constructor(element) {
388
+ super(element);
389
+ this.margin = new MarginProps();
390
+ this.padding = new PaddingProps();
391
+ }
385
392
  setRenderWidth(maxWidth) {
386
393
  //this.rect.maxWidth = maxWidth;
387
394
  this.rect.width = maxWidth;
388
395
  }
396
+ /**
397
+ * 获取内容区域框体
398
+ * @param render
399
+ * @returns
400
+ */
401
+ getInnerRect() {
402
+ const { padding } = this;
403
+ const rect = new Rect();
404
+ rect.x = padding.left;
405
+ rect.y = padding.top;
406
+ rect.width = this.rect.width - padding.left - padding.right;
407
+ rect.height = this.rect.height - padding.top - padding.bottom;
408
+ return rect;
409
+ }
410
+ getInnerMaxWidth() {
411
+ const { padding, margin } = this;
412
+ return this.rect.width - padding.left - padding.right - margin.left - margin.right;
413
+ }
414
+ /**
415
+ * 根据内框内容高度,更新外框框体高度
416
+ * @param innerRect
417
+ */
418
+ updateRenderHeight(innerRect) {
419
+ const innerHeight = typeof innerRect === 'number' ? innerRect : innerRect.height;
420
+ const { padding, margin } = this;
421
+ //外层容器高度等于内容高度+外边距+内边距
422
+ this.rect.height = innerHeight + padding.top + padding.bottom;
423
+ }
389
424
  }
390
425
  class InlineGroupRenderObject extends BranchRenderObject {
391
426
  }
@@ -393,10 +428,45 @@ class InlineGroupRenderObject extends BranchRenderObject {
393
428
  * 包含块级渲染元素的容器元素,例如body、table-cell等
394
429
  */
395
430
  class BlockContainerRenderObject extends BranchRenderObject {
431
+ margin;
432
+ padding;
433
+ constructor(element) {
434
+ super(element);
435
+ this.margin = new MarginProps();
436
+ this.padding = new PaddingProps();
437
+ }
396
438
  setRenderWidth(maxWidth) {
397
439
  //this.rect.maxWidth = maxWidth;
398
440
  this.rect.width = maxWidth;
399
441
  }
442
+ /**
443
+ * 获取内容区域框体
444
+ * @param render
445
+ * @returns
446
+ */
447
+ getInnerRect() {
448
+ const { padding } = this;
449
+ const rect = new Rect();
450
+ rect.x = padding.left;
451
+ rect.y = padding.top;
452
+ rect.width = this.rect.width - padding.left - padding.right;
453
+ rect.height = this.rect.height - padding.top - padding.bottom;
454
+ return rect;
455
+ }
456
+ getInnerMaxWidth() {
457
+ const { padding, margin } = this;
458
+ return this.rect.width - padding.left - padding.right - margin.left - margin.right;
459
+ }
460
+ /**
461
+ * 根据内框内容高度,更新外框框体高度
462
+ * @param innerRect
463
+ */
464
+ updateRenderHeight(innerRect) {
465
+ const innerHeight = typeof innerRect === 'number' ? innerRect : innerRect.height;
466
+ const { padding, margin } = this;
467
+ //外层容器高度等于内容高度+外边距+内边距
468
+ this.rect.height = innerHeight + padding.top + padding.bottom;
469
+ }
400
470
  }
401
471
  /**
402
472
  * 多级 ‘BlockLineRectRenderObject’ 包裹元素,例如 p、table
@@ -3081,9 +3151,12 @@ function parser(code, objects) {
3081
3151
  const identifierName = child['name'];
3082
3152
  if (identifierName.startsWith('$')) {
3083
3153
  //获取对象为"CallExpression", "MemberExpression"获取属性,例如$1.value
3084
- parent?.type;
3085
- `getObject('${identifierName.slice(1)})`;
3086
- child['name'] = `getObject('${identifierName.slice(1)}').value`;
3154
+ const type = parent?.type;
3155
+ let express = `getObject('${identifierName.slice(1)}')`;
3156
+ if (type !== 'MemberExpression') {
3157
+ express += '.value';
3158
+ }
3159
+ child['name'] = express;
3087
3160
  objects?.push(identifierName.slice(1));
3088
3161
  }
3089
3162
  }
@@ -3906,6 +3979,7 @@ class DocumentRenderObject extends BlockContainerRenderObject {
3906
3979
  const pageCorner = this.exportPageCornerHTML(event);
3907
3980
  const pageNum = this.exportPageNumHTML(event);
3908
3981
  const copyright = this.exportCopyRight(event);
3982
+ const defs = this.exportDefs();
3909
3983
  return {
3910
3984
  sel: "svg",
3911
3985
  isCompleted: true,
@@ -3920,7 +3994,7 @@ class DocumentRenderObject extends BlockContainerRenderObject {
3920
3994
  },
3921
3995
  },
3922
3996
  children: [
3923
- pageCorner, highlight, selection, ...CommonUtil.toArray(event.getChildNodes(this)), pageNum, copyright
3997
+ defs, pageCorner, highlight, selection, ...CommonUtil.toArray(event.getChildNodes(this)), pageNum, copyright
3924
3998
  ]
3925
3999
  };
3926
4000
  }
@@ -3987,6 +4061,34 @@ class DocumentRenderObject extends BlockContainerRenderObject {
3987
4061
  },
3988
4062
  };
3989
4063
  }
4064
+ exportDefs() {
4065
+ /**
4066
+ * <defs>
4067
+ <filter id="f1" x="0" y="0">
4068
+ <feGaussianBlur stdDeviation="0.5" result="blur" />
4069
+ <feMerge>
4070
+ <feMergeNode in="thicken" />
4071
+ <feMergeNode in="SourceGraphic" />
4072
+ </feMerge>
4073
+ </filter>
4074
+ </defs>
4075
+ */
4076
+ return {
4077
+ sel: 'defs',
4078
+ data: {
4079
+ ns: "http://www.w3.org/2000/svg",
4080
+ props: {
4081
+ innerHTML: `<filter id="t_bold" x="0" y="0">
4082
+ <feGaussianBlur stdDeviation="0.5" result="blur" />
4083
+ <feMerge>
4084
+ <feMergeNode in="thicken" />
4085
+ <feMergeNode in="SourceGraphic" />
4086
+ </feMerge>
4087
+ </filter>`
4088
+ }
4089
+ },
4090
+ };
4091
+ }
3990
4092
  }
3991
4093
  class DocumentFactory extends ElementFactory {
3992
4094
  match(type) {
@@ -4339,6 +4441,9 @@ class DataElementRenderObject extends InlineGroupRenderObject {
4339
4441
  const validateDataEle = (ele) => {
4340
4442
  return ele instanceof DataElementLeaf || ele instanceof DataElementInlineGroup;
4341
4443
  };
4444
+ const validateInlineDataEle = (ele) => {
4445
+ return ele instanceof DataElementInlineGroup;
4446
+ };
4342
4447
  const validateDataEleRenderObj = (renderObj) => {
4343
4448
  if (renderObj.element) {
4344
4449
  return validateDataEle(renderObj.element);
@@ -5116,9 +5221,7 @@ class TextGroupRenderObject extends LeafRenderObject {
5116
5221
  if (actualFontBoundingBoxAscent === undefined) {
5117
5222
  t.data.attrs['dominant-baseline'] = 'hanging';
5118
5223
  }
5119
- if (this.element.props.fontWeight !== 'normal') {
5120
- t.data.attrs['font-weight'] = this.element.props.fontWeight;
5121
- }
5224
+ if (this.element.props.fontWeight !== 'normal') ;
5122
5225
  if (this.element.props.fontStyle !== 'normal') {
5123
5226
  t.data.attrs['font-style'] = this.element.props.fontStyle;
5124
5227
  }
@@ -5148,6 +5251,42 @@ class TextGroupRenderObject extends LeafRenderObject {
5148
5251
  }
5149
5252
  //处理null-text
5150
5253
  if (this.element.isDecorate && this.element.disableClick && !this.element.parent) ;
5254
+ if (this.element.props.fontWeight === "bold") {
5255
+ const g = {
5256
+ sel: "g",
5257
+ data: {
5258
+ ns: "http://www.w3.org/2000/svg",
5259
+ attrs: {}
5260
+ },
5261
+ children: [
5262
+ {
5263
+ sel: "g",
5264
+ data: {
5265
+ ns: "http://www.w3.org/2000/svg",
5266
+ attrs: {
5267
+ translate: { x: 0, y: 0 }
5268
+ }
5269
+ },
5270
+ children: [
5271
+ { ...t }
5272
+ ]
5273
+ },
5274
+ {
5275
+ sel: "g",
5276
+ data: {
5277
+ ns: "http://www.w3.org/2000/svg",
5278
+ attrs: {
5279
+ translate: { x: 0.5, y: 0 }
5280
+ }
5281
+ },
5282
+ children: [
5283
+ { ...t }
5284
+ ]
5285
+ }
5286
+ ]
5287
+ };
5288
+ return g;
5289
+ }
5151
5290
  return t;
5152
5291
  }
5153
5292
  }
@@ -11018,8 +11157,10 @@ class SVGRenderObject extends ResizeLeafRenderObject {
11018
11157
  exportSVG(event) {
11019
11158
  const props = this.element.props;
11020
11159
  const t = super.exportSVG(event);
11021
- t.children = [ElementUtil.createSvgEle('svg', { width: this.rect.width,
11022
- height: this.rect.height }, ElementUtil.createSvgEle('image', {
11160
+ t.children = [ElementUtil.createSvgEle('svg', {
11161
+ width: this.rect.width,
11162
+ height: this.rect.height
11163
+ }, ElementUtil.createSvgEle('image', {
11023
11164
  "xlink:href": props.value,
11024
11165
  width: Math.min(this.rect.width, this.rect.height),
11025
11166
  height: Math.min(this.rect.width, this.rect.height)
@@ -11052,7 +11193,6 @@ class SVGFactory extends ElementFactory {
11052
11193
  picProps.height = props.height;
11053
11194
  picProps.value = props.value;
11054
11195
  picProps.title = props.title;
11055
- pic.props = picProps;
11056
11196
  return pic;
11057
11197
  }
11058
11198
  }
@@ -11687,12 +11827,18 @@ class ElementUtil {
11687
11827
  innerRect.height = 0;
11688
11828
  for (let i = 0; i < render.length; i++) {
11689
11829
  const line = render.getChild(i);
11830
+ let mt = 0;
11831
+ let mb = 0;
11832
+ if (line instanceof BlockContainerRenderObject || line instanceof BlockContentRenderObject) {
11833
+ mt = line.margin.top;
11834
+ mb = line.margin.bottom;
11835
+ }
11690
11836
  if (resetX) {
11691
11837
  line.rect.x = innerRect.x;
11692
11838
  }
11693
- line.rect.y = innerRect.height + innerRect.y + line.margin.top;
11839
+ line.rect.y = innerRect.height + innerRect.y + mt;
11694
11840
  this.setHorizontalAlign(line, innerRect);
11695
- innerRect.height += line.rect.height + line.margin.top + line.margin.bottom;
11841
+ innerRect.height += line.rect.height + mt + mb;
11696
11842
  }
11697
11843
  render.updateRenderHeight(innerRect);
11698
11844
  return innerRect.height;
@@ -14379,6 +14525,22 @@ class DynamicExecute {
14379
14525
  }
14380
14526
  return res;
14381
14527
  }
14528
+ /**
14529
+ * 获取元素的父表格行元素。
14530
+ *
14531
+ */
14532
+ CtxRow(ele) {
14533
+ // 使用ElementUtil的getParent方法来查找第一个实例化为TableRowElement的父元素
14534
+ return ElementUtil.getParent(ele, (item) => item instanceof TableRowElement);
14535
+ }
14536
+ /**
14537
+ * 获取元素的父表格行元素。
14538
+ *
14539
+ */
14540
+ CtxTable(ele) {
14541
+ // 使用ElementUtil的getParent方法来查找第一个实例化为TableElement的父元素
14542
+ return ElementUtil.getParent(ele, (item) => item instanceof TableElement);
14543
+ }
14382
14544
  }
14383
14545
 
14384
14546
  class ParagraphMeasure {
@@ -16274,6 +16436,7 @@ class DocumentEvent {
16274
16436
  subs = [];
16275
16437
  selectionState;
16276
16438
  viewOptions;
16439
+ prevTrackInfo = false;
16277
16440
  constructor(documentPaint, docCtx, documentInput) {
16278
16441
  this.documentPaint = documentPaint;
16279
16442
  this.docCtx = docCtx;
@@ -16350,6 +16513,7 @@ class DocumentEvent {
16350
16513
  }
16351
16514
  clear() {
16352
16515
  this.selectionState.clear();
16516
+ this.prevCursorItems.length = 0;
16353
16517
  this.startHitInfo = null;
16354
16518
  this.endHitInfo = null;
16355
16519
  this.focusedElement = null;
@@ -16410,7 +16574,6 @@ class DocumentEvent {
16410
16574
  viewEvt.globalX = evt.x / this.viewOptions.scale;
16411
16575
  viewEvt.globalY = evt.y / this.viewOptions.scale;
16412
16576
  }
16413
- prevTrackInfo = false;
16414
16577
  /**
16415
16578
  * 显示提示信息
16416
16579
  * 显示留痕提示信息等
@@ -17338,13 +17501,25 @@ class DocumentEvent {
17338
17501
  if (this.viewOptions.docMode !== DocMode.FormEdit) {
17339
17502
  return;
17340
17503
  }
17341
- const currDataEle = this.getCurrentDataElement('free');
17342
- if (currDataEle) {
17343
- if (currDataEle instanceof DataElementLeaf) {
17344
- this.moveCursorToRightHandle(currDataEle, 1);
17345
- }
17346
- else {
17347
- this.moveCursorToRightHandle(currDataEle.endDecorate, 1);
17504
+ const currDataEle = this.getCurrentDataElement();
17505
+ //只处理内联数据元元素
17506
+ if (!currDataEle || !(currDataEle instanceof DataElementInlineGroup)) {
17507
+ return;
17508
+ }
17509
+ const ctx = this.docCtx.defaultCtx.ctx;
17510
+ //获取所有的段落
17511
+ const paras = ctx.treeFilter(item => item instanceof ParagraphElement);
17512
+ //当前段落
17513
+ let currPara = ElementUtil.getParentByType(currDataEle, ParagraphElement);
17514
+ for (let i = paras.indexOf(currPara); i < paras.length; i++) {
17515
+ const currPara = paras[i];
17516
+ let currParaDataEleList = currPara.treeFilter(item => validateInlineDataEle(item));
17517
+ for (let j = currParaDataEleList.indexOf(currDataEle) + 1; j < currParaDataEleList.length; j++) {
17518
+ const nextDataEle = currParaDataEleList[j];
17519
+ if (nextDataEle && ElementUtil.canSetCursor(nextDataEle.startDecorate, 1, true, this.viewOptions)) {
17520
+ this.selectionState.resetRange(nextDataEle.startDecorate, 1);
17521
+ return;
17522
+ }
17348
17523
  }
17349
17524
  }
17350
17525
  }
@@ -17500,7 +17675,7 @@ class DocumentEvent {
17500
17675
  * 获取当前光标所在的数据元
17501
17676
  * @returns
17502
17677
  */
17503
- getCurrentDataElement(mode = 'strict') {
17678
+ getCurrentDataElement() {
17504
17679
  const selectionState = this.selectionState;
17505
17680
  const { startControl, startOffset, collapsed, ancestorCommonControl } = selectionState;
17506
17681
  if (startControl && collapsed) {
@@ -17508,7 +17683,7 @@ class DocumentEvent {
17508
17683
  // return null;
17509
17684
  // }
17510
17685
  const dataEle = ElementUtil.getParent(startControl, validateDataEle);
17511
- if (dataEle instanceof DataElementLeaf || (mode === 'free' || IsInSideDataElement(startControl, startOffset))) {
17686
+ if (dataEle instanceof DataElementLeaf || IsInSideDataElement(startControl, startOffset)) {
17512
17687
  return dataEle;
17513
17688
  }
17514
17689
  else {
@@ -17521,10 +17696,18 @@ class DocumentEvent {
17521
17696
  return null;
17522
17697
  }
17523
17698
  /**
17524
- * 获取当前光标所在的数据组
17525
- * @returns
17526
- */
17527
- getCurrentDataGroupElement(mode = 'strict') {
17699
+ * 根据元素寻找所在的数据元
17700
+ * @param ele
17701
+ */
17702
+ getParentDataElement(ele) {
17703
+ const dataEle = ElementUtil.getParent(ele, validateDataEle);
17704
+ return dataEle;
17705
+ }
17706
+ /**
17707
+ * 获取当前光标所在的数据组
17708
+ * @returns
17709
+ */
17710
+ getCurrentDataGroupElement() {
17528
17711
  const selectionState = this.selectionState;
17529
17712
  const { startControl, startOffset, collapsed, ancestorCommonControl } = selectionState;
17530
17713
  if (startControl && collapsed) {
@@ -17532,7 +17715,7 @@ class DocumentEvent {
17532
17715
  // return null;
17533
17716
  // }
17534
17717
  const dataEle = ElementUtil.getParent(startControl, validateDataGroup);
17535
- if (mode === 'free' || IsInSideDataGroup(startControl, startOffset)) {
17718
+ if (IsInSideDataGroup(startControl, startOffset)) {
17536
17719
  return dataEle;
17537
17720
  }
17538
17721
  else {
@@ -19253,6 +19436,9 @@ class DocumentChange {
19253
19436
  * @param text
19254
19437
  */
19255
19438
  pastePlainText(text) {
19439
+ if (!text) {
19440
+ return;
19441
+ }
19256
19442
  const textItems = text.split(/\r?\n/);
19257
19443
  const { startControl, startOffset } = this.selectionState;
19258
19444
  if (this.viewOptions.docMode === DocMode.FormEdit || textItems.length === 1 || IsInSideInlineGroupInputElement(startControl, startOffset)) {
@@ -21974,6 +22160,10 @@ class DocEditor {
21974
22160
  }
21975
22161
  this.trackChangeState = prev;
21976
22162
  }
22163
+ /**
22164
+ * 载入文档
22165
+ * @param data json对象、json字符串、DocumentElement对象
22166
+ */
21977
22167
  loadDoc(data) {
21978
22168
  suppressTracking(() => {
21979
22169
  this.noEffectChange(() => {
@@ -21981,6 +22171,8 @@ class DocEditor {
21981
22171
  this.elementReader.read(data);
21982
22172
  this.refreshDocument();
21983
22173
  this.historyMange.clear();
22174
+ this.documentEvent.clear();
22175
+ this.scrollToPosition({ x: 0, y: 0 });
21984
22176
  });
21985
22177
  });
21986
22178
  }
@@ -22199,7 +22391,7 @@ class DocEditor {
22199
22391
  return this.documentEvent.getCurrentDataElement();
22200
22392
  }
22201
22393
  /**
22202
- * 回去当前光标所在数据组
22394
+ * 获取当前光标所在数据组
22203
22395
  * @returns
22204
22396
  */
22205
22397
  getCurrentDataGroupElement() {
@@ -23137,7 +23329,7 @@ class DocEditor {
23137
23329
  if (parent) {
23138
23330
  const parentRect = parent.getBoundingClientRect();
23139
23331
  const elmRect = elm.getBoundingClientRect();
23140
- const top = parseInt(elm.style.top);
23332
+ parseInt(elm.style.top);
23141
23333
  // elmRect.width /= scale;
23142
23334
  // elmRect.height /= scale;
23143
23335
  // parentRect.width /= scale;
@@ -23148,21 +23340,7 @@ class DocEditor {
23148
23340
  if (elmRect.left < parentRect.left) {
23149
23341
  elm.style.left = (position.x - 10) + 'px';
23150
23342
  }
23151
- if (elmRect.right > parentRect.right) {
23152
- elm.style.left = (position.x - elmRect.width / scale + 10) + 'px';
23153
- //elm.style.left = parentRect.width - elmRect.width + 'px';
23154
- }
23155
- if (elmRect.top + elmRect.height > parentRect.top + parentRect.height) {
23156
- const newTop = top - 5 - position.height - elmRect.height;
23157
- position.y + 5 + position.height;
23158
- //计算前后的高度的差距,然后判断新的值是否在父元素的范围内,如果不在则使用旧的值
23159
- // if (newTop > 0 && oldTop - newTop < elmRect.top - parentRect.top) {
23160
- // elm.style.top = (position.y - position.height - elmRect.height) + 'px';
23161
- // }
23162
- elm.style.top = newTop + 'px';
23163
- //elm.style.top = (top - (elmRect.top + elmRect.height - (parentRect.top + parentRect.height))) + 'px';
23164
- //elm.style.top = (position.y - position.height - elmRect.height) + 'px';
23165
- }
23343
+ return;
23166
23344
  }
23167
23345
  }
23168
23346
  renderCalendar() {
@@ -23270,7 +23448,7 @@ class DocEditor {
23270
23448
  rule.setRuleOptions({ width: this.viewOptions.docPageSettings.width, pagePL, pagePR, docLeft });
23271
23449
  }
23272
23450
  version() {
23273
- return "2.2.32";
23451
+ return "2.2.34";
23274
23452
  }
23275
23453
  switchPageHeaderEditor() {
23276
23454
  this.docCtx.document.switchPageHeaderEditor(this.selectionState, null);
@@ -23723,7 +23901,9 @@ class DocumentEvalFunc {
23723
23901
  }
23724
23902
  }
23725
23903
 
23726
- function createPrintTemplate({ width, height, orient }) {
23904
+ function createPrintTemplate({ width, height, orient, printDOMStyle }) {
23905
+ //FIX:修复win7宋体加粗不生效的情况
23906
+ const printStyle = printDOMStyle ?? `text[font-weight="bold"][font-family="宋体"] {font-family: STSong;}`;
23727
23907
  return `
23728
23908
  <!DOCTYPE html>
23729
23909
  <html lang="zh">
@@ -23764,10 +23944,7 @@ function createPrintTemplate({ width, height, orient }) {
23764
23944
  width: initial;
23765
23945
  min-height: initial;
23766
23946
  }
23767
- text[font-weight="bold"][font-family="宋体"] {
23768
- font-family: STSong, 宋体;
23769
- -webkit-text-shadow: 0.15pt 0px 0px black, 0.25pt 0px 0px black, 0.35pt 0px 0px black, -0.25pt 0px 0px black, 0px 0.25pt 0px black, 0px -0.25pt 0px black;
23770
- }
23947
+ ${printStyle}
23771
23948
  }
23772
23949
  </style>
23773
23950
  </head>
@@ -23793,8 +23970,7 @@ function printNodes(printNodes, options, printEvent = null) {
23793
23970
  console.warn('无可打印节点');
23794
23971
  return;
23795
23972
  }
23796
- const printSize = options;
23797
- const iframeHTML = createPrintTemplate(printSize);
23973
+ const iframeHTML = createPrintTemplate(options);
23798
23974
  printIFrame.contentWindow?.document.write(iframeHTML);
23799
23975
  printIFrame.contentWindow?.document.close();
23800
23976
  for (let i = 0; i < printNodes.length; i++) {
@@ -28784,6 +28960,7 @@ class DocumentPrintOffscreenBase {
28784
28960
  afterRenderEvent = new Subject();
28785
28961
  beforePrint = new Subject();
28786
28962
  afterPrint = new Subject();
28963
+ printDOMStyle;
28787
28964
  constructor() {
28788
28965
  this.viewOptions = new ViewOptions();
28789
28966
  this.viewOptions.copyRightInfo = '';
@@ -28817,6 +28994,7 @@ class DocumentPrintOffscreenBase {
28817
28994
  return;
28818
28995
  }
28819
28996
  const docProps = this.docCtx.viewOptions.docPageSettings.clone();
28997
+ docProps['printDOMStyle'] = this.printDOMStyle;
28820
28998
  printNodes(canvasNodes, docProps, {
28821
28999
  beforePrint: () => this.beforePrint.next(),
28822
29000
  afterPrint: () => this.afterPrint.next()
@@ -28847,6 +29025,7 @@ class DocumentPrintOffscreenBase {
28847
29025
  return;
28848
29026
  }
28849
29027
  const docProps = this.docCtx.viewOptions.docPageSettings.clone();
29028
+ docProps['printDOMStyle'] = this.printDOMStyle;
28850
29029
  // if (docProps.orient === 'landscape') {
28851
29030
  // svgNodes = svgNodes.map(item => 'data:image/svg+xml;base64,' + CommonUtil.btoa(item)).map(item => `<img src="${item}" width="${docProps.width}px" height="${docProps.height-1}px" style="display: block"/>`);
28852
29031
  // }
@@ -29040,5 +29219,5 @@ function removeDuplicatesEvent(events) {
29040
29219
  return arr;
29041
29220
  }
29042
29221
 
29043
- 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, CommonUtil, CommsContainerElement, CommsContainerRenderObject, ContentMenuItem, ContextMenuElementEvent, CopyElementEvent, DOMEventSource, DOMSubscription, DataContainerElement, DataContainerFactory, DataContainerProps, DataContainerRenderObject, 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, DocInputSuggestions, DocMode, DocumentBodyElement, DocumentBodyFactory, DocumentBodyPartElement, DocumentBodyPartFactory, DocumentBodyPartRenderObject, DocumentBodyRenderObject, DocumentChange, DocumentCombine, DocumentComment, DocumentContainerRender, DocumentContext, DocumentCursor, DocumentElement, DocumentEvalFunc, DocumentEvent, DocumentFactory, DocumentFooterElement, DocumentFooterFactory, DocumentFooterRenderObject, DocumentHeaderElement, DocumentHeaderFactory, DocumentHeaderRenderObject, DocumentInput, DocumentPaginator, DocumentPrintOffscreen, DocumentPrintOffscreenBase, DocumentProps, DocumentRenderObject, DocumentSelection, DocumentTemplate, DropElementEvent, EditMode, EditorContext, Element, ElementEvent, ElementFactory, ElementReader, ElementSerialize, ElementUtil, EventBus, EventMap, EventSourceCore, FillNullSpaceElement, FillNullSpaceRenderObject, GetTrackTipsEvent, GotCursorEvent, IDispose, INotifyPropertyChanged, InlineBlockContainer, InlineGroupElement, InlineGroupInputElement, InlineGroupRenderObject, InlineMuiltBlockLineRenderObject, InputElementEvent, IsInSideDataElement, IsInSideDataGroup, IsInSideInlineGroupInputElement, KeyboradElementEvent, LeafElement, LeafRenderObject, LineElement, LineFactory, LineProps, LineRenderObject, LostCursorEvent, MarginProps, ModifyFlag, MouseElementEvent, MousedownElementEvent, MultiBlockLineRenderObject, OnceSubject, PSymbolElement, PSymbolRenderObject, PaddingProps, PageBreakElement, PageBreakFactory, PageBreakRenderObject, PageOptions, PaintContent, ParagraphElement, ParagraphFactory, ParagraphLineRectRenderObject, ParagraphNumberType, ParagraphProps, ParagraphRenderObject, PasteElementEvent, PermanentTeethElement, PermanentTeethFactory, PermanentTeethProps, PermanentTeethRenderObject, PictureElement, PictureFactory, PictureProps, PictureRenderObject, RadioBoxElement, RadioBoxFactory, RadioBoxProps, RadioBoxRenderObject, RangeUtil, Rect, RenderContext, RenderObject, RenderObjectType, ResizeLeafRenderObject, RowMinHeight, RunElementFactory, SVGElement, SVGFactory, SVGProps, SVGRenderObject, SelectionOverlays, SelectionRange, SelectionState, Subject, SubjectSubscription, Subscription, TEXT_HEIGHT_FACTOR, TabElement, TabFactory, TabRenderObject, TableCellElement, TableCellFactory, TableCellProps, TableCellRenderObject, TableElement, TableFactory, TableProps, TableRenderObject, TableRowElement, TableRowFactory, TableRowProps, TableRowRenderObject, TableSplitCell, TableUtil, TextGroupElement, TextGroupFactory, TextGroupRenderObject, TextProps, TextUnitsHolder, TrackRunElement, TrackRunProps, TrackRunRenderObject, TrackRunTypeEnum, ValidateCondition, ValidateElement, ValidateProps, ValidateRenderObject, ViewOptions, addReturn, clearChildrenRenderCache, clearTraces, cloneChildren, cloneElementBase, defaultParaHanging, deleteCurrentParagraph, docOpsMap, elementTypeEventHandler, exportDataEleDecoratorSVG$1 as exportDataEleDecoratorSVG, falseChar, fontMapFunc, formatEle, fromEvent, generatePatch, getCalleeName, getCurrentParaGroupRenders, getFocusTextSegment, getRenderPosToDoc, inputText, insertEle, invokeTypeHandler, isDate, logUpdateEleProps, objectToString$4 as objectToString, onTableContextmenu, onceTask, parser, reactiveMap, refreshEditor, removeEle, removeText, renderErrorTip, renderUnderWavyLine, renderUnderline, runTextLineRender, setChildrenModifyFlag, setNotifyChangedCallback, setTraceTrackingFlag, suppressTracking, targetMaps, textLineRenderMode, toRawType, toTypeString, trueChar, updatePartialProps, validateDataEle, validateDataEleRenderObj, validateDataGroup, validateInlineInputRenderObj, watchChanged };
29222
+ 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, CommonUtil, CommsContainerElement, CommsContainerRenderObject, ContentMenuItem, ContextMenuElementEvent, CopyElementEvent, DOMEventSource, DOMSubscription, DataContainerElement, DataContainerFactory, DataContainerProps, DataContainerRenderObject, 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, DocInputSuggestions, DocMode, DocumentBodyElement, DocumentBodyFactory, DocumentBodyPartElement, DocumentBodyPartFactory, DocumentBodyPartRenderObject, DocumentBodyRenderObject, DocumentChange, DocumentCombine, DocumentComment, DocumentContainerRender, DocumentContext, DocumentCursor, DocumentElement, DocumentEvalFunc, DocumentEvent, DocumentFactory, DocumentFooterElement, DocumentFooterFactory, DocumentFooterRenderObject, DocumentHeaderElement, DocumentHeaderFactory, DocumentHeaderRenderObject, DocumentInput, DocumentPaginator, DocumentPrintOffscreen, DocumentPrintOffscreenBase, DocumentProps, DocumentRenderObject, DocumentSelection, DocumentTemplate, DropElementEvent, EditMode, EditorContext, Element, ElementEvent, ElementFactory, ElementReader, ElementSerialize, ElementUtil, EventBus, EventMap, EventSourceCore, FillNullSpaceElement, FillNullSpaceRenderObject, GetTrackTipsEvent, GotCursorEvent, IDispose, INotifyPropertyChanged, InlineBlockContainer, InlineGroupElement, InlineGroupInputElement, InlineGroupRenderObject, InlineMuiltBlockLineRenderObject, InputElementEvent, IsInSideDataElement, IsInSideDataGroup, IsInSideInlineGroupInputElement, KeyboradElementEvent, LeafElement, LeafRenderObject, LineElement, LineFactory, LineProps, LineRenderObject, LostCursorEvent, MarginProps, ModifyFlag, MouseElementEvent, MousedownElementEvent, MultiBlockLineRenderObject, OnceSubject, PSymbolElement, PSymbolRenderObject, PaddingProps, PageBreakElement, PageBreakFactory, PageBreakRenderObject, PageOptions, PaintContent, ParagraphElement, ParagraphFactory, ParagraphLineRectRenderObject, ParagraphNumberType, ParagraphProps, ParagraphRenderObject, PasteElementEvent, PermanentTeethElement, PermanentTeethFactory, PermanentTeethProps, PermanentTeethRenderObject, PictureElement, PictureFactory, PictureProps, PictureRenderObject, RadioBoxElement, RadioBoxFactory, RadioBoxProps, RadioBoxRenderObject, RangeUtil, Rect, RenderContext, RenderObject, RenderObjectType, ResizeLeafRenderObject, RowMinHeight, RunElementFactory, SVGElement, SVGFactory, SVGProps, SVGRenderObject, SelectionOverlays, SelectionRange, SelectionState, Subject, SubjectSubscription, Subscription, TEXT_HEIGHT_FACTOR, TabElement, TabFactory, TabRenderObject, TableCellElement, TableCellFactory, TableCellProps, TableCellRenderObject, TableElement, TableFactory, TableProps, TableRenderObject, TableRowElement, TableRowFactory, TableRowProps, TableRowRenderObject, TableSplitCell, TableUtil, TextGroupElement, TextGroupFactory, TextGroupRenderObject, TextProps, TextUnitsHolder, TrackRunElement, TrackRunProps, TrackRunRenderObject, TrackRunTypeEnum, ValidateCondition, ValidateElement, ValidateProps, ValidateRenderObject, ViewOptions, addReturn, clearChildrenRenderCache, clearTraces, cloneChildren, cloneElementBase, defaultParaHanging, deleteCurrentParagraph, docOpsMap, elementTypeEventHandler, exportDataEleDecoratorSVG$1 as exportDataEleDecoratorSVG, falseChar, fontMapFunc, formatEle, fromEvent, generatePatch, getCalleeName, getCurrentParaGroupRenders, getFocusTextSegment, getRenderPosToDoc, inputText, insertEle, invokeTypeHandler, isDate, logUpdateEleProps, objectToString$4 as objectToString, onTableContextmenu, onceTask, parser, reactiveMap, refreshEditor, removeEle, removeText, renderErrorTip, renderUnderWavyLine, renderUnderline, runTextLineRender, setChildrenModifyFlag, setNotifyChangedCallback, setTraceTrackingFlag, suppressTracking, targetMaps, textLineRenderMode, toRawType, toTypeString, trueChar, updatePartialProps, validateDataEle, validateDataEleRenderObj, validateDataGroup, validateInlineDataEle, validateInlineInputRenderObj, watchChanged };
29044
29223
  //# sourceMappingURL=index.js.map