@hailin-zheng/editor-core 2.0.14 → 2.0.16
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 +204 -84
- package/index-cjs.js.map +1 -1
- package/index.js +204 -84
- package/index.js.map +1 -1
- package/med_editor/doc-editor.d.ts +4 -2
- package/med_editor/framework/document-event.d.ts +8 -0
- package/med_editor/framework/document-template.d.ts +9 -0
- package/med_editor/framework/element-util.d.ts +6 -0
- package/med_editor/framework/impl/table/table-util.d.ts +10 -0
- package/package.json +1 -1
- package/med_editor/framework/document-restriction.d.ts +0 -17
package/index-cjs.js
CHANGED
@@ -2771,6 +2771,7 @@ class DataDecorateElement extends LeafElement {
|
|
2771
2771
|
}
|
2772
2772
|
}
|
2773
2773
|
});
|
2774
|
+
this.disableClick = !isPrefix;
|
2774
2775
|
this.isDecorate = true;
|
2775
2776
|
}
|
2776
2777
|
createRenderObject() {
|
@@ -3388,7 +3389,6 @@ class DocumentRenderObject extends BlockContainerRenderObject {
|
|
3388
3389
|
'font-family': '仿宋',
|
3389
3390
|
'font-size': '14',
|
3390
3391
|
"fill": this.element.props.color,
|
3391
|
-
'font-style': 'italic',
|
3392
3392
|
x: 0,
|
3393
3393
|
y: 0,
|
3394
3394
|
}
|
@@ -4279,7 +4279,7 @@ class PSymbolElement extends LeafElement {
|
|
4279
4279
|
createRenderObject() {
|
4280
4280
|
const symbol = new PSymbolRenderObject(this);
|
4281
4281
|
symbol.rect.height = this.defaultHeight;
|
4282
|
-
symbol.rect.width =
|
4282
|
+
symbol.rect.width = 1;
|
4283
4283
|
return symbol;
|
4284
4284
|
}
|
4285
4285
|
serialize() {
|
@@ -4810,45 +4810,27 @@ class TextGroupRenderObject extends LeafRenderObject {
|
|
4810
4810
|
if (this.element.props.background) {
|
4811
4811
|
const bgX = event.relativePagePos.x;
|
4812
4812
|
const bgY = event.relativePagePos.y;
|
4813
|
-
event.highlights.push(
|
4814
|
-
sel: 'path',
|
4815
|
-
data: {
|
4816
|
-
ns: "http://www.w3.org/2000/svg",
|
4817
|
-
attrs: {
|
4818
|
-
d: `M${bgX} ${bgY} h${width} v${this.rect.height} h-${width}z`,
|
4819
|
-
fill: this.element.props.background,
|
4820
|
-
}
|
4821
|
-
}
|
4822
|
-
});
|
4813
|
+
event.highlights.push(ElementUtil.getFillSvgRect(bgX, bgY, this.rect.width, this.rect.height, this.element.props.background));
|
4823
4814
|
}
|
4824
4815
|
if (this.element.props.underline) {
|
4825
4816
|
const underHeight = this.element.props.fontSize * 1.2;
|
4826
|
-
event.
|
4827
|
-
|
4828
|
-
data: {
|
4829
|
-
ns: "http://www.w3.org/2000/svg",
|
4830
|
-
attrs: {
|
4831
|
-
d: `M${event.relativePagePos.x} ${event.relativePagePos.y + underHeight} L${event.relativePagePos.x + this.rect.width} ${event.relativePagePos.y + underHeight}`,
|
4832
|
-
stroke: '#000',
|
4833
|
-
'stroke-width': 1,
|
4834
|
-
fill: 'none'
|
4835
|
-
}
|
4836
|
-
}
|
4837
|
-
});
|
4817
|
+
const path = `M${event.relativePagePos.x} ${event.relativePagePos.y + underHeight} L${event.relativePagePos.x + this.rect.width} ${event.relativePagePos.y + underHeight}`;
|
4818
|
+
event.highlights.push(ElementUtil.getStrokeSvgPath(path, '#000', 1));
|
4838
4819
|
}
|
4839
4820
|
if (this.element.props.linethrough) {
|
4840
|
-
event.
|
4841
|
-
|
4842
|
-
|
4843
|
-
|
4844
|
-
|
4845
|
-
|
4846
|
-
|
4847
|
-
|
4848
|
-
|
4849
|
-
|
4850
|
-
|
4851
|
-
|
4821
|
+
const path = `M${event.relativePagePos.x} ${event.relativePagePos.y + this.rect.height / 2} L${event.relativePagePos.x + this.rect.width} ${event.relativePagePos.y + this.rect.height / 2}`;
|
4822
|
+
event.highlights.push(ElementUtil.getStrokeSvgPath(path, '#000', 1));
|
4823
|
+
}
|
4824
|
+
if (this.element.props.border) {
|
4825
|
+
event.highlights.push(ElementUtil.getStrokeSvgPath(ElementUtil.getRectPath(event.relativePagePos.x, event.relativePagePos.y, this.rect.width, this.rect.height), '#000', 1));
|
4826
|
+
}
|
4827
|
+
if (this.element.props.overline) {
|
4828
|
+
const path = `M${event.relativePagePos.x} ${event.relativePagePos.y} L${event.relativePagePos.x + this.rect.width} ${event.relativePagePos.y}`;
|
4829
|
+
event.highlights.push(ElementUtil.getStrokeSvgPath(path, '#000', 1));
|
4830
|
+
}
|
4831
|
+
//处理null-text
|
4832
|
+
if (this.element.isDecorate && this.element.disableClick && !this.element.parent) {
|
4833
|
+
t.data.attrs['opacity'] = '0.58';
|
4852
4834
|
}
|
4853
4835
|
return t;
|
4854
4836
|
}
|
@@ -5121,10 +5103,7 @@ class SelectionRange {
|
|
5121
5103
|
}
|
5122
5104
|
setInfo(control, offset) {
|
5123
5105
|
if (control instanceof LeafElement) {
|
5124
|
-
|
5125
|
-
offset = offset === -1 ? control.text.length : offset;
|
5126
|
-
}
|
5127
|
-
offset = offset === -1 ? 1 : offset;
|
5106
|
+
offset = ElementUtil.fixedOffset(control, offset);
|
5128
5107
|
return { control, offset };
|
5129
5108
|
}
|
5130
5109
|
else if (control instanceof BranchElement) {
|
@@ -6323,6 +6302,40 @@ class TableUtil {
|
|
6323
6302
|
});
|
6324
6303
|
}
|
6325
6304
|
}
|
6305
|
+
static getTableData(tb) {
|
6306
|
+
//根据实际要提取的行索引进行调整
|
6307
|
+
const rowData = [];
|
6308
|
+
for (let i = 0; i < tb.length; i++) {
|
6309
|
+
const row = tb.getChild(i);
|
6310
|
+
const cellData = [];
|
6311
|
+
for (let j = 0; j < row.length; j++) {
|
6312
|
+
const cell = row.getChild(j);
|
6313
|
+
cellData.push(this.getCellData(cell));
|
6314
|
+
}
|
6315
|
+
rowData.push(cellData);
|
6316
|
+
}
|
6317
|
+
return rowData;
|
6318
|
+
}
|
6319
|
+
/**
|
6320
|
+
* 获取单元格内的数据元的值
|
6321
|
+
* @param target
|
6322
|
+
*/
|
6323
|
+
static getCellData(target) {
|
6324
|
+
if (validateDataEle(target)) {
|
6325
|
+
const dataEle = target;
|
6326
|
+
return { id: dataEle.props.id, value: dataEle.getValue() };
|
6327
|
+
}
|
6328
|
+
if (target instanceof BranchElement) {
|
6329
|
+
for (let i = 0; i < target.length; i++) {
|
6330
|
+
const child = target.getChild(i);
|
6331
|
+
const val = this.getCellData(child);
|
6332
|
+
if (val !== null) {
|
6333
|
+
return val;
|
6334
|
+
}
|
6335
|
+
}
|
6336
|
+
}
|
6337
|
+
return null;
|
6338
|
+
}
|
6326
6339
|
}
|
6327
6340
|
|
6328
6341
|
class TableElement extends BlockContainerElement {
|
@@ -8703,6 +8716,46 @@ class ElementUtil {
|
|
8703
8716
|
]
|
8704
8717
|
};
|
8705
8718
|
}
|
8719
|
+
/**
|
8720
|
+
* 判断是否光标可以设置接受编辑
|
8721
|
+
* @returns
|
8722
|
+
*/
|
8723
|
+
static canSetCursor(startControl, startOffset, editable, viewOptions) {
|
8724
|
+
if (!startControl || !editable) {
|
8725
|
+
return false;
|
8726
|
+
}
|
8727
|
+
if (viewOptions.docMode === exports.DocMode.Design) {
|
8728
|
+
return true;
|
8729
|
+
}
|
8730
|
+
//浏览模式
|
8731
|
+
if (viewOptions.docMode === exports.DocMode.View) {
|
8732
|
+
return false;
|
8733
|
+
}
|
8734
|
+
//表单模式下,如果不在数据元素中,则不显示光标
|
8735
|
+
if (viewOptions.docMode === exports.DocMode.FormEdit) {
|
8736
|
+
if (!IsInSideDataElement(startControl, startOffset)) {
|
8737
|
+
return false;
|
8738
|
+
}
|
8739
|
+
}
|
8740
|
+
if (!ElementUtil.verifyHitable(startControl)) {
|
8741
|
+
return false;
|
8742
|
+
}
|
8743
|
+
//表单模式下,数据元不可编辑
|
8744
|
+
if (viewOptions.docMode === exports.DocMode.FormEdit && IsInSideDataElement(startControl, startOffset)) {
|
8745
|
+
const dataEle = ElementUtil.getDataElement(startControl);
|
8746
|
+
if (dataEle && !dataEle.props.editable) {
|
8747
|
+
return false;
|
8748
|
+
}
|
8749
|
+
}
|
8750
|
+
return true;
|
8751
|
+
}
|
8752
|
+
static fixedOffset(control, offset) {
|
8753
|
+
if (control instanceof TextGroupElement) {
|
8754
|
+
offset = offset === -1 ? control.text.length : offset;
|
8755
|
+
}
|
8756
|
+
offset = offset === -1 ? 1 : offset;
|
8757
|
+
return offset;
|
8758
|
+
}
|
8706
8759
|
}
|
8707
8760
|
|
8708
8761
|
class RenderContext {
|
@@ -10876,7 +10929,7 @@ class DataElementCheckRenderObject extends LeafRenderObject {
|
|
10876
10929
|
data: {
|
10877
10930
|
ns: "http://www.w3.org/2000/svg",
|
10878
10931
|
attrs: {
|
10879
|
-
cx: width / 2,
|
10932
|
+
cx: 2 + width / 2,
|
10880
10933
|
cy: height / 2,
|
10881
10934
|
r: width / 3,
|
10882
10935
|
stroke: 'black',
|
@@ -10891,7 +10944,7 @@ class DataElementCheckRenderObject extends LeafRenderObject {
|
|
10891
10944
|
data: {
|
10892
10945
|
ns: "http://www.w3.org/2000/svg",
|
10893
10946
|
attrs: {
|
10894
|
-
cx: width / 2,
|
10947
|
+
cx: 2 + width / 2,
|
10895
10948
|
cy: height / 2,
|
10896
10949
|
r: width / 5,
|
10897
10950
|
stroke: 'black',
|
@@ -17588,7 +17641,6 @@ class DocumentEvent {
|
|
17588
17641
|
if (resizeColWidth < minColWidth || cellWidth < minColWidth) {
|
17589
17642
|
return;
|
17590
17643
|
}
|
17591
|
-
console.log(resizeColWidth, cellWidth);
|
17592
17644
|
table.setCellWidth(resizeColIndex, resizeColWidth);
|
17593
17645
|
table.setCellWidth(cellIndex, cellWidth);
|
17594
17646
|
this.edgeRenderInfo.mousedownPos = this.currentPos;
|
@@ -17762,6 +17814,15 @@ class DocumentEvent {
|
|
17762
17814
|
*/
|
17763
17815
|
moveCursorToLeft() {
|
17764
17816
|
const { startControl, startOffset } = this.selectionState;
|
17817
|
+
this.moveCursorToLeftHandle(startControl, startOffset);
|
17818
|
+
}
|
17819
|
+
/**
|
17820
|
+
* 向左移动光标处理函数
|
17821
|
+
* @param startControl
|
17822
|
+
* @param startOffset
|
17823
|
+
* @private
|
17824
|
+
*/
|
17825
|
+
moveCursorToLeftHandle(startControl, startOffset) {
|
17765
17826
|
if (startOffset === 0) {
|
17766
17827
|
const oldRegion = ElementUtil.getElementRegion(startControl);
|
17767
17828
|
const prevEle = ElementUtil.getRecursionPrevSiblingElement(startControl, false, true, this.viewOptions);
|
@@ -17770,6 +17831,10 @@ class DocumentEvent {
|
|
17770
17831
|
if (newRegion !== oldRegion) {
|
17771
17832
|
return;
|
17772
17833
|
}
|
17834
|
+
if (this.viewOptions.docMode === exports.DocMode.FormEdit && !ElementUtil.canSetCursor(prevEle, ElementUtil.fixedOffset(prevEle, -1), true, this.viewOptions)) {
|
17835
|
+
this.moveCursorToLeftHandle(prevEle, 0);
|
17836
|
+
return;
|
17837
|
+
}
|
17773
17838
|
this.selectionState.resetRange(prevEle, -1);
|
17774
17839
|
return;
|
17775
17840
|
}
|
@@ -17779,6 +17844,10 @@ class DocumentEvent {
|
|
17779
17844
|
this.selectionState.resetRange(startControl, startOffset - 1);
|
17780
17845
|
}
|
17781
17846
|
else {
|
17847
|
+
if (this.viewOptions.docMode === exports.DocMode.FormEdit && !ElementUtil.canSetCursor(startControl, ElementUtil.fixedOffset(startControl, 0), true, this.viewOptions)) {
|
17848
|
+
this.moveCursorToLeftHandle(startControl, 0);
|
17849
|
+
return;
|
17850
|
+
}
|
17782
17851
|
this.selectionState.resetRange(startControl, 0);
|
17783
17852
|
}
|
17784
17853
|
}
|
@@ -17788,6 +17857,9 @@ class DocumentEvent {
|
|
17788
17857
|
*/
|
17789
17858
|
moveCursorToRight() {
|
17790
17859
|
const { startControl, startOffset } = this.selectionState;
|
17860
|
+
this.moveCursorToRightHandle(startControl, startOffset);
|
17861
|
+
}
|
17862
|
+
moveCursorToRightHandle(startControl, startOffset) {
|
17791
17863
|
if (this.isLeafEleEndOffset(startControl, startOffset)) {
|
17792
17864
|
const oldRegion = ElementUtil.getElementRegion(startControl);
|
17793
17865
|
const nextEle = ElementUtil.getRecursionNextSiblingElement(startControl, false, true, this.viewOptions);
|
@@ -17796,7 +17868,11 @@ class DocumentEvent {
|
|
17796
17868
|
if (oldRegion !== newRegion) {
|
17797
17869
|
return;
|
17798
17870
|
}
|
17799
|
-
this.
|
17871
|
+
if (this.viewOptions.docMode === exports.DocMode.FormEdit && !ElementUtil.canSetCursor(nextEle, ElementUtil.fixedOffset(nextEle, -1), true, this.viewOptions)) {
|
17872
|
+
this.moveCursorToRightHandle(nextEle, ElementUtil.fixedOffset(nextEle, -1));
|
17873
|
+
return;
|
17874
|
+
}
|
17875
|
+
this.selectionState.resetRange(nextEle, 1);
|
17800
17876
|
return;
|
17801
17877
|
}
|
17802
17878
|
}
|
@@ -17805,6 +17881,10 @@ class DocumentEvent {
|
|
17805
17881
|
this.selectionState.resetRange(startControl, startOffset + 1);
|
17806
17882
|
}
|
17807
17883
|
else {
|
17884
|
+
if (this.viewOptions.docMode === exports.DocMode.FormEdit && !ElementUtil.canSetCursor(startControl, 0, true, this.viewOptions)) {
|
17885
|
+
this.moveCursorToRightHandle(startControl, ElementUtil.fixedOffset(startControl, -1));
|
17886
|
+
return;
|
17887
|
+
}
|
17808
17888
|
this.selectionState.resetRange(startControl, 1);
|
17809
17889
|
}
|
17810
17890
|
}
|
@@ -19829,17 +19909,81 @@ function printNodes(printNodes, options, printEvent = null) {
|
|
19829
19909
|
|
19830
19910
|
class DocumentTemplate {
|
19831
19911
|
static createA4Doc() {
|
19912
|
+
return DocumentTemplate.createDoc('A4');
|
19913
|
+
}
|
19914
|
+
static createDoc(name = 'A4') {
|
19832
19915
|
const doc = new DocumentElement();
|
19833
19916
|
doc.props = new DocumentProps();
|
19834
|
-
|
19835
|
-
doc.props.
|
19836
|
-
doc.props.
|
19917
|
+
const paper = DocumentTemplate.getPaper(name);
|
19918
|
+
doc.props.width = paper.width;
|
19919
|
+
doc.props.height = paper.height;
|
19920
|
+
doc.props.padding = new PaddingProps(paper.top, paper.bottom, paper.left, paper.right);
|
19837
19921
|
doc.addChild(new DocumentHeaderElement());
|
19838
19922
|
doc.addChild(new DocumentBodyElement());
|
19839
19923
|
doc.addChild(new DocumentFooterElement());
|
19840
19924
|
return doc;
|
19841
19925
|
}
|
19842
|
-
|
19926
|
+
static getPaper(name) {
|
19927
|
+
let top = 25.4, bottom = 25.4, left = 19.1, right = 19.1;
|
19928
|
+
const paper = PageSize.find(item => item.name.toUpperCase() === name.toUpperCase());
|
19929
|
+
if (paper) {
|
19930
|
+
if (top + bottom + 30 > paper.height) {
|
19931
|
+
top = bottom = 0;
|
19932
|
+
}
|
19933
|
+
if (left + right + 30 > paper.width) {
|
19934
|
+
left = right = 0;
|
19935
|
+
}
|
19936
|
+
return {
|
19937
|
+
width: paper.width,
|
19938
|
+
height: paper.height,
|
19939
|
+
top, left, right, bottom
|
19940
|
+
};
|
19941
|
+
}
|
19942
|
+
return { width: PageSize[0].width, height: PageSize[0].height, top, left, right, bottom };
|
19943
|
+
}
|
19944
|
+
}
|
19945
|
+
const PageSize = [
|
19946
|
+
{ name: 'A4', width: 210, height: 297 },
|
19947
|
+
{ name: 'A5', width: 148, height: 210 },
|
19948
|
+
{ name: 'A6', width: 105, height: 148 },
|
19949
|
+
{ name: 'B5', width: 176, height: 250 },
|
19950
|
+
{ name: 'B6', width: 125, height: 176 },
|
19951
|
+
{ name: 'Letter', width: 216, height: 279 },
|
19952
|
+
{ name: 'Legal', width: 216, height: 356 },
|
19953
|
+
{ name: 'Executive', width: 184, height: 267 },
|
19954
|
+
{ name: 'Folio', width: 210, height: 330 },
|
19955
|
+
{ name: 'Quarto', width: 215, height: 275 },
|
19956
|
+
{ name: '10x15cm', width: 100, height: 150 },
|
19957
|
+
{ name: '13x18cm', width: 130, height: 180 },
|
19958
|
+
{ name: '15x20cm', width: 150, height: 200 },
|
19959
|
+
{ name: '20x25cm', width: 200, height: 250 },
|
19960
|
+
{ name: '20x30cm', width: 200, height: 300 },
|
19961
|
+
{ name: '25x35cm', width: 250, height: 350 },
|
19962
|
+
{ name: '30x40cm', width: 300, height: 400 },
|
19963
|
+
{ name: 'A0', width: 841, height: 1189 },
|
19964
|
+
{ name: 'A1', width: 594, height: 841 },
|
19965
|
+
{ name: 'A2', width: 420, height: 594 },
|
19966
|
+
{ name: 'A3', width: 297, height: 420 },
|
19967
|
+
{ name: 'A7', width: 74, height: 105 },
|
19968
|
+
{ name: 'A8', width: 52, height: 74 },
|
19969
|
+
{ name: 'A9', width: 37, height: 52 },
|
19970
|
+
{ name: 'A10', width: 26, height: 37 },
|
19971
|
+
{ name: 'B0', width: 1000, height: 1414 },
|
19972
|
+
{ name: 'B1', width: 707, height: 1000 },
|
19973
|
+
{ name: 'B2', width: 500, height: 707 },
|
19974
|
+
{ name: 'B3', width: 353, height: 500 },
|
19975
|
+
{ name: 'B4', width: 250, height: 353 },
|
19976
|
+
{ name: 'B7', width: 88, height: 125 },
|
19977
|
+
{ name: 'B8', width: 62, height: 88 },
|
19978
|
+
{ name: 'B9', width: 44, height: 62 },
|
19979
|
+
{ name: 'B10', width: 31, height: 44 },
|
19980
|
+
{ name: 'C5E', width: 163, height: 229 },
|
19981
|
+
{ name: 'Comm10E', width: 105, height: 241 },
|
19982
|
+
{ name: 'DLE', width: 110, height: 220 },
|
19983
|
+
{ name: 'Folio', width: 210, height: 330 },
|
19984
|
+
{ name: 'Ledger', width: 432, height: 279 },
|
19985
|
+
{ name: 'Tabloid', width: 279, height: 432 }
|
19986
|
+
];
|
19843
19987
|
|
19844
19988
|
/**
|
19845
19989
|
* 处理文档批注
|
@@ -26926,33 +27070,7 @@ class DocEditor {
|
|
26926
27070
|
*/
|
26927
27071
|
canSetCursor() {
|
26928
27072
|
const { startControl, startOffset, editable } = this.selectionState;
|
26929
|
-
|
26930
|
-
return false;
|
26931
|
-
}
|
26932
|
-
if (this.viewOptions.docMode === exports.DocMode.Design) {
|
26933
|
-
return true;
|
26934
|
-
}
|
26935
|
-
//浏览模式
|
26936
|
-
if (this.viewOptions.docMode === exports.DocMode.View) {
|
26937
|
-
return false;
|
26938
|
-
}
|
26939
|
-
//表单模式下,如果不在数据元素中,则不显示光标
|
26940
|
-
if (this.viewOptions.docMode === exports.DocMode.FormEdit) {
|
26941
|
-
if (!IsInSideDataElement(startControl, startOffset)) {
|
26942
|
-
return false;
|
26943
|
-
}
|
26944
|
-
}
|
26945
|
-
if (!ElementUtil.verifyHitable(startControl)) {
|
26946
|
-
return false;
|
26947
|
-
}
|
26948
|
-
//表单模式下,数据元不可编辑
|
26949
|
-
if (this.viewOptions.docMode === exports.DocMode.FormEdit && IsInSideDataElement(startControl, startOffset)) {
|
26950
|
-
const dataEle = ElementUtil.getDataElement(startControl);
|
26951
|
-
if (dataEle && !dataEle.props.editable) {
|
26952
|
-
return false;
|
26953
|
-
}
|
26954
|
-
}
|
26955
|
-
return true;
|
27073
|
+
return ElementUtil.canSetCursor(startControl, startOffset, editable, this.viewOptions);
|
26956
27074
|
}
|
26957
27075
|
/**
|
26958
27076
|
* 修改光标
|
@@ -27152,10 +27270,11 @@ class DocEditor {
|
|
27152
27270
|
/**
|
27153
27271
|
* 新建文档
|
27154
27272
|
* @param doc
|
27273
|
+
* @param name
|
27155
27274
|
*/
|
27156
|
-
createNewDoc(doc = null) {
|
27275
|
+
createNewDoc(doc = null, name = 'A4') {
|
27157
27276
|
//this.docCtx.clear();
|
27158
|
-
const newDoc = doc ?? DocumentTemplate.
|
27277
|
+
const newDoc = doc ?? DocumentTemplate.createDoc(name);
|
27159
27278
|
// this.elementReader.setDocument(newDoc);
|
27160
27279
|
// this.refreshDocument('content');
|
27161
27280
|
this.loadDoc(ElementSerialize.serialize(newDoc, this.viewOptions));
|
@@ -27379,12 +27498,13 @@ class DocEditor {
|
|
27379
27498
|
this.resetViewer('force');
|
27380
27499
|
this.selectionState.clear();
|
27381
27500
|
}
|
27382
|
-
/**
|
27383
|
-
* 设置纸张大小,单位为毫米(mm)
|
27384
|
-
* @param width
|
27385
|
-
* @param height
|
27386
|
-
*/
|
27387
27501
|
setPaperSize(width, height) {
|
27502
|
+
if (typeof width === 'string') {
|
27503
|
+
const paperSize = DocumentTemplate.getPaper(width);
|
27504
|
+
width = paperSize.width;
|
27505
|
+
height = paperSize.height;
|
27506
|
+
}
|
27507
|
+
height = height;
|
27388
27508
|
const docProps = this.docCtx.document.props;
|
27389
27509
|
docProps.width = width;
|
27390
27510
|
docProps.height = height;
|
@@ -27594,7 +27714,7 @@ class DocEditor {
|
|
27594
27714
|
const vNodeFunc = this.renderRoot();
|
27595
27715
|
setActiveEditorContext(null);
|
27596
27716
|
const render = () => {
|
27597
|
-
|
27717
|
+
console.time('patch');
|
27598
27718
|
setActiveEditorContext(this);
|
27599
27719
|
const vNode = vNodeFunc.render();
|
27600
27720
|
setActiveEditorContext(null);
|
@@ -27606,7 +27726,7 @@ class DocEditor {
|
|
27606
27726
|
this.vNodeDocContent = this.nodePatch(this.svgContainer, vNode);
|
27607
27727
|
}
|
27608
27728
|
this.afterNodePatch.next();
|
27609
|
-
|
27729
|
+
console.timeEnd('patch');
|
27610
27730
|
};
|
27611
27731
|
render();
|
27612
27732
|
this.onShouldRender.subscribe(() => {
|