@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.js
CHANGED
@@ -2741,6 +2741,7 @@ class DataDecorateElement extends LeafElement {
|
|
2741
2741
|
}
|
2742
2742
|
}
|
2743
2743
|
});
|
2744
|
+
this.disableClick = !isPrefix;
|
2744
2745
|
this.isDecorate = true;
|
2745
2746
|
}
|
2746
2747
|
createRenderObject() {
|
@@ -3358,7 +3359,6 @@ class DocumentRenderObject extends BlockContainerRenderObject {
|
|
3358
3359
|
'font-family': '仿宋',
|
3359
3360
|
'font-size': '14',
|
3360
3361
|
"fill": this.element.props.color,
|
3361
|
-
'font-style': 'italic',
|
3362
3362
|
x: 0,
|
3363
3363
|
y: 0,
|
3364
3364
|
}
|
@@ -4249,7 +4249,7 @@ class PSymbolElement extends LeafElement {
|
|
4249
4249
|
createRenderObject() {
|
4250
4250
|
const symbol = new PSymbolRenderObject(this);
|
4251
4251
|
symbol.rect.height = this.defaultHeight;
|
4252
|
-
symbol.rect.width =
|
4252
|
+
symbol.rect.width = 1;
|
4253
4253
|
return symbol;
|
4254
4254
|
}
|
4255
4255
|
serialize() {
|
@@ -4780,45 +4780,27 @@ class TextGroupRenderObject extends LeafRenderObject {
|
|
4780
4780
|
if (this.element.props.background) {
|
4781
4781
|
const bgX = event.relativePagePos.x;
|
4782
4782
|
const bgY = event.relativePagePos.y;
|
4783
|
-
event.highlights.push(
|
4784
|
-
sel: 'path',
|
4785
|
-
data: {
|
4786
|
-
ns: "http://www.w3.org/2000/svg",
|
4787
|
-
attrs: {
|
4788
|
-
d: `M${bgX} ${bgY} h${width} v${this.rect.height} h-${width}z`,
|
4789
|
-
fill: this.element.props.background,
|
4790
|
-
}
|
4791
|
-
}
|
4792
|
-
});
|
4783
|
+
event.highlights.push(ElementUtil.getFillSvgRect(bgX, bgY, this.rect.width, this.rect.height, this.element.props.background));
|
4793
4784
|
}
|
4794
4785
|
if (this.element.props.underline) {
|
4795
4786
|
const underHeight = this.element.props.fontSize * 1.2;
|
4796
|
-
event.
|
4797
|
-
|
4798
|
-
data: {
|
4799
|
-
ns: "http://www.w3.org/2000/svg",
|
4800
|
-
attrs: {
|
4801
|
-
d: `M${event.relativePagePos.x} ${event.relativePagePos.y + underHeight} L${event.relativePagePos.x + this.rect.width} ${event.relativePagePos.y + underHeight}`,
|
4802
|
-
stroke: '#000',
|
4803
|
-
'stroke-width': 1,
|
4804
|
-
fill: 'none'
|
4805
|
-
}
|
4806
|
-
}
|
4807
|
-
});
|
4787
|
+
const path = `M${event.relativePagePos.x} ${event.relativePagePos.y + underHeight} L${event.relativePagePos.x + this.rect.width} ${event.relativePagePos.y + underHeight}`;
|
4788
|
+
event.highlights.push(ElementUtil.getStrokeSvgPath(path, '#000', 1));
|
4808
4789
|
}
|
4809
4790
|
if (this.element.props.linethrough) {
|
4810
|
-
event.
|
4811
|
-
|
4812
|
-
|
4813
|
-
|
4814
|
-
|
4815
|
-
|
4816
|
-
|
4817
|
-
|
4818
|
-
|
4819
|
-
|
4820
|
-
|
4821
|
-
|
4791
|
+
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}`;
|
4792
|
+
event.highlights.push(ElementUtil.getStrokeSvgPath(path, '#000', 1));
|
4793
|
+
}
|
4794
|
+
if (this.element.props.border) {
|
4795
|
+
event.highlights.push(ElementUtil.getStrokeSvgPath(ElementUtil.getRectPath(event.relativePagePos.x, event.relativePagePos.y, this.rect.width, this.rect.height), '#000', 1));
|
4796
|
+
}
|
4797
|
+
if (this.element.props.overline) {
|
4798
|
+
const path = `M${event.relativePagePos.x} ${event.relativePagePos.y} L${event.relativePagePos.x + this.rect.width} ${event.relativePagePos.y}`;
|
4799
|
+
event.highlights.push(ElementUtil.getStrokeSvgPath(path, '#000', 1));
|
4800
|
+
}
|
4801
|
+
//处理null-text
|
4802
|
+
if (this.element.isDecorate && this.element.disableClick && !this.element.parent) {
|
4803
|
+
t.data.attrs['opacity'] = '0.58';
|
4822
4804
|
}
|
4823
4805
|
return t;
|
4824
4806
|
}
|
@@ -5091,10 +5073,7 @@ class SelectionRange {
|
|
5091
5073
|
}
|
5092
5074
|
setInfo(control, offset) {
|
5093
5075
|
if (control instanceof LeafElement) {
|
5094
|
-
|
5095
|
-
offset = offset === -1 ? control.text.length : offset;
|
5096
|
-
}
|
5097
|
-
offset = offset === -1 ? 1 : offset;
|
5076
|
+
offset = ElementUtil.fixedOffset(control, offset);
|
5098
5077
|
return { control, offset };
|
5099
5078
|
}
|
5100
5079
|
else if (control instanceof BranchElement) {
|
@@ -6293,6 +6272,40 @@ class TableUtil {
|
|
6293
6272
|
});
|
6294
6273
|
}
|
6295
6274
|
}
|
6275
|
+
static getTableData(tb) {
|
6276
|
+
//根据实际要提取的行索引进行调整
|
6277
|
+
const rowData = [];
|
6278
|
+
for (let i = 0; i < tb.length; i++) {
|
6279
|
+
const row = tb.getChild(i);
|
6280
|
+
const cellData = [];
|
6281
|
+
for (let j = 0; j < row.length; j++) {
|
6282
|
+
const cell = row.getChild(j);
|
6283
|
+
cellData.push(this.getCellData(cell));
|
6284
|
+
}
|
6285
|
+
rowData.push(cellData);
|
6286
|
+
}
|
6287
|
+
return rowData;
|
6288
|
+
}
|
6289
|
+
/**
|
6290
|
+
* 获取单元格内的数据元的值
|
6291
|
+
* @param target
|
6292
|
+
*/
|
6293
|
+
static getCellData(target) {
|
6294
|
+
if (validateDataEle(target)) {
|
6295
|
+
const dataEle = target;
|
6296
|
+
return { id: dataEle.props.id, value: dataEle.getValue() };
|
6297
|
+
}
|
6298
|
+
if (target instanceof BranchElement) {
|
6299
|
+
for (let i = 0; i < target.length; i++) {
|
6300
|
+
const child = target.getChild(i);
|
6301
|
+
const val = this.getCellData(child);
|
6302
|
+
if (val !== null) {
|
6303
|
+
return val;
|
6304
|
+
}
|
6305
|
+
}
|
6306
|
+
}
|
6307
|
+
return null;
|
6308
|
+
}
|
6296
6309
|
}
|
6297
6310
|
|
6298
6311
|
class TableElement extends BlockContainerElement {
|
@@ -8673,6 +8686,46 @@ class ElementUtil {
|
|
8673
8686
|
]
|
8674
8687
|
};
|
8675
8688
|
}
|
8689
|
+
/**
|
8690
|
+
* 判断是否光标可以设置接受编辑
|
8691
|
+
* @returns
|
8692
|
+
*/
|
8693
|
+
static canSetCursor(startControl, startOffset, editable, viewOptions) {
|
8694
|
+
if (!startControl || !editable) {
|
8695
|
+
return false;
|
8696
|
+
}
|
8697
|
+
if (viewOptions.docMode === DocMode.Design) {
|
8698
|
+
return true;
|
8699
|
+
}
|
8700
|
+
//浏览模式
|
8701
|
+
if (viewOptions.docMode === DocMode.View) {
|
8702
|
+
return false;
|
8703
|
+
}
|
8704
|
+
//表单模式下,如果不在数据元素中,则不显示光标
|
8705
|
+
if (viewOptions.docMode === DocMode.FormEdit) {
|
8706
|
+
if (!IsInSideDataElement(startControl, startOffset)) {
|
8707
|
+
return false;
|
8708
|
+
}
|
8709
|
+
}
|
8710
|
+
if (!ElementUtil.verifyHitable(startControl)) {
|
8711
|
+
return false;
|
8712
|
+
}
|
8713
|
+
//表单模式下,数据元不可编辑
|
8714
|
+
if (viewOptions.docMode === DocMode.FormEdit && IsInSideDataElement(startControl, startOffset)) {
|
8715
|
+
const dataEle = ElementUtil.getDataElement(startControl);
|
8716
|
+
if (dataEle && !dataEle.props.editable) {
|
8717
|
+
return false;
|
8718
|
+
}
|
8719
|
+
}
|
8720
|
+
return true;
|
8721
|
+
}
|
8722
|
+
static fixedOffset(control, offset) {
|
8723
|
+
if (control instanceof TextGroupElement) {
|
8724
|
+
offset = offset === -1 ? control.text.length : offset;
|
8725
|
+
}
|
8726
|
+
offset = offset === -1 ? 1 : offset;
|
8727
|
+
return offset;
|
8728
|
+
}
|
8676
8729
|
}
|
8677
8730
|
|
8678
8731
|
class RenderContext {
|
@@ -10846,7 +10899,7 @@ class DataElementCheckRenderObject extends LeafRenderObject {
|
|
10846
10899
|
data: {
|
10847
10900
|
ns: "http://www.w3.org/2000/svg",
|
10848
10901
|
attrs: {
|
10849
|
-
cx: width / 2,
|
10902
|
+
cx: 2 + width / 2,
|
10850
10903
|
cy: height / 2,
|
10851
10904
|
r: width / 3,
|
10852
10905
|
stroke: 'black',
|
@@ -10861,7 +10914,7 @@ class DataElementCheckRenderObject extends LeafRenderObject {
|
|
10861
10914
|
data: {
|
10862
10915
|
ns: "http://www.w3.org/2000/svg",
|
10863
10916
|
attrs: {
|
10864
|
-
cx: width / 2,
|
10917
|
+
cx: 2 + width / 2,
|
10865
10918
|
cy: height / 2,
|
10866
10919
|
r: width / 5,
|
10867
10920
|
stroke: 'black',
|
@@ -17558,7 +17611,6 @@ class DocumentEvent {
|
|
17558
17611
|
if (resizeColWidth < minColWidth || cellWidth < minColWidth) {
|
17559
17612
|
return;
|
17560
17613
|
}
|
17561
|
-
console.log(resizeColWidth, cellWidth);
|
17562
17614
|
table.setCellWidth(resizeColIndex, resizeColWidth);
|
17563
17615
|
table.setCellWidth(cellIndex, cellWidth);
|
17564
17616
|
this.edgeRenderInfo.mousedownPos = this.currentPos;
|
@@ -17732,6 +17784,15 @@ class DocumentEvent {
|
|
17732
17784
|
*/
|
17733
17785
|
moveCursorToLeft() {
|
17734
17786
|
const { startControl, startOffset } = this.selectionState;
|
17787
|
+
this.moveCursorToLeftHandle(startControl, startOffset);
|
17788
|
+
}
|
17789
|
+
/**
|
17790
|
+
* 向左移动光标处理函数
|
17791
|
+
* @param startControl
|
17792
|
+
* @param startOffset
|
17793
|
+
* @private
|
17794
|
+
*/
|
17795
|
+
moveCursorToLeftHandle(startControl, startOffset) {
|
17735
17796
|
if (startOffset === 0) {
|
17736
17797
|
const oldRegion = ElementUtil.getElementRegion(startControl);
|
17737
17798
|
const prevEle = ElementUtil.getRecursionPrevSiblingElement(startControl, false, true, this.viewOptions);
|
@@ -17740,6 +17801,10 @@ class DocumentEvent {
|
|
17740
17801
|
if (newRegion !== oldRegion) {
|
17741
17802
|
return;
|
17742
17803
|
}
|
17804
|
+
if (this.viewOptions.docMode === DocMode.FormEdit && !ElementUtil.canSetCursor(prevEle, ElementUtil.fixedOffset(prevEle, -1), true, this.viewOptions)) {
|
17805
|
+
this.moveCursorToLeftHandle(prevEle, 0);
|
17806
|
+
return;
|
17807
|
+
}
|
17743
17808
|
this.selectionState.resetRange(prevEle, -1);
|
17744
17809
|
return;
|
17745
17810
|
}
|
@@ -17749,6 +17814,10 @@ class DocumentEvent {
|
|
17749
17814
|
this.selectionState.resetRange(startControl, startOffset - 1);
|
17750
17815
|
}
|
17751
17816
|
else {
|
17817
|
+
if (this.viewOptions.docMode === DocMode.FormEdit && !ElementUtil.canSetCursor(startControl, ElementUtil.fixedOffset(startControl, 0), true, this.viewOptions)) {
|
17818
|
+
this.moveCursorToLeftHandle(startControl, 0);
|
17819
|
+
return;
|
17820
|
+
}
|
17752
17821
|
this.selectionState.resetRange(startControl, 0);
|
17753
17822
|
}
|
17754
17823
|
}
|
@@ -17758,6 +17827,9 @@ class DocumentEvent {
|
|
17758
17827
|
*/
|
17759
17828
|
moveCursorToRight() {
|
17760
17829
|
const { startControl, startOffset } = this.selectionState;
|
17830
|
+
this.moveCursorToRightHandle(startControl, startOffset);
|
17831
|
+
}
|
17832
|
+
moveCursorToRightHandle(startControl, startOffset) {
|
17761
17833
|
if (this.isLeafEleEndOffset(startControl, startOffset)) {
|
17762
17834
|
const oldRegion = ElementUtil.getElementRegion(startControl);
|
17763
17835
|
const nextEle = ElementUtil.getRecursionNextSiblingElement(startControl, false, true, this.viewOptions);
|
@@ -17766,7 +17838,11 @@ class DocumentEvent {
|
|
17766
17838
|
if (oldRegion !== newRegion) {
|
17767
17839
|
return;
|
17768
17840
|
}
|
17769
|
-
this.
|
17841
|
+
if (this.viewOptions.docMode === DocMode.FormEdit && !ElementUtil.canSetCursor(nextEle, ElementUtil.fixedOffset(nextEle, -1), true, this.viewOptions)) {
|
17842
|
+
this.moveCursorToRightHandle(nextEle, ElementUtil.fixedOffset(nextEle, -1));
|
17843
|
+
return;
|
17844
|
+
}
|
17845
|
+
this.selectionState.resetRange(nextEle, 1);
|
17770
17846
|
return;
|
17771
17847
|
}
|
17772
17848
|
}
|
@@ -17775,6 +17851,10 @@ class DocumentEvent {
|
|
17775
17851
|
this.selectionState.resetRange(startControl, startOffset + 1);
|
17776
17852
|
}
|
17777
17853
|
else {
|
17854
|
+
if (this.viewOptions.docMode === DocMode.FormEdit && !ElementUtil.canSetCursor(startControl, 0, true, this.viewOptions)) {
|
17855
|
+
this.moveCursorToRightHandle(startControl, ElementUtil.fixedOffset(startControl, -1));
|
17856
|
+
return;
|
17857
|
+
}
|
17778
17858
|
this.selectionState.resetRange(startControl, 1);
|
17779
17859
|
}
|
17780
17860
|
}
|
@@ -19799,17 +19879,81 @@ function printNodes(printNodes, options, printEvent = null) {
|
|
19799
19879
|
|
19800
19880
|
class DocumentTemplate {
|
19801
19881
|
static createA4Doc() {
|
19882
|
+
return DocumentTemplate.createDoc('A4');
|
19883
|
+
}
|
19884
|
+
static createDoc(name = 'A4') {
|
19802
19885
|
const doc = new DocumentElement();
|
19803
19886
|
doc.props = new DocumentProps();
|
19804
|
-
|
19805
|
-
doc.props.
|
19806
|
-
doc.props.
|
19887
|
+
const paper = DocumentTemplate.getPaper(name);
|
19888
|
+
doc.props.width = paper.width;
|
19889
|
+
doc.props.height = paper.height;
|
19890
|
+
doc.props.padding = new PaddingProps(paper.top, paper.bottom, paper.left, paper.right);
|
19807
19891
|
doc.addChild(new DocumentHeaderElement());
|
19808
19892
|
doc.addChild(new DocumentBodyElement());
|
19809
19893
|
doc.addChild(new DocumentFooterElement());
|
19810
19894
|
return doc;
|
19811
19895
|
}
|
19812
|
-
|
19896
|
+
static getPaper(name) {
|
19897
|
+
let top = 25.4, bottom = 25.4, left = 19.1, right = 19.1;
|
19898
|
+
const paper = PageSize.find(item => item.name.toUpperCase() === name.toUpperCase());
|
19899
|
+
if (paper) {
|
19900
|
+
if (top + bottom + 30 > paper.height) {
|
19901
|
+
top = bottom = 0;
|
19902
|
+
}
|
19903
|
+
if (left + right + 30 > paper.width) {
|
19904
|
+
left = right = 0;
|
19905
|
+
}
|
19906
|
+
return {
|
19907
|
+
width: paper.width,
|
19908
|
+
height: paper.height,
|
19909
|
+
top, left, right, bottom
|
19910
|
+
};
|
19911
|
+
}
|
19912
|
+
return { width: PageSize[0].width, height: PageSize[0].height, top, left, right, bottom };
|
19913
|
+
}
|
19914
|
+
}
|
19915
|
+
const PageSize = [
|
19916
|
+
{ name: 'A4', width: 210, height: 297 },
|
19917
|
+
{ name: 'A5', width: 148, height: 210 },
|
19918
|
+
{ name: 'A6', width: 105, height: 148 },
|
19919
|
+
{ name: 'B5', width: 176, height: 250 },
|
19920
|
+
{ name: 'B6', width: 125, height: 176 },
|
19921
|
+
{ name: 'Letter', width: 216, height: 279 },
|
19922
|
+
{ name: 'Legal', width: 216, height: 356 },
|
19923
|
+
{ name: 'Executive', width: 184, height: 267 },
|
19924
|
+
{ name: 'Folio', width: 210, height: 330 },
|
19925
|
+
{ name: 'Quarto', width: 215, height: 275 },
|
19926
|
+
{ name: '10x15cm', width: 100, height: 150 },
|
19927
|
+
{ name: '13x18cm', width: 130, height: 180 },
|
19928
|
+
{ name: '15x20cm', width: 150, height: 200 },
|
19929
|
+
{ name: '20x25cm', width: 200, height: 250 },
|
19930
|
+
{ name: '20x30cm', width: 200, height: 300 },
|
19931
|
+
{ name: '25x35cm', width: 250, height: 350 },
|
19932
|
+
{ name: '30x40cm', width: 300, height: 400 },
|
19933
|
+
{ name: 'A0', width: 841, height: 1189 },
|
19934
|
+
{ name: 'A1', width: 594, height: 841 },
|
19935
|
+
{ name: 'A2', width: 420, height: 594 },
|
19936
|
+
{ name: 'A3', width: 297, height: 420 },
|
19937
|
+
{ name: 'A7', width: 74, height: 105 },
|
19938
|
+
{ name: 'A8', width: 52, height: 74 },
|
19939
|
+
{ name: 'A9', width: 37, height: 52 },
|
19940
|
+
{ name: 'A10', width: 26, height: 37 },
|
19941
|
+
{ name: 'B0', width: 1000, height: 1414 },
|
19942
|
+
{ name: 'B1', width: 707, height: 1000 },
|
19943
|
+
{ name: 'B2', width: 500, height: 707 },
|
19944
|
+
{ name: 'B3', width: 353, height: 500 },
|
19945
|
+
{ name: 'B4', width: 250, height: 353 },
|
19946
|
+
{ name: 'B7', width: 88, height: 125 },
|
19947
|
+
{ name: 'B8', width: 62, height: 88 },
|
19948
|
+
{ name: 'B9', width: 44, height: 62 },
|
19949
|
+
{ name: 'B10', width: 31, height: 44 },
|
19950
|
+
{ name: 'C5E', width: 163, height: 229 },
|
19951
|
+
{ name: 'Comm10E', width: 105, height: 241 },
|
19952
|
+
{ name: 'DLE', width: 110, height: 220 },
|
19953
|
+
{ name: 'Folio', width: 210, height: 330 },
|
19954
|
+
{ name: 'Ledger', width: 432, height: 279 },
|
19955
|
+
{ name: 'Tabloid', width: 279, height: 432 }
|
19956
|
+
];
|
19813
19957
|
|
19814
19958
|
/**
|
19815
19959
|
* 处理文档批注
|
@@ -26896,33 +27040,7 @@ class DocEditor {
|
|
26896
27040
|
*/
|
26897
27041
|
canSetCursor() {
|
26898
27042
|
const { startControl, startOffset, editable } = this.selectionState;
|
26899
|
-
|
26900
|
-
return false;
|
26901
|
-
}
|
26902
|
-
if (this.viewOptions.docMode === DocMode.Design) {
|
26903
|
-
return true;
|
26904
|
-
}
|
26905
|
-
//浏览模式
|
26906
|
-
if (this.viewOptions.docMode === DocMode.View) {
|
26907
|
-
return false;
|
26908
|
-
}
|
26909
|
-
//表单模式下,如果不在数据元素中,则不显示光标
|
26910
|
-
if (this.viewOptions.docMode === DocMode.FormEdit) {
|
26911
|
-
if (!IsInSideDataElement(startControl, startOffset)) {
|
26912
|
-
return false;
|
26913
|
-
}
|
26914
|
-
}
|
26915
|
-
if (!ElementUtil.verifyHitable(startControl)) {
|
26916
|
-
return false;
|
26917
|
-
}
|
26918
|
-
//表单模式下,数据元不可编辑
|
26919
|
-
if (this.viewOptions.docMode === DocMode.FormEdit && IsInSideDataElement(startControl, startOffset)) {
|
26920
|
-
const dataEle = ElementUtil.getDataElement(startControl);
|
26921
|
-
if (dataEle && !dataEle.props.editable) {
|
26922
|
-
return false;
|
26923
|
-
}
|
26924
|
-
}
|
26925
|
-
return true;
|
27043
|
+
return ElementUtil.canSetCursor(startControl, startOffset, editable, this.viewOptions);
|
26926
27044
|
}
|
26927
27045
|
/**
|
26928
27046
|
* 修改光标
|
@@ -27122,10 +27240,11 @@ class DocEditor {
|
|
27122
27240
|
/**
|
27123
27241
|
* 新建文档
|
27124
27242
|
* @param doc
|
27243
|
+
* @param name
|
27125
27244
|
*/
|
27126
|
-
createNewDoc(doc = null) {
|
27245
|
+
createNewDoc(doc = null, name = 'A4') {
|
27127
27246
|
//this.docCtx.clear();
|
27128
|
-
const newDoc = doc ?? DocumentTemplate.
|
27247
|
+
const newDoc = doc ?? DocumentTemplate.createDoc(name);
|
27129
27248
|
// this.elementReader.setDocument(newDoc);
|
27130
27249
|
// this.refreshDocument('content');
|
27131
27250
|
this.loadDoc(ElementSerialize.serialize(newDoc, this.viewOptions));
|
@@ -27349,12 +27468,13 @@ class DocEditor {
|
|
27349
27468
|
this.resetViewer('force');
|
27350
27469
|
this.selectionState.clear();
|
27351
27470
|
}
|
27352
|
-
/**
|
27353
|
-
* 设置纸张大小,单位为毫米(mm)
|
27354
|
-
* @param width
|
27355
|
-
* @param height
|
27356
|
-
*/
|
27357
27471
|
setPaperSize(width, height) {
|
27472
|
+
if (typeof width === 'string') {
|
27473
|
+
const paperSize = DocumentTemplate.getPaper(width);
|
27474
|
+
width = paperSize.width;
|
27475
|
+
height = paperSize.height;
|
27476
|
+
}
|
27477
|
+
height = height;
|
27358
27478
|
const docProps = this.docCtx.document.props;
|
27359
27479
|
docProps.width = width;
|
27360
27480
|
docProps.height = height;
|
@@ -27564,7 +27684,7 @@ class DocEditor {
|
|
27564
27684
|
const vNodeFunc = this.renderRoot();
|
27565
27685
|
setActiveEditorContext(null);
|
27566
27686
|
const render = () => {
|
27567
|
-
|
27687
|
+
console.time('patch');
|
27568
27688
|
setActiveEditorContext(this);
|
27569
27689
|
const vNode = vNodeFunc.render();
|
27570
27690
|
setActiveEditorContext(null);
|
@@ -27576,7 +27696,7 @@ class DocEditor {
|
|
27576
27696
|
this.vNodeDocContent = this.nodePatch(this.svgContainer, vNode);
|
27577
27697
|
}
|
27578
27698
|
this.afterNodePatch.next();
|
27579
|
-
|
27699
|
+
console.timeEnd('patch');
|
27580
27700
|
};
|
27581
27701
|
render();
|
27582
27702
|
this.onShouldRender.subscribe(() => {
|