@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/editor.css CHANGED
@@ -1,5 +1,5 @@
1
1
  .svg-container {
2
- background: #C0C6CF;
2
+ background: #c0c6cf;
3
3
  overflow: hidden;
4
4
  flex: 1;
5
5
  height: 100%;
@@ -9,7 +9,7 @@
9
9
  .svg-container * {
10
10
  white-space: pre;
11
11
  }
12
- .svg-container svg{
12
+ .svg-container svg {
13
13
  pointer-events: none;
14
14
  }
15
15
 
@@ -46,7 +46,6 @@
46
46
  }
47
47
  }
48
48
 
49
-
50
49
  /* 样式化 radio box 的外观 */
51
50
  .editor-list-radiobox {
52
51
  width: 16px;
@@ -77,6 +76,7 @@
77
76
  height: 16px;
78
77
  border: 1px solid #000;
79
78
  cursor: pointer;
79
+ display: inline-block;
80
80
  }
81
81
 
82
82
  /* 选中状态的样式 */
@@ -451,7 +451,6 @@
451
451
  /* transform-origin: center top;*/
452
452
  /*}*/
453
453
 
454
-
455
454
  .editor-calendar-footer-left {
456
455
  display: flex;
457
456
  }
@@ -563,18 +562,18 @@
563
562
  left: 0;
564
563
  top: 0;
565
564
  }
