@hailin-zheng/editor-core 2.0.18 → 2.0.19
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-cjs.js +35 -11
- package/index-cjs.js.map +1 -1
- package/index.js +35 -11
- package/index.js.map +1 -1
- package/med_editor/framework/element-props.d.ts +1 -0
- package/package.json +1 -1
package/index.js
CHANGED
@@ -1907,6 +1907,7 @@ class DocumentProps extends INotifyPropertyChanged {
|
|
1907
1907
|
createUserName;
|
1908
1908
|
createDate;
|
1909
1909
|
scripts;
|
1910
|
+
columns = 1;
|
1910
1911
|
clone(dest) {
|
1911
1912
|
const clone = dest ?? new DocumentProps();
|
1912
1913
|
super.cloneAttachedProperty(clone);
|
@@ -1920,6 +1921,7 @@ class DocumentProps extends INotifyPropertyChanged {
|
|
1920
1921
|
clone.createUserName = this.createUserName;
|
1921
1922
|
clone.createDate = this.createDate;
|
1922
1923
|
clone.orient = this.orient;
|
1924
|
+
clone.columns = this.columns;
|
1923
1925
|
return clone;
|
1924
1926
|
}
|
1925
1927
|
getSerializeProps() {
|
@@ -1939,6 +1941,9 @@ class DocumentProps extends INotifyPropertyChanged {
|
|
1939
1941
|
if (this.orient && this.orient !== 'portrait') {
|
1940
1942
|
props['orient'] = this.orient;
|
1941
1943
|
}
|
1944
|
+
if (this.columns !== 1) {
|
1945
|
+
props.columns = this.columns;
|
1946
|
+
}
|
1942
1947
|
return props;
|
1943
1948
|
}
|
1944
1949
|
}
|
@@ -3468,6 +3473,7 @@ class DocumentFactory extends ElementFactory {
|
|
3468
3473
|
docProps.createUserName = props.createUserName;
|
3469
3474
|
docProps.createDate = props.createDate;
|
3470
3475
|
docProps.orient = props.orient ?? 'portrait';
|
3476
|
+
docProps.columns = props.columns ?? 1;
|
3471
3477
|
return documentElement;
|
3472
3478
|
}
|
3473
3479
|
}
|
@@ -4199,10 +4205,10 @@ class DocumentHeaderRenderObject extends BlockContainerRenderObject {
|
|
4199
4205
|
}
|
4200
4206
|
exportHTML(event) {
|
4201
4207
|
//判断页眉是否为输入内容
|
4202
|
-
|
4208
|
+
ElementUtil.checkEmptyRenderContent(this);
|
4203
4209
|
let headerLine;
|
4204
4210
|
//存在输入内容时,绘制页眉-页体分割线
|
4205
|
-
if (
|
4211
|
+
if (event.options.printHeaderFooterLine) {
|
4206
4212
|
headerLine = {
|
4207
4213
|
sel: 'path',
|
4208
4214
|
data: {
|
@@ -5008,6 +5014,7 @@ class SelectionState {
|
|
5008
5014
|
this.clear();
|
5009
5015
|
}
|
5010
5016
|
clear() {
|
5017
|
+
this.rangeDirty = true;
|
5011
5018
|
this.range = null;
|
5012
5019
|
this.startOffset = -1;
|
5013
5020
|
this.endOffset = -1;
|
@@ -8313,6 +8320,7 @@ class DataElementCheck extends DataElementLeaf {
|
|
8313
8320
|
}
|
8314
8321
|
//如果当前是单选框并且当前已经被选中,则不作处理
|
8315
8322
|
if (this.props.groupName && !this.props.multiSelect && this.props.checked) {
|
8323
|
+
this.props.checked = !this.props.checked;
|
8316
8324
|
return;
|
8317
8325
|
}
|
8318
8326
|
this.props.checked = !this.props.checked;
|
@@ -14395,17 +14403,22 @@ class DocumentArrange {
|
|
14395
14403
|
docRender.padding.top = bodyMarginTop;
|
14396
14404
|
docRender.padding.bottom = bodyMarginBottom;
|
14397
14405
|
const bodyLimitRect = this.getDocInnerRect(docRender);
|
14406
|
+
const docColumns = doc.props.columns ?? 1;
|
14407
|
+
bodyLimitRect.width = bodyLimitRect.width / docColumns;
|
14398
14408
|
const bodyRender = doc.bodyElement.createRenderObject();
|
14399
14409
|
const bodyArray = [];
|
14400
14410
|
let { emptyBody: pageBodyRender, innerRect: bodyInnerLimitRect } = this.createEmptyBodyRender(bodyRender, bodyLimitRect);
|
14401
14411
|
bodyArray.push(pageBodyRender);
|
14412
|
+
//文档分栏
|
14402
14413
|
const createBodyHolder = () => {
|
14403
|
-
|
14414
|
+
let { emptyBody, innerRect } = this.createEmptyBodyRender(bodyRender, bodyLimitRect);
|
14404
14415
|
pageBodyRender = emptyBody;
|
14405
14416
|
bodyInnerLimitRect = innerRect;
|
14406
14417
|
bodyArray.push(pageBodyRender);
|
14407
14418
|
};
|
14408
14419
|
const appendToBody = (item) => {
|
14420
|
+
//处理分栏
|
14421
|
+
//item.rect.x = bodyInnerLimitRect.width *currColumn / docColumns;
|
14409
14422
|
item.rect.y = bodyInnerLimitRect.height + item.margin.top;
|
14410
14423
|
pageBodyRender.addChild(item);
|
14411
14424
|
bodyInnerLimitRect.height += item.rect.height + item.margin.top + item.margin.bottom;
|
@@ -14446,30 +14459,35 @@ class DocumentArrange {
|
|
14446
14459
|
}
|
14447
14460
|
const docPages = [];
|
14448
14461
|
let pageY = this.options.docSpace;
|
14462
|
+
//当前分栏
|
14463
|
+
let currColumn = 0;
|
14464
|
+
let prevDocRender = null;
|
14449
14465
|
for (let i = 0; i < bodyArray.length; i++) {
|
14450
14466
|
const body = bodyArray[i];
|
14451
|
-
|
14452
|
-
|
14453
|
-
|
14467
|
+
if (!prevDocRender) {
|
14468
|
+
prevDocRender = doc.createRenderObject();
|
14469
|
+
prevDocRender.rect.y = pageY;
|
14470
|
+
docPages.push(prevDocRender);
|
14471
|
+
}
|
14472
|
+
const documentRender = prevDocRender;
|
14454
14473
|
const limitRect = documentRender.getInnerRect();
|
14455
14474
|
const cloneHeaderRender = headerRender.clone();
|
14456
14475
|
cloneHeaderRender.rect.x = limitRect.x;
|
14457
14476
|
cloneHeaderRender.rect.y = headerLine;
|
14458
|
-
documentRender.addChild(cloneHeaderRender);
|
14459
|
-
body.rect.x = limitRect.x;
|
14477
|
+
currColumn === 0 && documentRender.addChild(cloneHeaderRender);
|
14478
|
+
body.rect.x = limitRect.x + bodyLimitRect.width * currColumn;
|
14460
14479
|
body.rect.y = bodyMarginTop;
|
14461
|
-
if (!this.options.fullPageView) {
|
14480
|
+
if (!this.options.fullPageView || docColumns > 1) {
|
14462
14481
|
body.rect.height = bodyInnerLimitRect.maxHeight;
|
14463
14482
|
}
|
14464
14483
|
else {
|
14465
14484
|
documentRender.rect.height = body.rect.height + body.rect.y + bodyMarginBottom;
|
14466
14485
|
}
|
14467
14486
|
documentRender.addChild(body);
|
14468
|
-
pageY += documentRender.rect.height + this.options.docSpace;
|
14469
14487
|
const cloneFooterRender = footerRender.clone();
|
14470
14488
|
cloneFooterRender.rect.x = limitRect.x;
|
14471
14489
|
cloneFooterRender.rect.y = documentRender.rect.height - bodyMarginBottom;
|
14472
|
-
documentRender.addChild(cloneFooterRender);
|
14490
|
+
currColumn === 0 && documentRender.addChild(cloneFooterRender);
|
14473
14491
|
//审阅模式,添加审阅窗口
|
14474
14492
|
if (this.options.showReviewWindow && commentsRender) {
|
14475
14493
|
const commentsContainer = this.createRenderObject(commentsRender.element);
|
@@ -14479,6 +14497,12 @@ class DocumentArrange {
|
|
14479
14497
|
commentsContainer.rect.x = documentRender.rect.x + documentRender.rect.width;
|
14480
14498
|
documentRender.rect.width += this.options.reviewWindowWidth;
|
14481
14499
|
}
|
14500
|
+
currColumn++;
|
14501
|
+
if (currColumn === docColumns) {
|
14502
|
+
currColumn = 0;
|
14503
|
+
prevDocRender = null;
|
14504
|
+
pageY += documentRender.rect.height + this.options.docSpace;
|
14505
|
+
}
|
14482
14506
|
}
|
14483
14507
|
return docPages;
|
14484
14508
|
}
|