@hailin-zheng/editor-core 2.2.32 → 2.2.33
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 +9 -10
- package/index-cjs.js +197 -80
- package/index-cjs.js.map +1 -1
- package/index.js +197 -81
- package/index.js.map +1 -1
- package/med_editor/doc-editor.d.ts +5 -1
- package/med_editor/framework/code-interpreter/dynamic-execute.d.ts +11 -0
- package/med_editor/framework/document-event.d.ts +11 -6
- package/med_editor/framework/impl/data-element/data-element-base-impl.d.ts +1 -0
- package/med_editor/framework/print/document-print-offscreen.d.ts +1 -0
- package/med_editor/framework/print/document-print.d.ts +2 -1
- package/med_editor/framework/render-define.d.ts +30 -14
- package/med_editor/framework/util/element-util.d.ts +2 -2
- package/package.json +1 -1
package/editor.css
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
.svg-container {
|
2
|
-
background: #
|
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
|
-
|
286
|
-
|
287
|
-
|
288
|
-
getInnerRect() {
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
}
|
297
|
-
getInnerMaxWidth() {
|
298
|
-
|
299
|
-
|
300
|
-
}
|
301
|
-
/**
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
updateRenderHeight(innerRect) {
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
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
|
-
|
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
|
}
|
@@ -4368,6 +4441,9 @@ class DataElementRenderObject extends InlineGroupRenderObject {
|
|
4368
4441
|
const validateDataEle = (ele) => {
|
4369
4442
|
return ele instanceof DataElementLeaf || ele instanceof DataElementInlineGroup;
|
4370
4443
|
};
|
4444
|
+
const validateInlineDataEle = (ele) => {
|
4445
|
+
return ele instanceof DataElementInlineGroup;
|
4446
|
+
};
|
4371
4447
|
const validateDataEleRenderObj = (renderObj) => {
|
4372
4448
|
if (renderObj.element) {
|
4373
4449
|
return validateDataEle(renderObj.element);
|
@@ -11047,8 +11123,10 @@ class SVGRenderObject extends ResizeLeafRenderObject {
|
|
11047
11123
|
exportSVG(event) {
|
11048
11124
|
const props = this.element.props;
|
11049
11125
|
const t = super.exportSVG(event);
|
11050
|
-
t.children = [ElementUtil.createSvgEle('svg', {
|
11051
|
-
|
11126
|
+
t.children = [ElementUtil.createSvgEle('svg', {
|
11127
|
+
width: this.rect.width,
|
11128
|
+
height: this.rect.height
|
11129
|
+
}, ElementUtil.createSvgEle('image', {
|
11052
11130
|
"xlink:href": props.value,
|
11053
11131
|
width: Math.min(this.rect.width, this.rect.height),
|
11054
11132
|
height: Math.min(this.rect.width, this.rect.height)
|
@@ -11081,7 +11159,6 @@ class SVGFactory extends ElementFactory {
|
|
11081
11159
|
picProps.height = props.height;
|
11082
11160
|
picProps.value = props.value;
|
11083
11161
|
picProps.title = props.title;
|
11084
|
-
pic.props = picProps;
|
11085
11162
|
return pic;
|
11086
11163
|
}
|
11087
11164
|
}
|
@@ -11716,12 +11793,18 @@ class ElementUtil {
|
|
11716
11793
|
innerRect.height = 0;
|
11717
11794
|
for (let i = 0; i < render.length; i++) {
|
11718
11795
|
const line = render.getChild(i);
|
11796
|
+
let mt = 0;
|
11797
|
+
let mb = 0;
|
11798
|
+
if (line instanceof BlockContainerRenderObject || line instanceof BlockContentRenderObject) {
|
11799
|
+
mt = line.margin.top;
|
11800
|
+
mb = line.margin.bottom;
|
11801
|
+
}
|
11719
11802
|
if (resetX) {
|
11720
11803
|
line.rect.x = innerRect.x;
|
11721
11804
|
}
|
11722
|
-
line.rect.y = innerRect.height + innerRect.y +
|
11805
|
+
line.rect.y = innerRect.height + innerRect.y + mt;
|
11723
11806
|
this.setHorizontalAlign(line, innerRect);
|
11724
|
-
innerRect.height += line.rect.height +
|
11807
|
+
innerRect.height += line.rect.height + mt + mb;
|
11725
11808
|
}
|
11726
11809
|
render.updateRenderHeight(innerRect);
|
11727
11810
|
return innerRect.height;
|
@@ -14408,6 +14491,22 @@ class DynamicExecute {
|
|
14408
14491
|
}
|
14409
14492
|
return res;
|
14410
14493
|
}
|
14494
|
+
/**
|
14495
|
+
* 获取元素的父表格行元素。
|
14496
|
+
*
|
14497
|
+
*/
|
14498
|
+
CtxRow(ele) {
|
14499
|
+
// 使用ElementUtil的getParent方法来查找第一个实例化为TableRowElement的父元素
|
14500
|
+
return ElementUtil.getParent(ele, (item) => item instanceof TableRowElement);
|
14501
|
+
}
|
14502
|
+
/**
|
14503
|
+
* 获取元素的父表格行元素。
|
14504
|
+
*
|
14505
|
+
*/
|
14506
|
+
CtxTable(ele) {
|
14507
|
+
// 使用ElementUtil的getParent方法来查找第一个实例化为TableElement的父元素
|
14508
|
+
return ElementUtil.getParent(ele, (item) => item instanceof TableElement);
|
14509
|
+
}
|
14411
14510
|
}
|
14412
14511
|
|
14413
14512
|
class ParagraphMeasure {
|
@@ -16303,6 +16402,7 @@ class DocumentEvent {
|
|
16303
16402
|
subs = [];
|
16304
16403
|
selectionState;
|
16305
16404
|
viewOptions;
|
16405
|
+
prevTrackInfo = false;
|
16306
16406
|
constructor(documentPaint, docCtx, documentInput) {
|
16307
16407
|
this.documentPaint = documentPaint;
|
16308
16408
|
this.docCtx = docCtx;
|
@@ -16379,6 +16479,7 @@ class DocumentEvent {
|
|
16379
16479
|
}
|
16380
16480
|
clear() {
|
16381
16481
|
this.selectionState.clear();
|
16482
|
+
this.prevCursorItems.length = 0;
|
16382
16483
|
this.startHitInfo = null;
|
16383
16484
|
this.endHitInfo = null;
|
16384
16485
|
this.focusedElement = null;
|
@@ -16439,7 +16540,6 @@ class DocumentEvent {
|
|
16439
16540
|
viewEvt.globalX = evt.x / this.viewOptions.scale;
|
16440
16541
|
viewEvt.globalY = evt.y / this.viewOptions.scale;
|
16441
16542
|
}
|
16442
|
-
prevTrackInfo = false;
|
16443
16543
|
/**
|
16444
16544
|
* 显示提示信息
|
16445
16545
|
* 显示留痕提示信息等
|
@@ -17367,13 +17467,25 @@ class DocumentEvent {
|
|
17367
17467
|
if (this.viewOptions.docMode !== exports.DocMode.FormEdit) {
|
17368
17468
|
return;
|
17369
17469
|
}
|
17370
|
-
const currDataEle = this.getCurrentDataElement(
|
17371
|
-
|
17372
|
-
|
17373
|
-
|
17374
|
-
|
17375
|
-
|
17376
|
-
|
17470
|
+
const currDataEle = this.getCurrentDataElement();
|
17471
|
+
//只处理内联数据元元素
|
17472
|
+
if (!currDataEle || !(currDataEle instanceof DataElementInlineGroup)) {
|
17473
|
+
return;
|
17474
|
+
}
|
17475
|
+
const ctx = this.docCtx.defaultCtx.ctx;
|
17476
|
+
//获取所有的段落
|
17477
|
+
const paras = ctx.treeFilter(item => item instanceof ParagraphElement);
|
17478
|
+
//当前段落
|
17479
|
+
let currPara = ElementUtil.getParentByType(currDataEle, ParagraphElement);
|
17480
|
+
for (let i = paras.indexOf(currPara); i < paras.length; i++) {
|
17481
|
+
const currPara = paras[i];
|
17482
|
+
let currParaDataEleList = currPara.treeFilter(item => validateInlineDataEle(item));
|
17483
|
+
for (let j = currParaDataEleList.indexOf(currDataEle) + 1; j < currParaDataEleList.length; j++) {
|
17484
|
+
const nextDataEle = currParaDataEleList[j];
|
17485
|
+
if (nextDataEle && ElementUtil.canSetCursor(nextDataEle.startDecorate, 1, true, this.viewOptions)) {
|
17486
|
+
this.selectionState.resetRange(nextDataEle.startDecorate, 1);
|
17487
|
+
return;
|
17488
|
+
}
|
17377
17489
|
}
|
17378
17490
|
}
|
17379
17491
|
}
|
@@ -17529,7 +17641,7 @@ class DocumentEvent {
|
|
17529
17641
|
* 获取当前光标所在的数据元
|
17530
17642
|
* @returns
|
17531
17643
|
*/
|
17532
|
-
getCurrentDataElement(
|
17644
|
+
getCurrentDataElement() {
|
17533
17645
|
const selectionState = this.selectionState;
|
17534
17646
|
const { startControl, startOffset, collapsed, ancestorCommonControl } = selectionState;
|
17535
17647
|
if (startControl && collapsed) {
|
@@ -17537,7 +17649,7 @@ class DocumentEvent {
|
|
17537
17649
|
// return null;
|
17538
17650
|
// }
|
17539
17651
|
const dataEle = ElementUtil.getParent(startControl, validateDataEle);
|
17540
|
-
if (dataEle instanceof DataElementLeaf ||
|
17652
|
+
if (dataEle instanceof DataElementLeaf || IsInSideDataElement(startControl, startOffset)) {
|
17541
17653
|
return dataEle;
|
17542
17654
|
}
|
17543
17655
|
else {
|
@@ -17550,10 +17662,18 @@ class DocumentEvent {
|
|
17550
17662
|
return null;
|
17551
17663
|
}
|
17552
17664
|
/**
|
17553
|
-
|
17554
|
-
|
17555
|
-
|
17556
|
-
|
17665
|
+
* 根据元素寻找所在的数据元
|
17666
|
+
* @param ele
|
17667
|
+
*/
|
17668
|
+
getParentDataElement(ele) {
|
17669
|
+
const dataEle = ElementUtil.getParent(ele, validateDataEle);
|
17670
|
+
return dataEle;
|
17671
|
+
}
|
17672
|
+
/**
|
17673
|
+
* 获取当前光标所在的数据组
|
17674
|
+
* @returns
|
17675
|
+
*/
|
17676
|
+
getCurrentDataGroupElement() {
|
17557
17677
|
const selectionState = this.selectionState;
|
17558
17678
|
const { startControl, startOffset, collapsed, ancestorCommonControl } = selectionState;
|
17559
17679
|
if (startControl && collapsed) {
|
@@ -17561,7 +17681,7 @@ class DocumentEvent {
|
|
17561
17681
|
// return null;
|
17562
17682
|
// }
|
17563
17683
|
const dataEle = ElementUtil.getParent(startControl, validateDataGroup);
|
17564
|
-
if (
|
17684
|
+
if (IsInSideDataGroup(startControl, startOffset)) {
|
17565
17685
|
return dataEle;
|
17566
17686
|
}
|
17567
17687
|
else {
|
@@ -19282,6 +19402,9 @@ class DocumentChange {
|
|
19282
19402
|
* @param text
|
19283
19403
|
*/
|
19284
19404
|
pastePlainText(text) {
|
19405
|
+
if (!text) {
|
19406
|
+
return;
|
19407
|
+
}
|
19285
19408
|
const textItems = text.split(/\r?\n/);
|
19286
19409
|
const { startControl, startOffset } = this.selectionState;
|
19287
19410
|
if (this.viewOptions.docMode === exports.DocMode.FormEdit || textItems.length === 1 || IsInSideInlineGroupInputElement(startControl, startOffset)) {
|
@@ -22003,6 +22126,10 @@ class DocEditor {
|
|
22003
22126
|
}
|
22004
22127
|
this.trackChangeState = prev;
|
22005
22128
|
}
|
22129
|
+
/**
|
22130
|
+
* 载入文档
|
22131
|
+
* @param data json对象、json字符串、DocumentElement对象
|
22132
|
+
*/
|
22006
22133
|
loadDoc(data) {
|
22007
22134
|
suppressTracking(() => {
|
22008
22135
|
this.noEffectChange(() => {
|
@@ -22010,6 +22137,8 @@ class DocEditor {
|
|
22010
22137
|
this.elementReader.read(data);
|
22011
22138
|
this.refreshDocument();
|
22012
22139
|
this.historyMange.clear();
|
22140
|
+
this.documentEvent.clear();
|
22141
|
+
this.scrollToPosition({ x: 0, y: 0 });
|
22013
22142
|
});
|
22014
22143
|
});
|
22015
22144
|
}
|
@@ -22228,7 +22357,7 @@ class DocEditor {
|
|
22228
22357
|
return this.documentEvent.getCurrentDataElement();
|
22229
22358
|
}
|
22230
22359
|
/**
|
22231
|
-
*
|
22360
|
+
* 获取当前光标所在数据组
|
22232
22361
|
* @returns
|
22233
22362
|
*/
|
22234
22363
|
getCurrentDataGroupElement() {
|
@@ -23166,7 +23295,7 @@ class DocEditor {
|
|
23166
23295
|
if (parent) {
|
23167
23296
|
const parentRect = parent.getBoundingClientRect();
|
23168
23297
|
const elmRect = elm.getBoundingClientRect();
|
23169
|
-
|
23298
|
+
parseInt(elm.style.top);
|
23170
23299
|
// elmRect.width /= scale;
|
23171
23300
|
// elmRect.height /= scale;
|
23172
23301
|
// parentRect.width /= scale;
|
@@ -23177,21 +23306,7 @@ class DocEditor {
|
|
23177
23306
|
if (elmRect.left < parentRect.left) {
|
23178
23307
|
elm.style.left = (position.x - 10) + 'px';
|
23179
23308
|
}
|
23180
|
-
|
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
|
-
}
|
23309
|
+
return;
|
23195
23310
|
}
|
23196
23311
|
}
|
23197
23312
|
renderCalendar() {
|
@@ -23299,7 +23414,7 @@ class DocEditor {
|
|
23299
23414
|
rule.setRuleOptions({ width: this.viewOptions.docPageSettings.width, pagePL, pagePR, docLeft });
|
23300
23415
|
}
|
23301
23416
|
version() {
|
23302
|
-
return "2.2.
|
23417
|
+
return "2.2.33";
|
23303
23418
|
}
|
23304
23419
|
switchPageHeaderEditor() {
|
23305
23420
|
this.docCtx.document.switchPageHeaderEditor(this.selectionState, null);
|
@@ -23752,7 +23867,9 @@ class DocumentEvalFunc {
|
|
23752
23867
|
}
|
23753
23868
|
}
|
23754
23869
|
|
23755
|
-
function createPrintTemplate({ width, height, orient }) {
|
23870
|
+
function createPrintTemplate({ width, height, orient, printDOMStyle }) {
|
23871
|
+
//FIX:修复win7宋体加粗不生效的情况
|
23872
|
+
const printStyle = printDOMStyle ?? `text[font-weight="bold"][font-family="宋体"] {font-family: STSong;}`;
|
23756
23873
|
return `
|
23757
23874
|
<!DOCTYPE html>
|
23758
23875
|
<html lang="zh">
|
@@ -23793,10 +23910,7 @@ function createPrintTemplate({ width, height, orient }) {
|
|
23793
23910
|
width: initial;
|
23794
23911
|
min-height: initial;
|
23795
23912
|
}
|
23796
|
-
|
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
|
-
}
|
23913
|
+
${printStyle}
|
23800
23914
|
}
|
23801
23915
|
</style>
|
23802
23916
|
</head>
|
@@ -23822,8 +23936,7 @@ function printNodes(printNodes, options, printEvent = null) {
|
|
23822
23936
|
console.warn('无可打印节点');
|
23823
23937
|
return;
|
23824
23938
|
}
|
23825
|
-
const
|
23826
|
-
const iframeHTML = createPrintTemplate(printSize);
|
23939
|
+
const iframeHTML = createPrintTemplate(options);
|
23827
23940
|
printIFrame.contentWindow?.document.write(iframeHTML);
|
23828
23941
|
printIFrame.contentWindow?.document.close();
|
23829
23942
|
for (let i = 0; i < printNodes.length; i++) {
|
@@ -28813,6 +28926,7 @@ class DocumentPrintOffscreenBase {
|
|
28813
28926
|
afterRenderEvent = new Subject();
|
28814
28927
|
beforePrint = new Subject();
|
28815
28928
|
afterPrint = new Subject();
|
28929
|
+
printDOMStyle;
|
28816
28930
|
constructor() {
|
28817
28931
|
this.viewOptions = new ViewOptions();
|
28818
28932
|
this.viewOptions.copyRightInfo = '';
|
@@ -28846,6 +28960,7 @@ class DocumentPrintOffscreenBase {
|
|
28846
28960
|
return;
|
28847
28961
|
}
|
28848
28962
|
const docProps = this.docCtx.viewOptions.docPageSettings.clone();
|
28963
|
+
docProps['printDOMStyle'] = this.printDOMStyle;
|
28849
28964
|
printNodes(canvasNodes, docProps, {
|
28850
28965
|
beforePrint: () => this.beforePrint.next(),
|
28851
28966
|
afterPrint: () => this.afterPrint.next()
|
@@ -28876,6 +28991,7 @@ class DocumentPrintOffscreenBase {
|
|
28876
28991
|
return;
|
28877
28992
|
}
|
28878
28993
|
const docProps = this.docCtx.viewOptions.docPageSettings.clone();
|
28994
|
+
docProps['printDOMStyle'] = this.printDOMStyle;
|
28879
28995
|
// if (docProps.orient === 'landscape') {
|
28880
28996
|
// 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
28997
|
// }
|
@@ -29342,6 +29458,7 @@ exports.updatePartialProps = updatePartialProps;
|
|
29342
29458
|
exports.validateDataEle = validateDataEle;
|
29343
29459
|
exports.validateDataEleRenderObj = validateDataEleRenderObj;
|
29344
29460
|
exports.validateDataGroup = validateDataGroup;
|
29461
|
+
exports.validateInlineDataEle = validateInlineDataEle;
|
29345
29462
|
exports.validateInlineInputRenderObj = validateInlineInputRenderObj;
|
29346
29463
|
exports.watchChanged = watchChanged;
|
29347
29464
|
//# sourceMappingURL=index-cjs.js.map
|