566
- .rule-thumb-container{
565
+ .rule-thumb-container {
567
566
  position: absolute;
568
567
  cursor: pointer;
569
568
  }
570
- .rule-thumb-top{
571
- top:0;
569
+ .rule-thumb-top {
570
+ top: 0;
572
571
  }
573
- .rule-thumb-left{
572
+ .rule-thumb-left {
574
573
  top: calc(100% - 10px);
575
574
  }
576
575
 
577
- .rule-wrapper{
576
+ .rule-wrapper {
578
577
  position: absolute;
579
578
  transform-origin: 0px 0px;
580
579
  top: 0;
@@ -636,4 +635,4 @@ button:focus {
636
635
 
637
636
  .editor-search-box input::placeholder {
638
637
  color: #aaa;
639
- }
638
+ }
package/index-cjs.js CHANGED
@@ -260,8 +260,8 @@ const toRawType = (value) => {
260
260
  */
261
261
  class RenderObject {
262
262
  element;
263
- margin;
264
- padding;
263
+ // margin!: MarginProps;
264
+ // padding!: PaddingProps;
265
265
  rect = new Rect();
266
266
  parent;
267
267
  /**
@@ -270,8 +270,8 @@ class RenderObject {
270
270
  disableClick;
271
271
  constructor(element) {
272
272
  this.element = element;
273
- this.margin = new MarginProps();
274
- this.padding = new PaddingProps();
273
+ // this.margin = new MarginProps();
274
+ // this.padding = new PaddingProps();
275
275
  }
276
276
  destroy() {
277
277
  //this.parent = null;
@@ -280,34 +280,34 @@ class RenderObject {
280
280
  //this.rect = null;
281
281
  //this.element = null;
282
282
  }
283
- /**
284
- * 获取内容区域框体
285
- * @param render
286
- * @returns
287
- */
288
- getInnerRect() {
289
- const { padding } = this;
290
- const rect = new Rect();
291
- rect.x = padding.left;
292
- rect.y = padding.top;
293
- rect.width = this.rect.width - padding.left - padding.right;
294
- rect.height = this.rect.height - padding.top - padding.bottom;
295
- return rect;
296
- }
297
- getInnerMaxWidth() {
298
- const { padding, margin } = this;
299
- return this.rect.width - padding.left - padding.right - margin.left - margin.right;
300
- }
301
- /**
302
- * 根据内框内容高度,更新外框框体高度
303
- * @param innerRect
304
- */
305
- updateRenderHeight(innerRect) {
306
- const innerHeight = typeof innerRect === 'number' ? innerRect : innerRect.height;
307
- const { padding, margin } = this;
308
- //外层容器高度等于内容高度+外边距+内边距
309
- this.rect.height = innerHeight + padding.top + padding.bottom;
310
- }
283
+ // /**
284
+ // * 获取内容区域框体
285
+ // * @param render
286
+ // * @returns
287
+ // */
288
+ // getInnerRect(): Rect {
289
+ // const { padding } = this;
290
+ // const rect = new Rect();
291
+ // rect.x = padding.left;
292
+ // rect.y = padding.top;
293
+ // rect.width = this.rect.width - padding.left - padding.right;
294
+ // rect.height = this.rect.height - padding.top - padding.bottom;
295
+ // return rect;
296
+ // }
297
+ // getInnerMaxWidth(): number {
298
+ // const { padding, margin } = this;
299
+ // return this.rect.width - padding.left - padding.right - margin.left - margin.right;
300
+ // }
301
+ // /**
302
+ // * 根据内框内容高度,更新外框框体高度
303
+ // * @param innerRect
304
+ // */
305
+ // updateRenderHeight(innerRect: Rect | number): void {
306
+ // const innerHeight = typeof innerRect === 'number' ? innerRect : (<Rect>innerRect).height;
307
+ // const { padding, margin } = this;
308
+ // //外层容器高度等于内容高度+外边距+内边距
309
+ // this.rect.height = innerHeight + padding.top + padding.bottom;
310
+ // }
311
311
  getIndex() {
312
312
  if (this.parent) {
313
313
  return this.parent.getChildIndex(this);
@@ -411,10 +411,45 @@ class BranchRenderObject extends RenderObject {
411
411
  * 块级渲染元素
412
412
  */
413
413
  class BlockContentRenderObject extends BranchRenderObject {
414
+ margin;
415
+ padding;
416
+ constructor(element) {
417
+ super(element);
418
+ this.margin = new MarginProps();
419
+ this.padding = new PaddingProps();
420
+ }
414
421
  setRenderWidth(maxWidth) {
415
422
  //this.rect.maxWidth = maxWidth;
416
423
  this.rect.width = maxWidth;
417
424
  }
425
+ /**
426
+ * 获取内容区域框体
427
+ * @param render
428
+ * @returns
429
+ */
430
+ getInnerRect() {
431
+ const { padding } = this;
432
+ const rect = new Rect();
433
+ rect.x = padding.left;
434
+ rect.y = padding.top;
435
+ rect.width = this.rect.width - padding.left - padding.right;
436
+ rect.height = this.rect.height - padding.top - padding.bottom;
437
+ return rect;
438
+ }
439
+ getInnerMaxWidth() {
440
+ const { padding, margin } = this;
441
+ return this.rect.width - padding.left - padding.right - margin.left - margin.right;
442
+ }
443
+ /**
444
+ * 根据内框内容高度,更新外框框体高度
445
+ * @param innerRect
446
+ */
447
+ updateRenderHeight(innerRect) {
448
+ const innerHeight = typeof innerRect === 'number' ? innerRect : innerRect.height;
449
+ const { padding, margin } = this;
450
+ //外层容器高度等于内容高度+外边距+内边距
451
+ this.rect.height = innerHeight + padding.top + padding.bottom;
452
+ }
418
453
  }
419
454
  class InlineGroupRenderObject extends BranchRenderObject {
420
455
  }
@@ -422,10 +457,45 @@ class InlineGroupRenderObject extends BranchRenderObject {
422
457
  * 包含块级渲染元素的容器元素,例如body、table-cell等
423
458
  */
424
459
  class BlockContainerRenderObject extends BranchRenderObject {
460
+ margin;
461
+ padding;
462
+ constructor(element) {
463
+ super(element);
464
+ this.margin = new MarginProps();
465
+ this.padding = new PaddingProps();
466
+ }
425
467
  setRenderWidth(maxWidth) {
426
468
  //this.rect.maxWidth = maxWidth;
427
469
  this.rect.width = maxWidth;
428
470
  }
471
+ /**
472
+ * 获取内容区域框体
473
+ * @param render
474
+ * @returns
475
+ */
476
+ getInnerRect() {
477
+ const { padding } = this;
478
+ const rect = new Rect();
479
+ rect.x = padding.left;
480
+ rect.y = padding.top;
481
+ rect.width = this.rect.width - padding.left - padding.right;
482
+ rect.height = this.rect.height - padding.top - padding.bottom;
483
+ return rect;
484
+ }
485
+ getInnerMaxWidth() {
486
+ const { padding, margin } = this;
487
+ return this.rect.width - padding.left - padding.right - margin.left - margin.right;
488
+ }
489
+ /**
490
+ * 根据内框内容高度,更新外框框体高度
491
+ * @param innerRect
492
+ */
493
+ updateRenderHeight(innerRect) {
494
+ const innerHeight = typeof innerRect === 'number' ? innerRect : innerRect.height;
495
+ const { padding, margin } = this;
496
+ //外层容器高度等于内容高度+外边距+内边距
497
+ this.rect.height = innerHeight + padding.top + padding.bottom;
498
+ }
429
499
  }
430
500
  /**
431
501
  * 多级 ‘BlockLineRectRenderObject’ 包裹元素,例如 p、table
@@ -3110,9 +3180,12 @@ function parser(code, objects) {
3110
3180
  const identifierName = child['name'];
3111
3181
  if (identifierName.startsWith('$')) {
3112
3182
  //获取对象为"CallExpression", "MemberExpression"获取属性,例如$1.value
3113
- parent?.type;
3114
- `getObject('${identifierName.slice(1)})`;
3115
- child['name'] = `getObject('${identifierName.slice(1)}').value`;
3183
+ const type = parent?.type;
3184
+ let express = `getObject('${identifierName.slice(1)}')`;
3185
+ if (type !== 'MemberExpression') {
3186
+ express += '.value';
3187
+ }
3188
+ child['name'] = express;
3116
3189
  objects?.push(identifierName.slice(1));
3117
3190
  }
3118
3191
  }
@@ -3935,6 +4008,7 @@ class DocumentRenderObject extends BlockContainerRenderObject {
3935
4008
  const pageCorner = this.exportPageCornerHTML(event);
3936
4009
  const pageNum = this.exportPageNumHTML(event);
3937
4010
  const copyright = this.exportCopyRight(event);
4011
+ const defs = this.exportDefs();
3938
4012
  return {
3939
4013
  sel: "svg",
3940
4014
  isCompleted: true,
@@ -3949,7 +4023,7 @@ class DocumentRenderObject extends BlockContainerRenderObject {
3949
4023
  },
3950
4024
  },
3951
4025
  children: [
3952
- pageCorner, highlight, selection, ...CommonUtil.toArray(event.getChildNodes(this)), pageNum, copyright
4026
+ defs, pageCorner, highlight, selection, ...CommonUtil.toArray(event.getChildNodes(this)), pageNum, copyright
3953
4027
  ]
3954
4028
  };
3955
4029
  }
@@ -4016,6 +4090,34 @@ class DocumentRenderObject extends BlockContainerRenderObject {
4016
4090
  },
4017
4091
  };
4018
4092
  }
4093
+ exportDefs() {
4094
+ /**
4095
+ * <defs>
4096
+ <filter id="f1" x="0" y="0">
4097
+ <feGaussianBlur stdDeviation="0.5" result="blur" />
4098
+ <feMerge>
4099
+ <feMergeNode in="thicken" />
4100
+ <feMergeNode in="SourceGraphic" />
4101
+ </feMerge>
4102
+ </filter>
4103
+ </defs>
4104
+ */
4105
+ return {
4106
+ sel: 'defs',
4107
+ data: {
4108
+ ns: "http://www.w3.org/2000/svg",
4109
+ props: {
4110
+ innerHTML: `<filter id="t_bold" x="0" y="0">
4111
+ <feGaussianBlur stdDeviation="0.5" result="blur" />
4112
+ <feMerge>
4113
+ <feMergeNode in="thicken" />
4114
+ <feMergeNode in="SourceGraphic" />
4115
+ </feMerge>
4116
+ </filter>`
4117
+ }
4118
+ },
4119
+ };
4120
+ }
4019
4121
  }
4020
4122
  class DocumentFactory extends ElementFactory {
4021
4123
  match(type) {
@@ -4368,6 +4470,9 @@ class DataElementRenderObject extends InlineGroupRenderObject {
4368
4470
  const validateDataEle = (ele) => {
4369
4471
  return ele instanceof DataElementLeaf || ele instanceof DataElementInlineGroup;
4370
4472
  };
4473
+ const validateInlineDataEle = (ele) => {
4474
+ return ele instanceof DataElementInlineGroup;
4475
+ };
4371
4476
  const validateDataEleRenderObj = (renderObj) => {
4372
4477
  if (renderObj.element) {
4373
4478
  return validateDataEle(renderObj.element);
@@ -5145,9 +5250,7 @@ class TextGroupRenderObject extends LeafRenderObject {
5145
5250
  if (actualFontBoundingBoxAscent === undefined) {
5146
5251
  t.data.attrs['dominant-baseline'] = 'hanging';
5147
5252
  }
5148
- if (this.element.props.fontWeight !== 'normal') {
5149
- t.data.attrs['font-weight'] = this.element.props.fontWeight;
5150
- }
5253
+ if (this.element.props.fontWeight !== 'normal') ;
5151
5254
  if (this.element.props.fontStyle !== 'normal') {
5152
5255
  t.data.attrs['font-style'] = this.element.props.fontStyle;
5153
5256
  }
@@ -5177,6 +5280,42 @@ class TextGroupRenderObject extends LeafRenderObject {
5177
5280
  }
5178
5281
  //处理null-text
5179
5282
  if (this.element.isDecorate && this.element.disableClick && !this.element.parent) ;
5283
+ if (this.element.props.fontWeight === "bold") {
5284
+ const g = {
5285
+ sel: "g",
5286
+ data: {
5287
+ ns: "http://www.w3.org/2000/svg",
5288
+ attrs: {}
5289
+ },
5290
+ children: [
5291
+ {
5292
+ sel: "g",
5293
+ data: {
5294
+ ns: "http://www.w3.org/2000/svg",
5295
+ attrs: {
5296
+ translate: { x: 0, y: 0 }
5297
+ }
5298
+ },
5299
+ children: [
5300
+ { ...t }
5301
+ ]
5302
+ },
5303
+ {
5304
+ sel: "g",
5305
+ data: {
5306
+ ns: "http://www.w3.org/2000/svg",
5307
+ attrs: {
5308
+ translate: { x: 0.5, y: 0 }
5309
+ }
5310
+ },
5311
+ children: [
5312
+ { ...t }
5313
+ ]
5314
+ }
5315
+ ]
5316
+ };
5317
+ return g;
5318
+ }
5180
5319
  return t;
5181
5320
  }
5182
5321
  }
@@ -11047,8 +11186,10 @@ class SVGRenderObject extends ResizeLeafRenderObject {
11047
11186
  exportSVG(event) {
11048
11187
  const props = this.element.props;
11049
11188
  const t = super.exportSVG(event);
11050
- t.children = [ElementUtil.createSvgEle('svg', { width: this.rect.width,
11051
- height: this.rect.height }, ElementUtil.createSvgEle('image', {
11189
+ t.children = [ElementUtil.createSvgEle('svg', {
11190
+ width: this.rect.width,
11191
+ height: this.rect.height
11192
+ }, ElementUtil.createSvgEle('image', {
11052
11193
  "xlink:href": props.value,
11053
11194
  width: Math.min(this.rect.width, this.rect.height),
11054
11195
  height: Math.min(this.rect.width, this.rect.height)
@@ -11081,7 +11222,6 @@ class SVGFactory extends ElementFactory {
11081
11222
  picProps.height = props.height;
11082
11223
  picProps.value = props.value;
11083
11224
  picProps.title = props.title;
11084
- pic.props = picProps;
11085
11225
  return pic;
11086
11226
  }
11087
11227
  }
@@ -11716,12 +11856,18 @@ class ElementUtil {
11716
11856
  innerRect.height = 0;
11717
11857
  for (let i = 0; i < render.length; i++) {
11718
11858
  const line = render.getChild(i);
11859
+ let mt = 0;
11860
+ let mb = 0;
11861
+ if (line instanceof BlockContainerRenderObject || line instanceof BlockContentRenderObject) {
11862
+ mt = line.margin.top;
11863
+ mb = line.margin.bottom;
11864
+ }
11719
11865
  if (resetX) {
11720
11866
  line.rect.x = innerRect.x;
11721
11867
  }
11722
- line.rect.y = innerRect.height + innerRect.y + line.margin.top;
11868
+ line.rect.y = innerRect.height + innerRect.y + mt;
11723
11869
  this.setHorizontalAlign(line, innerRect);
11724
- innerRect.height += line.rect.height + line.margin.top + line.margin.bottom;
11870
+ innerRect.height += line.rect.height + mt + mb;
11725
11871
  }
11726
11872
  render.updateRenderHeight(innerRect);
11727
11873
  return innerRect.height;
@@ -14408,6 +14554,22 @@ class DynamicExecute {
14408
14554
  }
14409
14555
  return res;
14410
14556
  }
14557
+ /**
14558
+ * 获取元素的父表格行元素。
14559
+ *
14560
+ */
14561
+ CtxRow(ele) {
14562
+ // 使用ElementUtil的getParent方法来查找第一个实例化为TableRowElement的父元素
14563
+ return ElementUtil.getParent(ele, (item) => item instanceof TableRowElement);
14564
+ }
14565
+ /**
14566
+ * 获取元素的父表格行元素。
14567
+ *
14568
+ */
14569
+ CtxTable(ele) {
14570
+ // 使用ElementUtil的getParent方法来查找第一个实例化为TableElement的父元素
14571
+ return ElementUtil.getParent(ele, (item) => item instanceof TableElement);
14572
+ }
14411
14573
  }
14412
14574
 
14413
14575
  class ParagraphMeasure {
@@ -16303,6 +16465,7 @@ class DocumentEvent {
16303
16465
  subs = [];
16304
16466
  selectionState;
16305
16467
  viewOptions;
16468
+ prevTrackInfo = false;
16306
16469
  constructor(documentPaint, docCtx, documentInput) {
16307
16470
  this.documentPaint = documentPaint;
16308
16471
  this.docCtx = docCtx;
@@ -16379,6 +16542,7 @@ class DocumentEvent {
16379
16542
  }
16380
16543
  clear() {
16381
16544
  this.selectionState.clear();
16545
+ this.prevCursorItems.length = 0;
16382
16546
  this.startHitInfo = null;
16383
16547
  this.endHitInfo = null;
16384
16548
  this.focusedElement = null;
@@ -16439,7 +16603,6 @@ class DocumentEvent {
16439
16603
  viewEvt.globalX = evt.x / this.viewOptions.scale;
16440
16604
  viewEvt.globalY = evt.y / this.viewOptions.scale;
16441
16605
  }
16442
- prevTrackInfo = false;
16443
16606
  /**
16444
16607
  * 显示提示信息
16445
16608
  * 显示留痕提示信息等
@@ -17367,13 +17530,25 @@ class DocumentEvent {
17367
17530
  if (this.viewOptions.docMode !== exports.DocMode.FormEdit) {
17368
17531
  return;
17369
17532
  }
17370
- const currDataEle = this.getCurrentDataElement('free');
17371
- if (currDataEle) {
17372
- if (currDataEle instanceof DataElementLeaf) {
17373
- this.moveCursorToRightHandle(currDataEle, 1);
17374
- }
17375
- else {
17376
- this.moveCursorToRightHandle(currDataEle.endDecorate, 1);
17533
+ const currDataEle = this.getCurrentDataElement();
17534
+ //只处理内联数据元元素
17535
+ if (!currDataEle || !(currDataEle instanceof DataElementInlineGroup)) {
17536
+ return;
17537
+ }
17538
+ const ctx = this.docCtx.defaultCtx.ctx;
17539
+ //获取所有的段落
17540
+ const paras = ctx.treeFilter(item => item instanceof ParagraphElement);
17541
+ //当前段落
17542
+ let currPara = ElementUtil.getParentByType(currDataEle, ParagraphElement);
17543
+ for (let i = paras.indexOf(currPara); i < paras.length; i++) {
17544
+ const currPara = paras[i];
17545
+ let currParaDataEleList = currPara.treeFilter(item => validateInlineDataEle(item));
17546
+ for (let j = currParaDataEleList.indexOf(currDataEle) + 1; j < currParaDataEleList.length; j++) {
17547
+ const nextDataEle = currParaDataEleList[j];
17548
+ if (nextDataEle && ElementUtil.canSetCursor(nextDataEle.startDecorate, 1, true, this.viewOptions)) {
17549
+ this.selectionState.resetRange(nextDataEle.startDecorate, 1);
17550
+ return;
17551
+ }
17377
17552
  }
17378
17553
  }
17379
17554
  }
@@ -17529,7 +17704,7 @@ class DocumentEvent {
17529
17704
  * 获取当前光标所在的数据元
17530
17705
  * @returns
17531
17706
  */
17532
- getCurrentDataElement(mode = 'strict') {
17707
+ getCurrentDataElement() {
17533
17708
  const selectionState = this.selectionState;
17534
17709
  const { startControl, startOffset, collapsed, ancestorCommonControl } = selectionState;
17535
17710
  if (startControl && collapsed) {
@@ -17537,7 +17712,7 @@ class DocumentEvent {
17537
17712
  // return null;
17538
17713
  // }
17539
17714
  const dataEle = ElementUtil.getParent(startControl, validateDataEle);
17540
- if (dataEle instanceof DataElementLeaf || (mode === 'free' || IsInSideDataElement(startControl, startOffset))) {
17715
+ if (dataEle instanceof DataElementLeaf || IsInSideDataElement(startControl, startOffset)) {
17541
17716
  return dataEle;
17542
17717
  }
17543
17718
  else {
@@ -17550,10 +17725,18 @@ class DocumentEvent {
17550
17725
  return null;
17551
17726
  }
17552
17727
  /**
17553
- * 获取当前光标所在的数据组
17554
- * @returns
17555
- */
17556
- getCurrentDataGroupElement(mode = 'strict') {
17728
+ * 根据元素寻找所在的数据元
17729
+ * @param ele
17730
+ */
17731
+ getParentDataElement(ele) {
17732
+ const dataEle = ElementUtil.getParent(ele, validateDataEle);
17733
+ return dataEle;
17734
+ }
17735
+ /**
17736
+ * 获取当前光标所在的数据组
17737
+ * @returns
17738
+ */
17739
+ getCurrentDataGroupElement() {
17557
17740
  const selectionState = this.selectionState;
17558
17741
  const { startControl, startOffset, collapsed, ancestorCommonControl } = selectionState;
17559
17742
  if (startControl && collapsed) {
@@ -17561,7 +17744,7 @@ class DocumentEvent {
17561
17744
  // return null;
17562
17745
  // }
17563
17746
  const dataEle = ElementUtil.getParent(startControl, validateDataGroup);
17564
- if (mode === 'free' || IsInSideDataGroup(startControl, startOffset)) {
17747
+ if (IsInSideDataGroup(startControl, startOffset)) {
17565
17748
  return dataEle;
17566
17749
  }
17567
17750
  else {
@@ -19282,6 +19465,9 @@ class DocumentChange {
19282
19465
  * @param text
19283
19466
  */
19284
19467
  pastePlainText(text) {
19468
+ if (!text) {
19469
+ return;
19470
+ }
19285
19471
  const textItems = text.split(/\r?\n/);
19286
19472
  const { startControl, startOffset } = this.selectionState;
19287
19473
  if (this.viewOptions.docMode === exports.DocMode.FormEdit || textItems.length === 1 || IsInSideInlineGroupInputElement(startControl, startOffset)) {
@@ -22003,6 +22189,10 @@ class DocEditor {
22003
22189
  }
22004
22190
  this.trackChangeState = prev;
22005
22191
  }
22192
+ /**
22193
+ * 载入文档
22194
+ * @param data json对象、json字符串、DocumentElement对象
22195
+ */
22006
22196
  loadDoc(data) {
22007
22197
  suppressTracking(() => {
22008
22198
  this.noEffectChange(() => {
@@ -22010,6 +22200,8 @@ class DocEditor {
22010
22200
  this.elementReader.read(data);
22011
22201
  this.refreshDocument();
22012
22202
  this.historyMange.clear();
22203
+ this.documentEvent.clear();
22204
+ this.scrollToPosition({ x: 0, y: 0 });
22013
22205
  });
22014
22206
  });
22015
22207
  }
@@ -22228,7 +22420,7 @@ class DocEditor {
22228
22420
  return this.documentEvent.getCurrentDataElement();
22229
22421
  }
22230
22422
  /**
22231
- * 回去当前光标所在数据组
22423
+ * 获取当前光标所在数据组
22232
22424
  * @returns
22233
22425
  */
22234
22426
  getCurrentDataGroupElement() {
@@ -23166,7 +23358,7 @@ class DocEditor {
23166
23358
  if (parent) {
23167
23359
  const parentRect = parent.getBoundingClientRect();
23168
23360
  const elmRect = elm.getBoundingClientRect();
23169
- const top = parseInt(elm.style.top);
23361
+ parseInt(elm.style.top);
23170
23362
  // elmRect.width /= scale;
23171
23363
  // elmRect.height /= scale;
23172
23364
  // parentRect.width /= scale;
@@ -23177,21 +23369,7 @@ class DocEditor {
23177
23369
  if (elmRect.left < parentRect.left) {
23178
23370
  elm.style.left = (position.x - 10) + 'px';
23179
23371
  }
23180
- if (elmRect.right > parentRect.right) {
23181
- elm.style.left = (position.x - elmRect.width / scale + 10) + 'px';
23182
- //elm.style.left = parentRect.width - elmRect.width + 'px';
23183
- }
23184
- if (elmRect.top + elmRect.height > parentRect.top + parentRect.height) {
23185
- const newTop = top - 5 - position.height - elmRect.height;
23186
- position.y + 5 + position.height;
23187
- //计算前后的高度的差距,然后判断新的值是否在父元素的范围内,如果不在则使用旧的值
23188
- // if (newTop > 0 && oldTop - newTop < elmRect.top - parentRect.top) {
23189
- // elm.style.top = (position.y - position.height - elmRect.height) + 'px';
23190
- // }
23191
- elm.style.top = newTop + 'px';
23192
- //elm.style.top = (top - (elmRect.top + elmRect.height - (parentRect.top + parentRect.height))) + 'px';
23193
- //elm.style.top = (position.y - position.height - elmRect.height) + 'px';
23194
- }
23372
+ return;
23195
23373
  }
23196
23374
  }
23197
23375
  renderCalendar() {
@@ -23299,7 +23477,7 @@ class DocEditor {
23299
23477
  rule.setRuleOptions({ width: this.viewOptions.docPageSettings.width, pagePL, pagePR, docLeft });
23300
23478
  }
23301
23479
  version() {
23302
- return "2.2.32";
23480
+ return "2.2.34";
23303
23481
  }
23304
23482
  switchPageHeaderEditor() {
23305
23483
  this.docCtx.document.switchPageHeaderEditor(this.selectionState, null);
@@ -23752,7 +23930,9 @@ class DocumentEvalFunc {
23752
23930
  }
23753
23931
  }
23754
23932
 
23755
- function createPrintTemplate({ width, height, orient }) {
23933
+ function createPrintTemplate({ width, height, orient, printDOMStyle }) {
23934
+ //FIX:修复win7宋体加粗不生效的情况
23935
+ const printStyle = printDOMStyle ?? `text[font-weight="bold"][font-family="宋体"] {font-family: STSong;}`;
23756
23936
  return `
23757
23937
  <!DOCTYPE html>
23758
23938
  <html lang="zh">
@@ -23793,10 +23973,7 @@ function createPrintTemplate({ width, height, orient }) {
23793
23973
  width: initial;
23794
23974
  min-height: initial;
23795
23975
  }
23796
- text[font-weight="bold"][font-family="宋体"] {
23797
- font-family: STSong, 宋体;
23798
- -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;
23799
- }
23976
+ ${printStyle}
23800
23977
  }
23801
23978
  </style>
23802
23979
  </head>
@@ -23822,8 +23999,7 @@ function printNodes(printNodes, options, printEvent = null) {
23822
23999
  console.warn('无可打印节点');
23823
24000
  return;
23824
24001
  }
23825
- const printSize = options;
23826
- const iframeHTML = createPrintTemplate(printSize);
24002
+ const iframeHTML = createPrintTemplate(options);
23827
24003
  printIFrame.contentWindow?.document.write(iframeHTML);
23828
24004
  printIFrame.contentWindow?.document.close();
23829
24005
  for (let i = 0; i < printNodes.length; i++) {
@@ -28813,6 +28989,7 @@ class DocumentPrintOffscreenBase {
28813
28989
  afterRenderEvent = new Subject();
28814
28990
  beforePrint = new Subject();
28815
28991
  afterPrint = new Subject();
28992
+ printDOMStyle;
28816
28993
  constructor() {
28817
28994
  this.viewOptions = new ViewOptions();
28818
28995
  this.viewOptions.copyRightInfo = '';
@@ -28846,6 +29023,7 @@ class DocumentPrintOffscreenBase {
28846
29023
  return;
28847
29024
  }
28848
29025
  const docProps = this.docCtx.viewOptions.docPageSettings.clone();
29026
+ docProps['printDOMStyle'] = this.printDOMStyle;
28849
29027
  printNodes(canvasNodes, docProps, {
28850
29028
  beforePrint: () => this.beforePrint.next(),
28851
29029
  afterPrint: () => this.afterPrint.next()
@@ -28876,6 +29054,7 @@ class DocumentPrintOffscreenBase {
28876
29054
  return;
28877
29055
  }
28878
29056
  const docProps = this.docCtx.viewOptions.docPageSettings.clone();
29057
+ docProps['printDOMStyle'] = this.printDOMStyle;
28879
29058
  // if (docProps.orient === 'landscape') {
28880
29059
  // 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"/>`);
28881
29060
  // }
@@ -29342,6 +29521,7 @@ exports.updatePartialProps = updatePartialProps;
29342
29521
  exports.validateDataEle = validateDataEle;
29343
29522
  exports.validateDataEleRenderObj = validateDataEleRenderObj;
29344
29523
  exports.validateDataGroup = validateDataGroup;
29524
+ exports.validateInlineDataEle = validateInlineDataEle;
29345
29525
  exports.validateInlineInputRenderObj = validateInlineInputRenderObj;
29346
29526
  exports.watchChanged = watchChanged;
29347
29527
  //# sourceMappingURL=index-cjs.js.map