@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-cjs.js
CHANGED
@@ -1937,6 +1937,7 @@ class DocumentProps extends INotifyPropertyChanged {
|
|
1937
1937
|
createUserName;
|
1938
1938
|
createDate;
|
1939
1939
|
scripts;
|
1940
|
+
columns = 1;
|
1940
1941
|
clone(dest) {
|
1941
1942
|
const clone = dest ?? new DocumentProps();
|
1942
1943
|
super.cloneAttachedProperty(clone);
|
@@ -1950,6 +1951,7 @@ class DocumentProps extends INotifyPropertyChanged {
|
|
1950
1951
|
clone.createUserName = this.createUserName;
|
1951
1952
|
clone.createDate = this.createDate;
|
1952
1953
|
clone.orient = this.orient;
|
1954
|
+
clone.columns = this.columns;
|
1953
1955
|
return clone;
|
1954
1956
|
}
|
1955
1957
|
getSerializeProps() {
|
@@ -1969,6 +1971,9 @@ class DocumentProps extends INotifyPropertyChanged {
|
|
1969
1971
|
if (this.orient && this.orient !== 'portrait') {
|
1970
1972
|
props['orient'] = this.orient;
|
1971
1973
|
}
|
1974
|
+
if (this.columns !== 1) {
|
1975
|
+
props.columns = this.columns;
|
1976
|
+
}
|
1972
1977
|
return props;
|
1973
1978
|
}
|
1974
1979
|
}
|
@@ -3498,6 +3503,7 @@ class DocumentFactory extends ElementFactory {
|
|
3498
3503
|
docProps.createUserName = props.createUserName;
|
3499
3504
|
docProps.createDate = props.createDate;
|
3500
3505
|
docProps.orient = props.orient ?? 'portrait';
|
3506
|
+
docProps.columns = props.columns ?? 1;
|
3501
3507
|
return documentElement;
|
3502
3508
|
}
|
3503
3509
|
}
|
@@ -4229,10 +4235,10 @@ class DocumentHeaderRenderObject extends BlockContainerRenderObject {
|
|
4229
4235
|
}
|
4230
4236
|
exportHTML(event) {
|
4231
4237
|
//判断页眉是否为输入内容
|
4232
|
-
|
4238
|
+
ElementUtil.checkEmptyRenderContent(this);
|
4233
4239
|
let headerLine;
|
4234
4240
|
//存在输入内容时,绘制页眉-页体分割线
|
4235
|
-
if (
|
4241
|
+
if (event.options.printHeaderFooterLine) {
|
4236
4242
|
headerLine = {
|
4237
4243
|
sel: 'path',
|
4238
4244
|
data: {
|
@@ -5038,6 +5044,7 @@ class SelectionState {
|
|
5038
5044
|
this.clear();
|
5039
5045
|
}
|
5040
5046
|
clear() {
|
5047
|
+
this.rangeDirty = true;
|
5041
5048
|
this.range = null;
|
5042
5049
|
this.startOffset = -1;
|
5043
5050
|
this.endOffset = -1;
|
@@ -8343,6 +8350,7 @@ class DataElementCheck extends DataElementLeaf {
|
|
8343
8350
|
}
|
8344
8351
|
//如果当前是单选框并且当前已经被选中,则不作处理
|
8345
8352
|
if (this.props.groupName && !this.props.multiSelect && this.props.checked) {
|
8353
|
+
this.props.checked = !this.props.checked;
|
8346
8354
|
return;
|
8347
8355
|
}
|
8348
8356
|
this.props.checked = !this.props.checked;
|
@@ -14425,17 +14433,22 @@ class DocumentArrange {
|
|
14425
14433
|
docRender.padding.top = bodyMarginTop;
|
14426
14434
|
docRender.padding.bottom = bodyMarginBottom;
|
14427
14435
|
const bodyLimitRect = this.getDocInnerRect(docRender);
|
14436
|
+
const docColumns = doc.props.columns ?? 1;
|
14437
|
+
bodyLimitRect.width = bodyLimitRect.width / docColumns;
|
14428
14438
|
const bodyRender = doc.bodyElement.createRenderObject();
|
14429
14439
|
const bodyArray = [];
|
14430
14440
|
let { emptyBody: pageBodyRender, innerRect: bodyInnerLimitRect } = this.createEmptyBodyRender(bodyRender, bodyLimitRect);
|
14431
14441
|
bodyArray.push(pageBodyRender);
|
14442
|
+
//文档分栏
|
14432
14443
|
const createBodyHolder = () => {
|
14433
|
-
|
14444
|
+
let { emptyBody, innerRect } = this.createEmptyBodyRender(bodyRender, bodyLimitRect);
|
14434
14445
|
pageBodyRender = emptyBody;
|
14435
14446
|
bodyInnerLimitRect = innerRect;
|
14436
14447
|
bodyArray.push(pageBodyRender);
|
14437
14448
|
};
|
14438
14449
|
const appendToBody = (item) => {
|
14450
|
+
//处理分栏
|
14451
|
+
//item.rect.x = bodyInnerLimitRect.width *currColumn / docColumns;
|
14439
14452
|
item.rect.y = bodyInnerLimitRect.height + item.margin.top;
|
14440
14453
|
pageBodyRender.addChild(item);
|
14441
14454
|
bodyInnerLimitRect.height += item.rect.height + item.margin.top + item.margin.bottom;
|
@@ -14476,30 +14489,35 @@ class DocumentArrange {
|
|
14476
14489
|
}
|
14477
14490
|
const docPages = [];
|
14478
14491
|
let pageY = this.options.docSpace;
|
14492
|
+
//当前分栏
|
14493
|
+
let currColumn = 0;
|
14494
|
+
let prevDocRender = null;
|
14479
14495
|
for (let i = 0; i < bodyArray.length; i++) {
|
14480
14496
|
const body = bodyArray[i];
|
14481
|
-
|
14482
|
-
|
14483
|
-
|
14497
|
+
if (!prevDocRender) {
|
14498
|
+
prevDocRender = doc.createRenderObject();
|
14499
|
+
prevDocRender.rect.y = pageY;
|
14500
|
+
docPages.push(prevDocRender);
|
14501
|
+
}
|
14502
|
+
const documentRender = prevDocRender;
|
14484
14503
|
const limitRect = documentRender.getInnerRect();
|
14485
14504
|
const cloneHeaderRender = headerRender.clone();
|
14486
14505
|
cloneHeaderRender.rect.x = limitRect.x;
|
14487
14506
|
cloneHeaderRender.rect.y = headerLine;
|
14488
|
-
documentRender.addChild(cloneHeaderRender);
|
14489
|
-
body.rect.x = limitRect.x;
|
14507
|
+
currColumn === 0 && documentRender.addChild(cloneHeaderRender);
|
14508
|
+
body.rect.x = limitRect.x + bodyLimitRect.width * currColumn;
|
14490
14509
|
body.rect.y = bodyMarginTop;
|
14491
|
-
if (!this.options.fullPageView) {
|
14510
|
+
if (!this.options.fullPageView || docColumns > 1) {
|
14492
14511
|
body.rect.height = bodyInnerLimitRect.maxHeight;
|
14493
14512
|
}
|
14494
14513
|
else {
|
14495
14514
|
documentRender.rect.height = body.rect.height + body.rect.y + bodyMarginBottom;
|
14496
14515
|
}
|
14497
14516
|
documentRender.addChild(body);
|
14498
|
-
pageY += documentRender.rect.height + this.options.docSpace;
|
14499
14517
|
const cloneFooterRender = footerRender.clone();
|
14500
14518
|
cloneFooterRender.rect.x = limitRect.x;
|
14501
14519
|
cloneFooterRender.rect.y = documentRender.rect.height - bodyMarginBottom;
|
14502
|
-
documentRender.addChild(cloneFooterRender);
|
14520
|
+
currColumn === 0 && documentRender.addChild(cloneFooterRender);
|
14503
14521
|
//审阅模式,添加审阅窗口
|
14504
14522
|
if (this.options.showReviewWindow && commentsRender) {
|
14505
14523
|
const commentsContainer = this.createRenderObject(commentsRender.element);
|
@@ -14509,6 +14527,12 @@ class DocumentArrange {
|
|
14509
14527
|
commentsContainer.rect.x = documentRender.rect.x + documentRender.rect.width;
|
14510
14528
|
documentRender.rect.width += this.options.reviewWindowWidth;
|
14511
14529
|
}
|
14530
|
+
currColumn++;
|
14531
|
+
if (currColumn === docColumns) {
|
14532
|
+
currColumn = 0;
|
14533
|
+
prevDocRender = null;
|
14534
|
+
pageY += documentRender.rect.height + this.options.docSpace;
|
14535
|
+
}
|
14512
14536
|
}
|
14513
14537
|
return docPages;
|
14514
14538
|
}
|