@hufe921/canvas-editor 0.9.90 → 0.9.92
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/CHANGELOG.md +42 -0
- package/dist/canvas-editor.es.js +312 -123
- package/dist/canvas-editor.es.js.map +1 -1
- package/dist/canvas-editor.umd.js +31 -30
- package/dist/canvas-editor.umd.js.map +1 -1
- package/dist/src/editor/core/actuator/Actuator.d.ts +7 -0
- package/dist/src/editor/core/actuator/handlers/positionContextChange.d.ts +3 -0
- package/dist/src/editor/core/command/Command.d.ts +1 -0
- package/dist/src/editor/core/command/CommandAdapt.d.ts +2 -1
- package/dist/src/editor/core/draw/Draw.d.ts +4 -0
- package/dist/src/editor/core/draw/control/date/DateControl.d.ts +1 -0
- package/dist/src/editor/core/draw/control/select/SelectControl.d.ts +1 -0
- package/dist/src/editor/core/draw/control/text/TextControl.d.ts +1 -0
- package/dist/src/editor/core/draw/frame/PageBorder.d.ts +9 -0
- package/dist/src/editor/core/draw/particle/date/DateParticle.d.ts +1 -0
- package/dist/src/editor/core/event/handlers/mousedown.d.ts +4 -0
- package/dist/src/editor/core/position/Position.d.ts +1 -0
- package/dist/src/editor/dataset/constant/PageBorder.d.ts +2 -0
- package/dist/src/editor/dataset/enum/Editor.d.ts +2 -1
- package/dist/src/editor/interface/Control.d.ts +2 -1
- package/dist/src/editor/interface/Editor.d.ts +6 -1
- package/dist/src/editor/interface/EventBus.d.ts +2 -1
- package/dist/src/editor/interface/Listener.d.ts +6 -0
- package/dist/src/editor/interface/PageBorder.d.ts +7 -0
- package/dist/src/editor/interface/table/Td.d.ts +4 -0
- package/dist/src/editor/interface/table/Tr.d.ts +2 -0
- package/dist/src/editor/utils/element.d.ts +3 -1
- package/package.json +1 -1
package/dist/canvas-editor.es.js
CHANGED
|
@@ -23,7 +23,7 @@ var __publicField = (obj, key, value) => {
|
|
|
23
23
|
return value;
|
|
24
24
|
};
|
|
25
25
|
var index = "";
|
|
26
|
-
const version = "0.9.
|
|
26
|
+
const version = "0.9.92";
|
|
27
27
|
var MaxHeightRatio;
|
|
28
28
|
(function(MaxHeightRatio2) {
|
|
29
29
|
MaxHeightRatio2["HALF"] = "half";
|
|
@@ -477,6 +477,8 @@ const EDITOR_ELEMENT_ZIP_ATTR = [
|
|
|
477
477
|
];
|
|
478
478
|
const TABLE_TD_ZIP_ATTR = [
|
|
479
479
|
"conceptId",
|
|
480
|
+
"extension",
|
|
481
|
+
"externalId",
|
|
480
482
|
"verticalAlign",
|
|
481
483
|
"backgroundColor",
|
|
482
484
|
"borderTypes",
|
|
@@ -3768,11 +3770,9 @@ function unzipElementList(elementList) {
|
|
|
3768
3770
|
return result;
|
|
3769
3771
|
}
|
|
3770
3772
|
function formatElementList(elementList, options) {
|
|
3771
|
-
const { isHandleFirstElement, editorOptions } =
|
|
3772
|
-
isHandleFirstElement: true
|
|
3773
|
-
}, options);
|
|
3773
|
+
const { isHandleFirstElement = true, isForceCompensation = false, editorOptions } = options;
|
|
3774
3774
|
const startElement = elementList[0];
|
|
3775
|
-
if (isHandleFirstElement && (startElement == null ? void 0 : startElement.type) !== ElementType.LIST && ((startElement == null ? void 0 : startElement.type) && startElement.type !== ElementType.TEXT || !START_LINE_BREAK_REG.test(startElement == null ? void 0 : startElement.value))) {
|
|
3775
|
+
if (isForceCompensation || isHandleFirstElement && (startElement == null ? void 0 : startElement.type) !== ElementType.LIST && ((startElement == null ? void 0 : startElement.type) && startElement.type !== ElementType.TEXT || !START_LINE_BREAK_REG.test(startElement == null ? void 0 : startElement.value))) {
|
|
3776
3776
|
elementList.unshift({
|
|
3777
3777
|
value: ZERO
|
|
3778
3778
|
});
|
|
@@ -3784,7 +3784,8 @@ function formatElementList(elementList, options) {
|
|
|
3784
3784
|
elementList.splice(i, 1);
|
|
3785
3785
|
const valueList = el.valueList || [];
|
|
3786
3786
|
formatElementList(valueList, __spreadProps(__spreadValues({}, options), {
|
|
3787
|
-
isHandleFirstElement: false
|
|
3787
|
+
isHandleFirstElement: false,
|
|
3788
|
+
isForceCompensation: false
|
|
3788
3789
|
}));
|
|
3789
3790
|
if (valueList.length) {
|
|
3790
3791
|
const titleId = getUUID();
|
|
@@ -3813,7 +3814,8 @@ function formatElementList(elementList, options) {
|
|
|
3813
3814
|
elementList.splice(i, 1);
|
|
3814
3815
|
const valueList = el.valueList || [];
|
|
3815
3816
|
formatElementList(valueList, __spreadProps(__spreadValues({}, options), {
|
|
3816
|
-
isHandleFirstElement: true
|
|
3817
|
+
isHandleFirstElement: true,
|
|
3818
|
+
isForceCompensation: false
|
|
3817
3819
|
}));
|
|
3818
3820
|
if (valueList.length) {
|
|
3819
3821
|
const listId = getUUID();
|
|
@@ -3847,7 +3849,8 @@ function formatElementList(elementList, options) {
|
|
|
3847
3849
|
const tdId = getUUID();
|
|
3848
3850
|
td.id = tdId;
|
|
3849
3851
|
formatElementList(td.value, __spreadProps(__spreadValues({}, options), {
|
|
3850
|
-
isHandleFirstElement: true
|
|
3852
|
+
isHandleFirstElement: true,
|
|
3853
|
+
isForceCompensation: true
|
|
3851
3854
|
}));
|
|
3852
3855
|
for (let v = 0; v < td.value.length; v++) {
|
|
3853
3856
|
const value = td.value[v];
|
|
@@ -4002,7 +4005,8 @@ function formatElementList(elementList, options) {
|
|
|
4002
4005
|
}
|
|
4003
4006
|
}
|
|
4004
4007
|
formatElementList(valueList, __spreadProps(__spreadValues({}, options), {
|
|
4005
|
-
isHandleFirstElement: false
|
|
4008
|
+
isHandleFirstElement: false,
|
|
4009
|
+
isForceCompensation: false
|
|
4006
4010
|
}));
|
|
4007
4011
|
for (let v = 0; v < valueList.length; v++) {
|
|
4008
4012
|
const element = valueList[v];
|
|
@@ -4055,7 +4059,7 @@ function formatElementList(elementList, options) {
|
|
|
4055
4059
|
}
|
|
4056
4060
|
el = elementList[i];
|
|
4057
4061
|
}
|
|
4058
|
-
if (el.value === "\n") {
|
|
4062
|
+
if (el.value === "\n" || el.value == "\r\n") {
|
|
4059
4063
|
el.value = ZERO;
|
|
4060
4064
|
}
|
|
4061
4065
|
if (el.type === ElementType.IMAGE || el.type === ElementType.BLOCK) {
|
|
@@ -4354,10 +4358,11 @@ function formatElementContext(sourceElementList, formatElementList2, anchorIndex
|
|
|
4354
4358
|
let copyElement = getAnchorElement(sourceElementList, anchorIndex);
|
|
4355
4359
|
if (!copyElement)
|
|
4356
4360
|
return;
|
|
4357
|
-
|
|
4361
|
+
const { isBreakWhenWrap = false, editorOptions } = options || {};
|
|
4362
|
+
const { mode } = editorOptions || {};
|
|
4363
|
+
if (mode !== EditorMode.DESIGN && ((_a = copyElement.title) == null ? void 0 : _a.disabled)) {
|
|
4358
4364
|
copyElement = omitObject(copyElement, TITLE_CONTEXT_ATTR);
|
|
4359
4365
|
}
|
|
4360
|
-
const { isBreakWhenWrap = false } = options || {};
|
|
4361
4366
|
let isBreakWarped = false;
|
|
4362
4367
|
for (let e = 0; e < formatElementList2.length; e++) {
|
|
4363
4368
|
const targetElement = formatElementList2[e];
|
|
@@ -4373,7 +4378,7 @@ function formatElementContext(sourceElementList, formatElementList2, anchorIndex
|
|
|
4373
4378
|
continue;
|
|
4374
4379
|
}
|
|
4375
4380
|
if ((_c = targetElement.valueList) == null ? void 0 : _c.length) {
|
|
4376
|
-
formatElementContext(sourceElementList, targetElement.valueList, anchorIndex);
|
|
4381
|
+
formatElementContext(sourceElementList, targetElement.valueList, anchorIndex, options);
|
|
4377
4382
|
}
|
|
4378
4383
|
const cloneAttr = [...EDITOR_ELEMENT_CONTEXT_ATTR];
|
|
4379
4384
|
if (!getIsBlockElement(targetElement)) {
|
|
@@ -5026,7 +5031,8 @@ function pasteElement(host, elementList) {
|
|
|
5026
5031
|
}
|
|
5027
5032
|
}
|
|
5028
5033
|
formatElementContext(originalElementList, elementList, startIndex, {
|
|
5029
|
-
isBreakWhenWrap: true
|
|
5034
|
+
isBreakWhenWrap: true,
|
|
5035
|
+
editorOptions: draw.getOptions()
|
|
5030
5036
|
});
|
|
5031
5037
|
}
|
|
5032
5038
|
draw.insertElementList(elementList);
|
|
@@ -5061,7 +5067,9 @@ function pasteImage(host, file) {
|
|
|
5061
5067
|
height: image.height
|
|
5062
5068
|
};
|
|
5063
5069
|
if (~startIndex) {
|
|
5064
|
-
formatElementContext(elementList, [imageElement], startIndex
|
|
5070
|
+
formatElementContext(elementList, [imageElement], startIndex, {
|
|
5071
|
+
editorOptions: draw.getOptions()
|
|
5072
|
+
});
|
|
5065
5073
|
}
|
|
5066
5074
|
draw.insertElementList([imageElement]);
|
|
5067
5075
|
};
|
|
@@ -5389,6 +5397,7 @@ var EditorMode;
|
|
|
5389
5397
|
EditorMode2["READONLY"] = "readonly";
|
|
5390
5398
|
EditorMode2["FORM"] = "form";
|
|
5391
5399
|
EditorMode2["PRINT"] = "print";
|
|
5400
|
+
EditorMode2["DESIGN"] = "design";
|
|
5392
5401
|
})(EditorMode || (EditorMode = {}));
|
|
5393
5402
|
var EditorZone;
|
|
5394
5403
|
(function(EditorZone2) {
|
|
@@ -5593,7 +5602,10 @@ class CheckboxControl {
|
|
|
5593
5602
|
nextIndex++;
|
|
5594
5603
|
}
|
|
5595
5604
|
control.code = codes.join(",");
|
|
5596
|
-
this.control.repaintControl(
|
|
5605
|
+
this.control.repaintControl({
|
|
5606
|
+
curIndex: startIndex,
|
|
5607
|
+
isSetCursor: false
|
|
5608
|
+
});
|
|
5597
5609
|
}
|
|
5598
5610
|
keydown(evt) {
|
|
5599
5611
|
if (this.control.getIsDisabledControl()) {
|
|
@@ -5645,7 +5657,10 @@ class RadioControl extends CheckboxControl {
|
|
|
5645
5657
|
nextIndex++;
|
|
5646
5658
|
}
|
|
5647
5659
|
control.code = codes.join(",");
|
|
5648
|
-
this.control.repaintControl(
|
|
5660
|
+
this.control.repaintControl({
|
|
5661
|
+
curIndex: startIndex,
|
|
5662
|
+
isSetCursor: false
|
|
5663
|
+
});
|
|
5649
5664
|
}
|
|
5650
5665
|
}
|
|
5651
5666
|
function setRangeCache(host) {
|
|
@@ -5658,7 +5673,40 @@ function setRangeCache(host) {
|
|
|
5658
5673
|
host.cachePositionList = position.getPositionList();
|
|
5659
5674
|
host.cachePositionContext = position.getPositionContext();
|
|
5660
5675
|
}
|
|
5676
|
+
function hitCheckbox(element, draw) {
|
|
5677
|
+
const { checkbox, control } = element;
|
|
5678
|
+
if (!control) {
|
|
5679
|
+
draw.getCheckboxParticle().setSelect(element);
|
|
5680
|
+
} else {
|
|
5681
|
+
const codes = (control == null ? void 0 : control.code) ? control.code.split(",") : [];
|
|
5682
|
+
if (checkbox == null ? void 0 : checkbox.value) {
|
|
5683
|
+
const codeIndex = codes.findIndex((c) => c === checkbox.code);
|
|
5684
|
+
codes.splice(codeIndex, 1);
|
|
5685
|
+
} else {
|
|
5686
|
+
if (checkbox == null ? void 0 : checkbox.code) {
|
|
5687
|
+
codes.push(checkbox.code);
|
|
5688
|
+
}
|
|
5689
|
+
}
|
|
5690
|
+
const activeControl = draw.getControl().getActiveControl();
|
|
5691
|
+
if (activeControl instanceof CheckboxControl) {
|
|
5692
|
+
activeControl.setSelect(codes);
|
|
5693
|
+
}
|
|
5694
|
+
}
|
|
5695
|
+
}
|
|
5696
|
+
function hitRadio(element, draw) {
|
|
5697
|
+
const { radio, control } = element;
|
|
5698
|
+
if (!control) {
|
|
5699
|
+
draw.getRadioParticle().setSelect(element);
|
|
5700
|
+
} else {
|
|
5701
|
+
const codes = (radio == null ? void 0 : radio.code) ? [radio.code] : [];
|
|
5702
|
+
const activeControl = draw.getControl().getActiveControl();
|
|
5703
|
+
if (activeControl instanceof RadioControl) {
|
|
5704
|
+
activeControl.setSelect(codes);
|
|
5705
|
+
}
|
|
5706
|
+
}
|
|
5707
|
+
}
|
|
5661
5708
|
function mousedown(evt, host) {
|
|
5709
|
+
var _a, _b;
|
|
5662
5710
|
if (evt.button === MouseEventButton.RIGHT)
|
|
5663
5711
|
return;
|
|
5664
5712
|
const draw = host.getDraw();
|
|
@@ -5719,37 +5767,22 @@ function mousedown(evt, host) {
|
|
|
5719
5767
|
}
|
|
5720
5768
|
rangeManager.setRange(startIndex, endIndex);
|
|
5721
5769
|
position.setCursorPosition(positionList[curIndex]);
|
|
5722
|
-
|
|
5723
|
-
|
|
5724
|
-
if (
|
|
5725
|
-
|
|
5726
|
-
|
|
5727
|
-
|
|
5728
|
-
|
|
5729
|
-
const
|
|
5730
|
-
if (
|
|
5731
|
-
|
|
5732
|
-
|
|
5733
|
-
} else {
|
|
5734
|
-
|
|
5735
|
-
|
|
5736
|
-
}
|
|
5737
|
-
}
|
|
5738
|
-
const activeControl = draw.getControl().getActiveControl();
|
|
5739
|
-
if (activeControl instanceof CheckboxControl) {
|
|
5740
|
-
activeControl.setSelect(codes);
|
|
5741
|
-
}
|
|
5742
|
-
}
|
|
5743
|
-
} else if (isSetRadio) {
|
|
5744
|
-
const { control, radio } = curElement;
|
|
5745
|
-
if (!control) {
|
|
5746
|
-
draw.getRadioParticle().setSelect(curElement);
|
|
5747
|
-
} else {
|
|
5748
|
-
const codes = (radio == null ? void 0 : radio.code) ? [radio.code] : [];
|
|
5749
|
-
const activeControl = draw.getControl().getActiveControl();
|
|
5750
|
-
if (activeControl instanceof RadioControl) {
|
|
5751
|
-
activeControl.setSelect(codes);
|
|
5770
|
+
if (isDirectHitCheckbox && !isReadonly) {
|
|
5771
|
+
hitCheckbox(curElement, draw);
|
|
5772
|
+
} else if (isDirectHitRadio && !isReadonly) {
|
|
5773
|
+
hitRadio(curElement, draw);
|
|
5774
|
+
} else if (curElement.controlComponent === ControlComponent.VALUE && (((_a = curElement.control) == null ? void 0 : _a.type) === ControlType.CHECKBOX || ((_b = curElement.control) == null ? void 0 : _b.type) === ControlType.RADIO)) {
|
|
5775
|
+
let preIndex = curIndex;
|
|
5776
|
+
while (preIndex > 0) {
|
|
5777
|
+
const preElement = elementList[preIndex];
|
|
5778
|
+
if (preElement.controlComponent === ControlComponent.CHECKBOX) {
|
|
5779
|
+
hitCheckbox(preElement, draw);
|
|
5780
|
+
break;
|
|
5781
|
+
} else if (preElement.controlComponent === ControlComponent.RADIO) {
|
|
5782
|
+
hitRadio(preElement, draw);
|
|
5783
|
+
break;
|
|
5752
5784
|
}
|
|
5785
|
+
preIndex--;
|
|
5753
5786
|
}
|
|
5754
5787
|
} else {
|
|
5755
5788
|
draw.render({
|
|
@@ -5915,7 +5948,9 @@ function mouseup(evt, host) {
|
|
|
5915
5948
|
return newElement;
|
|
5916
5949
|
}
|
|
5917
5950
|
});
|
|
5918
|
-
formatElementContext(elementList, replaceElementList, range.startIndex
|
|
5951
|
+
formatElementContext(elementList, replaceElementList, range.startIndex, {
|
|
5952
|
+
editorOptions: draw.getOptions()
|
|
5953
|
+
});
|
|
5919
5954
|
const cacheStartElement = cacheElementList[cacheStartIndex];
|
|
5920
5955
|
const cacheStartPosition = cachePositionList[cacheStartIndex];
|
|
5921
5956
|
const cacheRangeStartId = createDragId(cacheElementList[cacheStartIndex]);
|
|
@@ -6244,7 +6279,8 @@ function enter(evt, host) {
|
|
|
6244
6279
|
enterText.listWrap = true;
|
|
6245
6280
|
}
|
|
6246
6281
|
formatElementContext(elementList, [enterText], startIndex, {
|
|
6247
|
-
isBreakWhenWrap: true
|
|
6282
|
+
isBreakWhenWrap: true,
|
|
6283
|
+
editorOptions: draw.getOptions()
|
|
6248
6284
|
});
|
|
6249
6285
|
if (!(endElement.titleId && endElement.titleId !== ((_b = elementList[endIndex + 1]) == null ? void 0 : _b.titleId))) {
|
|
6250
6286
|
const copyElement = getAnchorElement(elementList, endIndex);
|
|
@@ -6584,7 +6620,9 @@ function tab(evt, host) {
|
|
|
6584
6620
|
const rangeManager = draw.getRange();
|
|
6585
6621
|
const { startIndex } = rangeManager.getRange();
|
|
6586
6622
|
const elementList = draw.getElementList();
|
|
6587
|
-
formatElementContext(elementList, [tabElement], startIndex
|
|
6623
|
+
formatElementContext(elementList, [tabElement], startIndex, {
|
|
6624
|
+
editorOptions: draw.getOptions()
|
|
6625
|
+
});
|
|
6588
6626
|
draw.insertElementList([tabElement]);
|
|
6589
6627
|
}
|
|
6590
6628
|
}
|
|
@@ -6960,12 +6998,13 @@ function input(data2, host) {
|
|
|
6960
6998
|
const copyElement = getAnchorElement(elementList, endIndex);
|
|
6961
6999
|
if (!copyElement)
|
|
6962
7000
|
return;
|
|
7001
|
+
const isDesignMode = draw.isDesignMode();
|
|
6963
7002
|
const inputData = splitText(text).map((value) => {
|
|
6964
7003
|
var _a2, _b;
|
|
6965
7004
|
const newElement = {
|
|
6966
7005
|
value
|
|
6967
7006
|
};
|
|
6968
|
-
if (!((_a2 = copyElement.title) == null ? void 0 : _a2.disabled) && !((_b = copyElement.control) == null ? void 0 : _b.disabled)) {
|
|
7007
|
+
if (isDesignMode || !((_a2 = copyElement.title) == null ? void 0 : _a2.disabled) && !((_b = copyElement.control) == null ? void 0 : _b.disabled)) {
|
|
6969
7008
|
const nextElement = elementList[endIndex + 1];
|
|
6970
7009
|
if (!copyElement.type || copyElement.type === TEXT || copyElement.type === HYPERLINK && (nextElement == null ? void 0 : nextElement.type) === HYPERLINK || copyElement.type === DATE && (nextElement == null ? void 0 : nextElement.type) === DATE || copyElement.type === SUBSCRIPT && (nextElement == null ? void 0 : nextElement.type) === SUBSCRIPT || copyElement.type === SUPERSCRIPT && (nextElement == null ? void 0 : nextElement.type) === SUPERSCRIPT) {
|
|
6971
7010
|
EDITOR_ELEMENT_COPY_ATTR.forEach((attr) => {
|
|
@@ -6992,7 +7031,9 @@ function input(data2, host) {
|
|
|
6992
7031
|
if (startIndex !== endIndex) {
|
|
6993
7032
|
draw.spliceElementList(elementList, start, endIndex - startIndex);
|
|
6994
7033
|
}
|
|
6995
|
-
formatElementContext(elementList, inputData, startIndex
|
|
7034
|
+
formatElementContext(elementList, inputData, startIndex, {
|
|
7035
|
+
editorOptions: draw.getOptions()
|
|
7036
|
+
});
|
|
6996
7037
|
draw.spliceElementList(elementList, start, 0, ...inputData);
|
|
6997
7038
|
curIndex = startIndex + inputData.length;
|
|
6998
7039
|
}
|
|
@@ -7695,6 +7736,7 @@ class Position {
|
|
|
7695
7736
|
__publicField(this, "positionList");
|
|
7696
7737
|
__publicField(this, "floatPositionList");
|
|
7697
7738
|
__publicField(this, "draw");
|
|
7739
|
+
__publicField(this, "eventBus");
|
|
7698
7740
|
__publicField(this, "options");
|
|
7699
7741
|
this.positionList = [];
|
|
7700
7742
|
this.floatPositionList = [];
|
|
@@ -7704,6 +7746,7 @@ class Position {
|
|
|
7704
7746
|
isControl: false
|
|
7705
7747
|
};
|
|
7706
7748
|
this.draw = draw;
|
|
7749
|
+
this.eventBus = draw.getEventBus();
|
|
7707
7750
|
this.options = draw.getOptions();
|
|
7708
7751
|
}
|
|
7709
7752
|
getFloatPositionList() {
|
|
@@ -7920,6 +7963,10 @@ class Position {
|
|
|
7920
7963
|
return this.positionContext;
|
|
7921
7964
|
}
|
|
7922
7965
|
setPositionContext(payload) {
|
|
7966
|
+
this.eventBus.emit("positionContextChange", {
|
|
7967
|
+
value: payload,
|
|
7968
|
+
oldValue: this.positionContext
|
|
7969
|
+
});
|
|
7923
7970
|
this.positionContext = payload;
|
|
7924
7971
|
}
|
|
7925
7972
|
getPositionByXY(payload) {
|
|
@@ -8526,7 +8573,7 @@ class RangeManager {
|
|
|
8526
8573
|
this.setRange(range.startIndex, range.endIndex, range.tableId, range.startTdIndex, range.endTdIndex, range.startTrIndex, range.endTrIndex);
|
|
8527
8574
|
}
|
|
8528
8575
|
setRangeStyle() {
|
|
8529
|
-
var _a;
|
|
8576
|
+
var _a, _b;
|
|
8530
8577
|
const rangeStyleChangeListener = this.listener.rangeStyleChange;
|
|
8531
8578
|
const isSubscribeRangeStyleChange = this.eventBus.isSubscribe("rangeStyleChange");
|
|
8532
8579
|
if (!rangeStyleChangeListener && !isSubscribeRangeStyleChange)
|
|
@@ -8560,7 +8607,7 @@ class RangeManager {
|
|
|
8560
8607
|
const color = curElement.color || null;
|
|
8561
8608
|
const highlight = curElement.highlight || null;
|
|
8562
8609
|
const rowFlex = curElement.rowFlex || null;
|
|
8563
|
-
const rowMargin = curElement.rowMargin
|
|
8610
|
+
const rowMargin = (_a = curElement.rowMargin) != null ? _a : this.options.defaultRowMargin;
|
|
8564
8611
|
const dashArray = curElement.dashArray || [];
|
|
8565
8612
|
const level = curElement.level || null;
|
|
8566
8613
|
const listType = curElement.listType || null;
|
|
@@ -8570,7 +8617,7 @@ class RangeManager {
|
|
|
8570
8617
|
const undo = this.historyManager.isCanUndo();
|
|
8571
8618
|
const redo = this.historyManager.isCanRedo();
|
|
8572
8619
|
const groupIds = curElement.groupIds || null;
|
|
8573
|
-
const extension = (
|
|
8620
|
+
const extension = (_b = curElement.extension) != null ? _b : null;
|
|
8574
8621
|
const rangeStyle = {
|
|
8575
8622
|
type,
|
|
8576
8623
|
undo,
|
|
@@ -10681,6 +10728,8 @@ class SelectControl {
|
|
|
10681
10728
|
__publicField(this, "control");
|
|
10682
10729
|
__publicField(this, "isPopup");
|
|
10683
10730
|
__publicField(this, "selectDom");
|
|
10731
|
+
__publicField(this, "options");
|
|
10732
|
+
this.options = control.getDraw().getOptions();
|
|
10684
10733
|
this.element = element;
|
|
10685
10734
|
this.control = control;
|
|
10686
10735
|
this.isPopup = false;
|
|
@@ -10857,7 +10906,9 @@ class SelectControl {
|
|
|
10857
10906
|
value: data2[i],
|
|
10858
10907
|
controlComponent: ControlComponent.VALUE
|
|
10859
10908
|
});
|
|
10860
|
-
formatElementContext(elementList, [newElement], prefixIndex
|
|
10909
|
+
formatElementContext(elementList, [newElement], prefixIndex, {
|
|
10910
|
+
editorOptions: this.options
|
|
10911
|
+
});
|
|
10861
10912
|
draw.spliceElementList(elementList, start + i, 0, newElement);
|
|
10862
10913
|
}
|
|
10863
10914
|
control.code = code;
|
|
@@ -10927,6 +10978,8 @@ class TextControl {
|
|
|
10927
10978
|
constructor(element, control) {
|
|
10928
10979
|
__publicField(this, "element");
|
|
10929
10980
|
__publicField(this, "control");
|
|
10981
|
+
__publicField(this, "options");
|
|
10982
|
+
this.options = control.getDraw().getOptions();
|
|
10930
10983
|
this.element = element;
|
|
10931
10984
|
this.control = control;
|
|
10932
10985
|
}
|
|
@@ -10990,7 +11043,9 @@ class TextControl {
|
|
|
10990
11043
|
const newElement = __spreadProps(__spreadValues(__spreadValues({}, anchorElement), data2[i]), {
|
|
10991
11044
|
controlComponent: ControlComponent.VALUE
|
|
10992
11045
|
});
|
|
10993
|
-
formatElementContext(elementList, [newElement], startIndex
|
|
11046
|
+
formatElementContext(elementList, [newElement], startIndex, {
|
|
11047
|
+
editorOptions: this.options
|
|
11048
|
+
});
|
|
10994
11049
|
draw.spliceElementList(elementList, start + i, 0, newElement);
|
|
10995
11050
|
}
|
|
10996
11051
|
return start + data2.length - 1;
|
|
@@ -11548,8 +11603,10 @@ class DateControl {
|
|
|
11548
11603
|
__publicField(this, "control");
|
|
11549
11604
|
__publicField(this, "isPopup");
|
|
11550
11605
|
__publicField(this, "datePicker");
|
|
11606
|
+
__publicField(this, "options");
|
|
11551
11607
|
const draw = control.getDraw();
|
|
11552
11608
|
this.draw = draw;
|
|
11609
|
+
this.options = draw.getOptions();
|
|
11553
11610
|
this.element = element;
|
|
11554
11611
|
this.control = control;
|
|
11555
11612
|
this.isPopup = false;
|
|
@@ -11628,7 +11685,9 @@ class DateControl {
|
|
|
11628
11685
|
const newElement = __spreadProps(__spreadValues(__spreadValues({}, anchorElement), data2[i]), {
|
|
11629
11686
|
controlComponent: ControlComponent.VALUE
|
|
11630
11687
|
});
|
|
11631
|
-
formatElementContext(elementList, [newElement], startIndex
|
|
11688
|
+
formatElementContext(elementList, [newElement], startIndex, {
|
|
11689
|
+
editorOptions: this.options
|
|
11690
|
+
});
|
|
11632
11691
|
draw.spliceElementList(elementList, start + i, 0, newElement);
|
|
11633
11692
|
}
|
|
11634
11693
|
return start + data2.length - 1;
|
|
@@ -11674,7 +11733,9 @@ class DateControl {
|
|
|
11674
11733
|
value: date[i],
|
|
11675
11734
|
controlComponent: ControlComponent.VALUE
|
|
11676
11735
|
});
|
|
11677
|
-
formatElementContext(elementList, [newElement], prefixIndex
|
|
11736
|
+
formatElementContext(elementList, [newElement], prefixIndex, {
|
|
11737
|
+
editorOptions: this.options
|
|
11738
|
+
});
|
|
11678
11739
|
draw.spliceElementList(elementList, start + i, 0, newElement);
|
|
11679
11740
|
}
|
|
11680
11741
|
if (!context.range) {
|
|
@@ -11919,7 +11980,7 @@ class Control {
|
|
|
11919
11980
|
}
|
|
11920
11981
|
getIsDisabledControl(context = {}) {
|
|
11921
11982
|
var _a, _b;
|
|
11922
|
-
if (!this.activeControl)
|
|
11983
|
+
if (this.draw.isDesignMode() || !this.activeControl)
|
|
11923
11984
|
return false;
|
|
11924
11985
|
const { startIndex, endIndex } = context.range || this.range.getRange();
|
|
11925
11986
|
if (startIndex === endIndex && ~startIndex && ~endIndex) {
|
|
@@ -12036,7 +12097,7 @@ class Control {
|
|
|
12036
12097
|
}
|
|
12037
12098
|
}
|
|
12038
12099
|
repaintControl(options = {}) {
|
|
12039
|
-
const { curIndex, isCompute = true, isSubmitHistory = true } = options;
|
|
12100
|
+
const { curIndex, isCompute = true, isSubmitHistory = true, isSetCursor = true } = options;
|
|
12040
12101
|
if (curIndex === void 0) {
|
|
12041
12102
|
this.range.clearRange();
|
|
12042
12103
|
this.draw.render({
|
|
@@ -12049,6 +12110,7 @@ class Control {
|
|
|
12049
12110
|
this.draw.render({
|
|
12050
12111
|
curIndex,
|
|
12051
12112
|
isCompute,
|
|
12113
|
+
isSetCursor,
|
|
12052
12114
|
isSubmitHistory
|
|
12053
12115
|
});
|
|
12054
12116
|
}
|
|
@@ -12126,9 +12188,11 @@ class Control {
|
|
|
12126
12188
|
removeControl(startIndex, context = {}) {
|
|
12127
12189
|
const elementList = context.elementList || this.getElementList();
|
|
12128
12190
|
const startElement = elementList[startIndex];
|
|
12129
|
-
|
|
12130
|
-
|
|
12131
|
-
|
|
12191
|
+
if (!this.draw.isDesignMode()) {
|
|
12192
|
+
const { deletable = true } = startElement.control;
|
|
12193
|
+
if (!deletable)
|
|
12194
|
+
return null;
|
|
12195
|
+
}
|
|
12132
12196
|
let leftIndex = -1;
|
|
12133
12197
|
let rightIndex = -1;
|
|
12134
12198
|
let preIndex = startIndex;
|
|
@@ -12200,7 +12264,9 @@ class Control {
|
|
|
12200
12264
|
controlComponent: ControlComponent.PLACEHOLDER,
|
|
12201
12265
|
color: this.controlOptions.placeholderColor
|
|
12202
12266
|
});
|
|
12203
|
-
formatElementContext(elementList, [newElement], startIndex
|
|
12267
|
+
formatElementContext(elementList, [newElement], startIndex, {
|
|
12268
|
+
editorOptions: this.options
|
|
12269
|
+
});
|
|
12204
12270
|
this.draw.spliceElementList(elementList, startIndex + p + 1, 0, newElement);
|
|
12205
12271
|
}
|
|
12206
12272
|
}
|
|
@@ -12506,7 +12572,8 @@ class Control {
|
|
|
12506
12572
|
const elementList = zipElementList(pageComponentData[pageComponentKey]);
|
|
12507
12573
|
pageComponentData[pageComponentKey] = elementList;
|
|
12508
12574
|
formatElementList(elementList, {
|
|
12509
|
-
editorOptions: this.options
|
|
12575
|
+
editorOptions: this.options,
|
|
12576
|
+
isForceCompensation: true
|
|
12510
12577
|
});
|
|
12511
12578
|
}
|
|
12512
12579
|
this.draw.setEditorData(pageComponentData);
|
|
@@ -13088,10 +13155,12 @@ class Previewer {
|
|
|
13088
13155
|
return { x, y };
|
|
13089
13156
|
}
|
|
13090
13157
|
_createResizerDom() {
|
|
13158
|
+
const { scale } = this.options;
|
|
13091
13159
|
const resizerSelection = document.createElement("div");
|
|
13092
13160
|
resizerSelection.classList.add(`${EDITOR_PREFIX}-resizer-selection`);
|
|
13093
13161
|
resizerSelection.style.display = "none";
|
|
13094
13162
|
resizerSelection.style.borderColor = this.options.resizerColor;
|
|
13163
|
+
resizerSelection.style.borderWidth = `${scale}px`;
|
|
13095
13164
|
const resizerHandleList = [];
|
|
13096
13165
|
for (let i = 0; i < 8; i++) {
|
|
13097
13166
|
const handleDom = document.createElement("div");
|
|
@@ -13344,12 +13413,13 @@ class Previewer {
|
|
|
13344
13413
|
document.body.style.overflow = "auto";
|
|
13345
13414
|
}
|
|
13346
13415
|
_updateResizerRect(width, height) {
|
|
13347
|
-
const handleSize = this.options
|
|
13416
|
+
const { resizerSize: handleSize, scale } = this.options;
|
|
13348
13417
|
this.resizerSelection.style.width = `${width}px`;
|
|
13349
13418
|
this.resizerSelection.style.height = `${height}px`;
|
|
13350
13419
|
for (let i = 0; i < 8; i++) {
|
|
13351
13420
|
const left2 = i === 0 || i === 6 || i === 7 ? -handleSize : i === 1 || i === 5 ? width / 2 : width - handleSize;
|
|
13352
13421
|
const top = i === 0 || i === 1 || i === 2 ? -handleSize : i === 3 || i === 7 ? height / 2 - handleSize : height - handleSize;
|
|
13422
|
+
this.resizerHandleList[i].style.transform = `scale(${scale})`;
|
|
13353
13423
|
this.resizerHandleList[i].style.left = `${left2}px`;
|
|
13354
13424
|
this.resizerHandleList[i].style.top = `${top}px`;
|
|
13355
13425
|
}
|
|
@@ -13375,6 +13445,7 @@ class Previewer {
|
|
|
13375
13445
|
const { x: resizerLeft, y: resizerTop } = this._getElementPosition(element, position);
|
|
13376
13446
|
this.resizerSelection.style.left = `${resizerLeft}px`;
|
|
13377
13447
|
this.resizerSelection.style.top = `${resizerTop}px`;
|
|
13448
|
+
this.resizerSelection.style.borderWidth = `${scale}px`;
|
|
13378
13449
|
this._updateResizerRect(elementWidth, elementHeight);
|
|
13379
13450
|
this.resizerSelection.style.display = "block";
|
|
13380
13451
|
this.curElement = element;
|
|
@@ -13392,7 +13463,9 @@ class DateParticle {
|
|
|
13392
13463
|
__publicField(this, "draw");
|
|
13393
13464
|
__publicField(this, "range");
|
|
13394
13465
|
__publicField(this, "datePicker");
|
|
13466
|
+
__publicField(this, "options");
|
|
13395
13467
|
this.draw = draw;
|
|
13468
|
+
this.options = draw.getOptions();
|
|
13396
13469
|
this.range = draw.getRange();
|
|
13397
13470
|
this.datePicker = new DatePicker(draw, {
|
|
13398
13471
|
onSubmit: this._setValue.bind(this)
|
|
@@ -13419,7 +13492,9 @@ class DateParticle {
|
|
|
13419
13492
|
}
|
|
13420
13493
|
]
|
|
13421
13494
|
};
|
|
13422
|
-
formatElementContext(elementList, [dateElement], leftIndex
|
|
13495
|
+
formatElementContext(elementList, [dateElement], leftIndex, {
|
|
13496
|
+
editorOptions: this.options
|
|
13497
|
+
});
|
|
13423
13498
|
this.draw.insertElementList([dateElement]);
|
|
13424
13499
|
}
|
|
13425
13500
|
getDateElementRange() {
|
|
@@ -14472,7 +14547,8 @@ class Placeholder {
|
|
|
14472
14547
|
}
|
|
14473
14548
|
];
|
|
14474
14549
|
formatElementList(this.elementList, {
|
|
14475
|
-
editorOptions: this.options
|
|
14550
|
+
editorOptions: this.options,
|
|
14551
|
+
isForceCompensation: true
|
|
14476
14552
|
});
|
|
14477
14553
|
this._compute();
|
|
14478
14554
|
const innerWidth = this.draw.getInnerWidth();
|
|
@@ -14715,6 +14791,53 @@ class LineNumber {
|
|
|
14715
14791
|
ctx.restore();
|
|
14716
14792
|
}
|
|
14717
14793
|
}
|
|
14794
|
+
class PageBorder {
|
|
14795
|
+
constructor(draw) {
|
|
14796
|
+
__publicField(this, "draw");
|
|
14797
|
+
__publicField(this, "header");
|
|
14798
|
+
__publicField(this, "footer");
|
|
14799
|
+
__publicField(this, "options");
|
|
14800
|
+
this.draw = draw;
|
|
14801
|
+
this.header = draw.getHeader();
|
|
14802
|
+
this.footer = draw.getFooter();
|
|
14803
|
+
this.options = draw.getOptions();
|
|
14804
|
+
}
|
|
14805
|
+
render(ctx) {
|
|
14806
|
+
const { scale, pageBorder: { color, lineWidth, padding } } = this.options;
|
|
14807
|
+
ctx.save();
|
|
14808
|
+
ctx.translate(0.5, 0.5);
|
|
14809
|
+
ctx.strokeStyle = color;
|
|
14810
|
+
ctx.lineWidth = lineWidth * scale;
|
|
14811
|
+
const margins = this.draw.getMargins();
|
|
14812
|
+
const x = margins[3] - padding[3] * scale;
|
|
14813
|
+
const y = margins[0] + this.header.getExtraHeight() - padding[0] * scale;
|
|
14814
|
+
const width = this.draw.getInnerWidth() + (padding[1] + padding[3]) * scale;
|
|
14815
|
+
const height = this.draw.getHeight() - y - this.footer.getExtraHeight() - margins[2] + padding[2] * scale;
|
|
14816
|
+
ctx.rect(x, y, width, height);
|
|
14817
|
+
ctx.stroke();
|
|
14818
|
+
ctx.restore();
|
|
14819
|
+
}
|
|
14820
|
+
}
|
|
14821
|
+
function positionContextChange(draw, payload) {
|
|
14822
|
+
const { value, oldValue } = payload;
|
|
14823
|
+
if (oldValue.isTable && !value.isTable) {
|
|
14824
|
+
draw.getTableTool().dispose();
|
|
14825
|
+
}
|
|
14826
|
+
}
|
|
14827
|
+
class Actuator {
|
|
14828
|
+
constructor(draw) {
|
|
14829
|
+
__publicField(this, "draw");
|
|
14830
|
+
__publicField(this, "eventBus");
|
|
14831
|
+
this.draw = draw;
|
|
14832
|
+
this.eventBus = draw.getEventBus();
|
|
14833
|
+
this.execute();
|
|
14834
|
+
}
|
|
14835
|
+
execute() {
|
|
14836
|
+
this.eventBus.on("positionContextChange", (payload) => {
|
|
14837
|
+
positionContextChange(this.draw, payload);
|
|
14838
|
+
});
|
|
14839
|
+
}
|
|
14840
|
+
}
|
|
14718
14841
|
class Draw {
|
|
14719
14842
|
constructor(rootContainer, options, data2, listener, eventBus, override) {
|
|
14720
14843
|
__publicField(this, "container");
|
|
@@ -14768,6 +14891,7 @@ class Draw {
|
|
|
14768
14891
|
__publicField(this, "listParticle");
|
|
14769
14892
|
__publicField(this, "lineBreakParticle");
|
|
14770
14893
|
__publicField(this, "control");
|
|
14894
|
+
__publicField(this, "pageBorder");
|
|
14771
14895
|
__publicField(this, "workerManager");
|
|
14772
14896
|
__publicField(this, "scrollObserver");
|
|
14773
14897
|
__publicField(this, "selectionObserver");
|
|
@@ -14832,6 +14956,7 @@ class Draw {
|
|
|
14832
14956
|
this.listParticle = new ListParticle(this);
|
|
14833
14957
|
this.lineBreakParticle = new LineBreakParticle(this);
|
|
14834
14958
|
this.control = new Control(this);
|
|
14959
|
+
this.pageBorder = new PageBorder(this);
|
|
14835
14960
|
this.scrollObserver = new ScrollObserver(this);
|
|
14836
14961
|
this.selectionObserver = new SelectionObserver(this);
|
|
14837
14962
|
this.imageObserver = new ImageObserver();
|
|
@@ -14842,6 +14967,7 @@ class Draw {
|
|
|
14842
14967
|
this.globalEvent = new GlobalEvent(this, this.canvasEvent);
|
|
14843
14968
|
this.globalEvent.register();
|
|
14844
14969
|
this.workerManager = new WorkerManager(this);
|
|
14970
|
+
new Actuator(this);
|
|
14845
14971
|
const { letterClass } = options;
|
|
14846
14972
|
this.LETTER_REG = new RegExp(`[${letterClass.join("")}]`);
|
|
14847
14973
|
this.WORD_LIKE_REG = new RegExp(`${letterClass.map((letter) => `[^${letter}][${letter}]`).join("|")}`);
|
|
@@ -14896,6 +15022,8 @@ class Draw {
|
|
|
14896
15022
|
}
|
|
14897
15023
|
isReadonly() {
|
|
14898
15024
|
switch (this.mode) {
|
|
15025
|
+
case EditorMode.DESIGN:
|
|
15026
|
+
return false;
|
|
14899
15027
|
case EditorMode.READONLY:
|
|
14900
15028
|
case EditorMode.PRINT:
|
|
14901
15029
|
return true;
|
|
@@ -14906,13 +15034,17 @@ class Draw {
|
|
|
14906
15034
|
}
|
|
14907
15035
|
}
|
|
14908
15036
|
isDisabled() {
|
|
14909
|
-
var _a, _b, _c, _d;
|
|
15037
|
+
var _a, _b, _c, _d, _e;
|
|
15038
|
+
if (this.mode === EditorMode.DESIGN)
|
|
15039
|
+
return false;
|
|
14910
15040
|
const { startIndex, endIndex } = this.range.getRange();
|
|
14911
15041
|
const elementList = this.getElementList();
|
|
15042
|
+
if ((_a = this.getTd()) == null ? void 0 : _a.disabled)
|
|
15043
|
+
return true;
|
|
14912
15044
|
if (startIndex === endIndex) {
|
|
14913
15045
|
const startElement = elementList[startIndex];
|
|
14914
15046
|
const nextElement = elementList[startIndex + 1];
|
|
14915
|
-
return !!(((
|
|
15047
|
+
return !!(((_b = startElement == null ? void 0 : startElement.title) == null ? void 0 : _b.disabled) && ((_c = nextElement == null ? void 0 : nextElement.title) == null ? void 0 : _c.disabled) || ((_d = startElement == null ? void 0 : startElement.control) == null ? void 0 : _d.disabled) && ((_e = nextElement == null ? void 0 : nextElement.control) == null ? void 0 : _e.disabled));
|
|
14916
15048
|
}
|
|
14917
15049
|
const selectionElementList = elementList.slice(startIndex + 1, endIndex + 1);
|
|
14918
15050
|
return selectionElementList.some((element) => {
|
|
@@ -14920,6 +15052,9 @@ class Draw {
|
|
|
14920
15052
|
return ((_a2 = element.title) == null ? void 0 : _a2.disabled) || ((_b2 = element.control) == null ? void 0 : _b2.disabled);
|
|
14921
15053
|
});
|
|
14922
15054
|
}
|
|
15055
|
+
isDesignMode() {
|
|
15056
|
+
return this.mode === EditorMode.DESIGN;
|
|
15057
|
+
}
|
|
14923
15058
|
getOriginalWidth() {
|
|
14924
15059
|
const { paperDirection, width, height } = this.options;
|
|
14925
15060
|
return paperDirection === PaperDirection.VERTICAL ? width : height;
|
|
@@ -15131,6 +15266,15 @@ class Draw {
|
|
|
15131
15266
|
getFooterElementList() {
|
|
15132
15267
|
return this.footer.getElementList();
|
|
15133
15268
|
}
|
|
15269
|
+
getTd() {
|
|
15270
|
+
const positionContext = this.position.getPositionContext();
|
|
15271
|
+
const { index: index2, trIndex, tdIndex, isTable } = positionContext;
|
|
15272
|
+
if (isTable) {
|
|
15273
|
+
const elementList = this.getOriginalElementList();
|
|
15274
|
+
return elementList[index2].trList[trIndex].tdList[tdIndex];
|
|
15275
|
+
}
|
|
15276
|
+
return null;
|
|
15277
|
+
}
|
|
15134
15278
|
insertElementList(payload) {
|
|
15135
15279
|
if (!payload.length || !this.range.getIsCanInput())
|
|
15136
15280
|
return;
|
|
@@ -15195,7 +15339,8 @@ class Draw {
|
|
|
15195
15339
|
});
|
|
15196
15340
|
}
|
|
15197
15341
|
spliceElementList(elementList, start, deleteCount, ...items) {
|
|
15198
|
-
var _a, _b, _c;
|
|
15342
|
+
var _a, _b, _c, _d;
|
|
15343
|
+
const isDesignMode = this.isDesignMode();
|
|
15199
15344
|
if (deleteCount > 0) {
|
|
15200
15345
|
const endIndex = start + deleteCount;
|
|
15201
15346
|
const endElement = elementList[endIndex];
|
|
@@ -15214,10 +15359,11 @@ class Draw {
|
|
|
15214
15359
|
}
|
|
15215
15360
|
}
|
|
15216
15361
|
if (!this.control.getActiveControl()) {
|
|
15362
|
+
const tdDeletable = (_b = this.getTd()) == null ? void 0 : _b.deletable;
|
|
15217
15363
|
let deleteIndex = endIndex - 1;
|
|
15218
15364
|
while (deleteIndex >= start) {
|
|
15219
15365
|
const deleteElement = elementList[deleteIndex];
|
|
15220
|
-
if (((
|
|
15366
|
+
if (isDesignMode || tdDeletable !== false && ((_c = deleteElement == null ? void 0 : deleteElement.control) == null ? void 0 : _c.deletable) !== false && ((_d = deleteElement == null ? void 0 : deleteElement.title) == null ? void 0 : _d.deletable) !== false) {
|
|
15221
15367
|
elementList.splice(deleteIndex, 1);
|
|
15222
15368
|
}
|
|
15223
15369
|
deleteIndex--;
|
|
@@ -15513,7 +15659,8 @@ class Draw {
|
|
|
15513
15659
|
if (!data2)
|
|
15514
15660
|
return;
|
|
15515
15661
|
formatElementList(data2, {
|
|
15516
|
-
editorOptions: this.options
|
|
15662
|
+
editorOptions: this.options,
|
|
15663
|
+
isForceCompensation: true
|
|
15517
15664
|
});
|
|
15518
15665
|
});
|
|
15519
15666
|
this.setEditorData({
|
|
@@ -15597,11 +15744,12 @@ class Draw {
|
|
|
15597
15744
|
return el.actualSize || el.size || this.options.defaultSize;
|
|
15598
15745
|
}
|
|
15599
15746
|
getElementRowMargin(el) {
|
|
15747
|
+
var _a;
|
|
15600
15748
|
const { defaultBasicRowMarginHeight, defaultRowMargin, scale } = this.options;
|
|
15601
|
-
return defaultBasicRowMarginHeight * (el.rowMargin
|
|
15749
|
+
return defaultBasicRowMarginHeight * ((_a = el.rowMargin) != null ? _a : defaultRowMargin) * scale;
|
|
15602
15750
|
}
|
|
15603
15751
|
computeRowList(payload) {
|
|
15604
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
15752
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
15605
15753
|
const { innerWidth, elementList, isPagingMode = false } = payload;
|
|
15606
15754
|
const { defaultSize, defaultRowMargin, scale, table: { tdPadding }, defaultTabWidth } = this.options;
|
|
15607
15755
|
const defaultBasicRowMarginHeight = this.getDefaultBasicRowMarginHeight();
|
|
@@ -15626,7 +15774,7 @@ class Draw {
|
|
|
15626
15774
|
for (let i = 0; i < elementList.length; i++) {
|
|
15627
15775
|
const curRow = rowList[rowList.length - 1];
|
|
15628
15776
|
const element = elementList[i];
|
|
15629
|
-
const rowMargin = defaultBasicRowMarginHeight * (element.rowMargin
|
|
15777
|
+
const rowMargin = defaultBasicRowMarginHeight * ((_c = element.rowMargin) != null ? _c : defaultRowMargin);
|
|
15630
15778
|
const metrics = {
|
|
15631
15779
|
width: 0,
|
|
15632
15780
|
height: 0,
|
|
@@ -15679,7 +15827,7 @@ class Draw {
|
|
|
15679
15827
|
elementList.splice(i + 1, combineCount);
|
|
15680
15828
|
}
|
|
15681
15829
|
}
|
|
15682
|
-
element.pagingIndex = (
|
|
15830
|
+
element.pagingIndex = (_d = element.pagingIndex) != null ? _d : 0;
|
|
15683
15831
|
this.tableParticle.computeRowColInfo(element);
|
|
15684
15832
|
const trList = element.trList;
|
|
15685
15833
|
for (let t = 0; t < trList.length; t++) {
|
|
@@ -15755,7 +15903,7 @@ class Draw {
|
|
|
15755
15903
|
let curPagePreHeight = marginHeight;
|
|
15756
15904
|
for (let r = 0; r < rowList.length; r++) {
|
|
15757
15905
|
const row = rowList[r];
|
|
15758
|
-
if (row.height + curPagePreHeight > height2 || ((
|
|
15906
|
+
if (row.height + curPagePreHeight > height2 || ((_e = rowList[r - 1]) == null ? void 0 : _e.isPageBreak)) {
|
|
15759
15907
|
curPagePreHeight = marginHeight + row.height;
|
|
15760
15908
|
} else {
|
|
15761
15909
|
curPagePreHeight += row.height;
|
|
@@ -15776,7 +15924,7 @@ class Draw {
|
|
|
15776
15924
|
const trHeight = tr.height * scale;
|
|
15777
15925
|
if (curPagePreHeight + rowMarginHeight + preTrHeight + trHeight > height2) {
|
|
15778
15926
|
const rowColCount = tr.tdList.reduce((pre, cur) => pre + cur.colspan, 0);
|
|
15779
|
-
if (((
|
|
15927
|
+
if (((_f = element.colgroup) == null ? void 0 : _f.length) !== rowColCount) {
|
|
15780
15928
|
deleteCount = 0;
|
|
15781
15929
|
}
|
|
15782
15930
|
break;
|
|
@@ -15899,7 +16047,7 @@ class Draw {
|
|
|
15899
16047
|
metrics,
|
|
15900
16048
|
style: this.getElementFont(element, scale)
|
|
15901
16049
|
});
|
|
15902
|
-
if ((
|
|
16050
|
+
if ((_g = rowElement.control) == null ? void 0 : _g.minWidth) {
|
|
15903
16051
|
if (rowElement.controlComponent) {
|
|
15904
16052
|
controlRealWidth += metrics.width;
|
|
15905
16053
|
}
|
|
@@ -15952,10 +16100,10 @@ class Draw {
|
|
|
15952
16100
|
elementList: [rowElement],
|
|
15953
16101
|
ascent,
|
|
15954
16102
|
rowIndex: curRow.rowIndex + 1,
|
|
15955
|
-
rowFlex: ((
|
|
16103
|
+
rowFlex: ((_h = elementList[i]) == null ? void 0 : _h.rowFlex) || ((_i = elementList[i + 1]) == null ? void 0 : _i.rowFlex),
|
|
15956
16104
|
isPageBreak: element.type === ElementType.PAGE_BREAK
|
|
15957
16105
|
};
|
|
15958
|
-
if (rowElement.controlComponent !== ControlComponent.PREFIX && ((
|
|
16106
|
+
if (rowElement.controlComponent !== ControlComponent.PREFIX && ((_j = rowElement.control) == null ? void 0 : _j.indentation) === ControlIndentation.VALUE_START) {
|
|
15959
16107
|
const preStartIndex = curRow.elementList.findIndex((el) => el.controlId === rowElement.controlId && el.controlComponent !== ControlComponent.PREFIX);
|
|
15960
16108
|
if (~preStartIndex) {
|
|
15961
16109
|
const preRowPositionList = this.position.computeRowPosition({
|
|
@@ -15988,7 +16136,7 @@ class Draw {
|
|
|
15988
16136
|
if (isForceBreak || isWidthNotEnough || i === elementList.length - 1) {
|
|
15989
16137
|
curRow.isWidthNotEnough = isWidthNotEnough && !isForceBreak;
|
|
15990
16138
|
if ((preElement == null ? void 0 : preElement.rowFlex) === RowFlex.JUSTIFY || (preElement == null ? void 0 : preElement.rowFlex) === RowFlex.ALIGNMENT && isWidthNotEnough) {
|
|
15991
|
-
const rowElementList = ((
|
|
16139
|
+
const rowElementList = ((_k = curRow.elementList[0]) == null ? void 0 : _k.value) === ZERO ? curRow.elementList.slice(1) : curRow.elementList;
|
|
15992
16140
|
const gap = (availableWidth - curRow.width) / (rowElementList.length - 1);
|
|
15993
16141
|
for (let e = 0; e < rowElementList.length - 1; e++) {
|
|
15994
16142
|
const el = rowElementList[e];
|
|
@@ -16043,18 +16191,22 @@ class Draw {
|
|
|
16043
16191
|
return pageRowList;
|
|
16044
16192
|
}
|
|
16045
16193
|
_drawHighlight(ctx, payload) {
|
|
16194
|
+
var _a;
|
|
16195
|
+
const { control: { activeBackgroundColor } } = this.options;
|
|
16046
16196
|
const { rowList, positionList } = payload;
|
|
16197
|
+
const activeControlElement = (_a = this.control.getActiveControl()) == null ? void 0 : _a.getElement();
|
|
16047
16198
|
for (let i = 0; i < rowList.length; i++) {
|
|
16048
16199
|
const curRow = rowList[i];
|
|
16049
16200
|
for (let j = 0; j < curRow.elementList.length; j++) {
|
|
16050
16201
|
const element = curRow.elementList[j];
|
|
16051
16202
|
const preElement = curRow.elementList[j - 1];
|
|
16052
|
-
if (element.highlight) {
|
|
16203
|
+
if (element.highlight || activeBackgroundColor && activeControlElement && element.controlId === activeControlElement.controlId && !this.control.getIsRangeInPostfix()) {
|
|
16053
16204
|
if (preElement && preElement.highlight && preElement.highlight !== element.highlight) {
|
|
16054
16205
|
this.highlight.render(ctx);
|
|
16055
16206
|
}
|
|
16056
16207
|
const { coordinate: { leftTop: [x, y] } } = positionList[curRow.startIndex + j];
|
|
16057
|
-
|
|
16208
|
+
const offsetX = element.left || 0;
|
|
16209
|
+
this.highlight.recordFillInfo(ctx, x - offsetX, y, element.metrics.width + offsetX, curRow.height, element.highlight || activeBackgroundColor);
|
|
16058
16210
|
} else if (preElement == null ? void 0 : preElement.highlight) {
|
|
16059
16211
|
this.highlight.render(ctx);
|
|
16060
16212
|
}
|
|
@@ -16295,7 +16447,7 @@ class Draw {
|
|
|
16295
16447
|
_drawPage(payload) {
|
|
16296
16448
|
var _a, _b;
|
|
16297
16449
|
const { elementList, positionList, rowList, pageNo } = payload;
|
|
16298
|
-
const { inactiveAlpha, pageMode, header, footer, pageNumber, lineNumber } = this.options;
|
|
16450
|
+
const { inactiveAlpha, pageMode, header, footer, pageNumber, lineNumber, pageBorder } = this.options;
|
|
16299
16451
|
const innerWidth = this.getInnerWidth();
|
|
16300
16452
|
const ctx = this.ctxList[pageNo];
|
|
16301
16453
|
ctx.globalAlpha = !this.zone.isMainActive() ? inactiveAlpha : 1;
|
|
@@ -16346,6 +16498,9 @@ class Draw {
|
|
|
16346
16498
|
if (!lineNumber.disabled) {
|
|
16347
16499
|
this.lineNumber.render(ctx, pageNo);
|
|
16348
16500
|
}
|
|
16501
|
+
if (!pageBorder.disabled) {
|
|
16502
|
+
this.pageBorder.render(ctx);
|
|
16503
|
+
}
|
|
16349
16504
|
}
|
|
16350
16505
|
_disconnectLazyRender() {
|
|
16351
16506
|
var _a;
|
|
@@ -16627,6 +16782,7 @@ class Command {
|
|
|
16627
16782
|
__publicField(this, "executeInsertControl");
|
|
16628
16783
|
__publicField(this, "executeUpdateOptions");
|
|
16629
16784
|
__publicField(this, "executeInsertTitle");
|
|
16785
|
+
__publicField(this, "executeFocus");
|
|
16630
16786
|
__publicField(this, "getCatalog");
|
|
16631
16787
|
__publicField(this, "getImage");
|
|
16632
16788
|
__publicField(this, "getOptions");
|
|
@@ -16736,6 +16892,7 @@ class Command {
|
|
|
16736
16892
|
this.executeSetZone = adapt.setZone.bind(adapt);
|
|
16737
16893
|
this.executeUpdateOptions = adapt.updateOptions.bind(adapt);
|
|
16738
16894
|
this.executeInsertTitle = adapt.insertTitle.bind(adapt);
|
|
16895
|
+
this.executeFocus = adapt.focus.bind(adapt);
|
|
16739
16896
|
this.getImage = adapt.getImage.bind(adapt);
|
|
16740
16897
|
this.getOptions = adapt.getOptions.bind(adapt);
|
|
16741
16898
|
this.getValue = adapt.getValue.bind(adapt);
|
|
@@ -16795,7 +16952,8 @@ const defaultControlOption = {
|
|
|
16795
16952
|
prefix: "{",
|
|
16796
16953
|
postfix: "}",
|
|
16797
16954
|
borderWidth: 1,
|
|
16798
|
-
borderColor: "#000000"
|
|
16955
|
+
borderColor: "#000000",
|
|
16956
|
+
activeBackgroundColor: ""
|
|
16799
16957
|
};
|
|
16800
16958
|
const defaultFooterOption = {
|
|
16801
16959
|
bottom: 30,
|
|
@@ -16860,6 +17018,12 @@ const defaultLineNumberOption = {
|
|
|
16860
17018
|
right: 20,
|
|
16861
17019
|
type: LineNumberType.CONTINUITY
|
|
16862
17020
|
};
|
|
17021
|
+
const defaultPageBorderOption = {
|
|
17022
|
+
color: "#000000",
|
|
17023
|
+
lineWidth: 1,
|
|
17024
|
+
padding: [0, 5, 0, 5],
|
|
17025
|
+
disabled: true
|
|
17026
|
+
};
|
|
16863
17027
|
function mergeOption(options = {}) {
|
|
16864
17028
|
const tableOptions = __spreadValues(__spreadValues({}, defaultTableOption), options.table);
|
|
16865
17029
|
const headerOptions = __spreadValues(__spreadValues({}, defaultHeaderOption), options.header);
|
|
@@ -16879,6 +17043,7 @@ function mergeOption(options = {}) {
|
|
|
16879
17043
|
const lineBreakOptions = __spreadValues(__spreadValues({}, defaultLineBreak), options.lineBreak);
|
|
16880
17044
|
const separatorOptions = __spreadValues(__spreadValues({}, defaultSeparatorOption), options.separator);
|
|
16881
17045
|
const lineNumberOptions = __spreadValues(__spreadValues({}, defaultLineNumberOption), options.lineNumber);
|
|
17046
|
+
const pageBorderOptions = __spreadValues(__spreadValues({}, defaultPageBorderOption), options.pageBorder);
|
|
16882
17047
|
return __spreadProps(__spreadValues({
|
|
16883
17048
|
mode: EditorMode.EDIT,
|
|
16884
17049
|
defaultType: "TEXT",
|
|
@@ -16938,7 +17103,8 @@ function mergeOption(options = {}) {
|
|
|
16938
17103
|
background: backgroundOptions,
|
|
16939
17104
|
lineBreak: lineBreakOptions,
|
|
16940
17105
|
separator: separatorOptions,
|
|
16941
|
-
lineNumber: lineNumberOptions
|
|
17106
|
+
lineNumber: lineNumberOptions,
|
|
17107
|
+
pageBorder: pageBorderOptions
|
|
16942
17108
|
});
|
|
16943
17109
|
}
|
|
16944
17110
|
function convertPxToPaperSize(width, height) {
|
|
@@ -17045,8 +17211,8 @@ class CommandAdapt {
|
|
|
17045
17211
|
this.draw.setMode(payload);
|
|
17046
17212
|
}
|
|
17047
17213
|
cut() {
|
|
17048
|
-
const
|
|
17049
|
-
if (
|
|
17214
|
+
const isDisabled = this.draw.isReadonly() || this.draw.isDisabled();
|
|
17215
|
+
if (isDisabled)
|
|
17050
17216
|
return;
|
|
17051
17217
|
this.canvasEvent.cut();
|
|
17052
17218
|
}
|
|
@@ -17054,8 +17220,8 @@ class CommandAdapt {
|
|
|
17054
17220
|
this.canvasEvent.copy();
|
|
17055
17221
|
}
|
|
17056
17222
|
paste(payload) {
|
|
17057
|
-
const
|
|
17058
|
-
if (
|
|
17223
|
+
const isDisabled = this.draw.isReadonly() || this.draw.isDisabled();
|
|
17224
|
+
if (isDisabled)
|
|
17059
17225
|
return;
|
|
17060
17226
|
pasteByApi(this.canvasEvent, payload);
|
|
17061
17227
|
}
|
|
@@ -17063,8 +17229,8 @@ class CommandAdapt {
|
|
|
17063
17229
|
this.canvasEvent.selectAll();
|
|
17064
17230
|
}
|
|
17065
17231
|
backspace() {
|
|
17066
|
-
const
|
|
17067
|
-
if (
|
|
17232
|
+
const isDisabled = this.draw.isReadonly() || this.draw.isDisabled();
|
|
17233
|
+
if (isDisabled)
|
|
17068
17234
|
return;
|
|
17069
17235
|
const elementList = this.draw.getElementList();
|
|
17070
17236
|
const { startIndex, endIndex } = this.range.getRange();
|
|
@@ -17537,8 +17703,8 @@ class CommandAdapt {
|
|
|
17537
17703
|
}
|
|
17538
17704
|
}
|
|
17539
17705
|
title(payload) {
|
|
17540
|
-
const
|
|
17541
|
-
if (
|
|
17706
|
+
const isDisabled = this.draw.isReadonly() || this.draw.isDisabled();
|
|
17707
|
+
if (isDisabled)
|
|
17542
17708
|
return;
|
|
17543
17709
|
const { startIndex, endIndex } = this.range.getRange();
|
|
17544
17710
|
if (!~startIndex && !~endIndex)
|
|
@@ -17615,8 +17781,8 @@ class CommandAdapt {
|
|
|
17615
17781
|
}
|
|
17616
17782
|
insertTable(row, col) {
|
|
17617
17783
|
var _a;
|
|
17618
|
-
const
|
|
17619
|
-
if (
|
|
17784
|
+
const isDisabled = this.draw.isReadonly() || this.draw.isDisabled();
|
|
17785
|
+
if (isDisabled)
|
|
17620
17786
|
return;
|
|
17621
17787
|
const activeControl = this.control.getActiveControl();
|
|
17622
17788
|
if (activeControl)
|
|
@@ -17653,7 +17819,7 @@ class CommandAdapt {
|
|
|
17653
17819
|
tdList.push({
|
|
17654
17820
|
colspan: 1,
|
|
17655
17821
|
rowspan: 1,
|
|
17656
|
-
value: [
|
|
17822
|
+
value: []
|
|
17657
17823
|
});
|
|
17658
17824
|
}
|
|
17659
17825
|
trList.push(tr);
|
|
@@ -17667,7 +17833,9 @@ class CommandAdapt {
|
|
|
17667
17833
|
formatElementList([element], {
|
|
17668
17834
|
editorOptions: this.options
|
|
17669
17835
|
});
|
|
17670
|
-
formatElementContext(elementList, [element], startIndex
|
|
17836
|
+
formatElementContext(elementList, [element], startIndex, {
|
|
17837
|
+
editorOptions: this.options
|
|
17838
|
+
});
|
|
17671
17839
|
const curIndex = startIndex + 1;
|
|
17672
17840
|
this.draw.spliceElementList(elementList, curIndex, startIndex === endIndex ? 0 : endIndex - startIndex, element);
|
|
17673
17841
|
this.range.setRange(curIndex, curIndex);
|
|
@@ -18350,8 +18518,8 @@ class CommandAdapt {
|
|
|
18350
18518
|
});
|
|
18351
18519
|
}
|
|
18352
18520
|
hyperlink(payload) {
|
|
18353
|
-
const
|
|
18354
|
-
if (
|
|
18521
|
+
const isDisabled = this.draw.isReadonly() || this.draw.isDisabled();
|
|
18522
|
+
if (isDisabled)
|
|
18355
18523
|
return;
|
|
18356
18524
|
const activeControl = this.control.getActiveControl();
|
|
18357
18525
|
if (activeControl)
|
|
@@ -18371,7 +18539,9 @@ class CommandAdapt {
|
|
|
18371
18539
|
if (!newElementList)
|
|
18372
18540
|
return;
|
|
18373
18541
|
const start = startIndex + 1;
|
|
18374
|
-
formatElementContext(elementList, newElementList, startIndex
|
|
18542
|
+
formatElementContext(elementList, newElementList, startIndex, {
|
|
18543
|
+
editorOptions: this.options
|
|
18544
|
+
});
|
|
18375
18545
|
this.draw.spliceElementList(elementList, start, startIndex === endIndex ? 0 : endIndex - startIndex, ...newElementList);
|
|
18376
18546
|
const curIndex = start + newElementList.length - 1;
|
|
18377
18547
|
this.range.setRange(curIndex, curIndex);
|
|
@@ -18413,8 +18583,8 @@ class CommandAdapt {
|
|
|
18413
18583
|
return [leftIndex, rightIndex];
|
|
18414
18584
|
}
|
|
18415
18585
|
deleteHyperlink() {
|
|
18416
|
-
const
|
|
18417
|
-
if (
|
|
18586
|
+
const isDisabled = this.draw.isReadonly() || this.draw.isDisabled();
|
|
18587
|
+
if (isDisabled)
|
|
18418
18588
|
return;
|
|
18419
18589
|
const hyperRange = this.getHyperlinkRange();
|
|
18420
18590
|
if (!hyperRange)
|
|
@@ -18430,8 +18600,8 @@ class CommandAdapt {
|
|
|
18430
18600
|
});
|
|
18431
18601
|
}
|
|
18432
18602
|
cancelHyperlink() {
|
|
18433
|
-
const
|
|
18434
|
-
if (
|
|
18603
|
+
const isDisabled = this.draw.isReadonly() || this.draw.isDisabled();
|
|
18604
|
+
if (isDisabled)
|
|
18435
18605
|
return;
|
|
18436
18606
|
const hyperRange = this.getHyperlinkRange();
|
|
18437
18607
|
if (!hyperRange)
|
|
@@ -18453,8 +18623,8 @@ class CommandAdapt {
|
|
|
18453
18623
|
});
|
|
18454
18624
|
}
|
|
18455
18625
|
editHyperlink(payload) {
|
|
18456
|
-
const
|
|
18457
|
-
if (
|
|
18626
|
+
const isDisabled = this.draw.isReadonly() || this.draw.isDisabled();
|
|
18627
|
+
if (isDisabled)
|
|
18458
18628
|
return;
|
|
18459
18629
|
const hyperRange = this.getHyperlinkRange();
|
|
18460
18630
|
if (!hyperRange)
|
|
@@ -18473,8 +18643,8 @@ class CommandAdapt {
|
|
|
18473
18643
|
});
|
|
18474
18644
|
}
|
|
18475
18645
|
separator(payload) {
|
|
18476
|
-
const
|
|
18477
|
-
if (
|
|
18646
|
+
const isDisabled = this.draw.isReadonly() || this.draw.isDisabled();
|
|
18647
|
+
if (isDisabled)
|
|
18478
18648
|
return;
|
|
18479
18649
|
const activeControl = this.control.getActiveControl();
|
|
18480
18650
|
if (activeControl)
|
|
@@ -18497,7 +18667,9 @@ class CommandAdapt {
|
|
|
18497
18667
|
type: ElementType.SEPARATOR,
|
|
18498
18668
|
dashArray: payload
|
|
18499
18669
|
};
|
|
18500
|
-
formatElementContext(elementList, [newElement], startIndex
|
|
18670
|
+
formatElementContext(elementList, [newElement], startIndex, {
|
|
18671
|
+
editorOptions: this.options
|
|
18672
|
+
});
|
|
18501
18673
|
if (startIndex !== 0 && elementList[startIndex].value === ZERO) {
|
|
18502
18674
|
this.draw.spliceElementList(elementList, startIndex, 1, newElement);
|
|
18503
18675
|
curIndex = startIndex - 1;
|
|
@@ -18510,8 +18682,8 @@ class CommandAdapt {
|
|
|
18510
18682
|
this.draw.render({ curIndex });
|
|
18511
18683
|
}
|
|
18512
18684
|
pageBreak() {
|
|
18513
|
-
const
|
|
18514
|
-
if (
|
|
18685
|
+
const isDisabled = this.draw.isReadonly() || this.draw.isDisabled();
|
|
18686
|
+
if (isDisabled)
|
|
18515
18687
|
return;
|
|
18516
18688
|
const activeControl = this.control.getActiveControl();
|
|
18517
18689
|
if (activeControl)
|
|
@@ -18933,14 +19105,15 @@ class CommandAdapt {
|
|
|
18933
19105
|
insertElementList(payload) {
|
|
18934
19106
|
if (!payload.length)
|
|
18935
19107
|
return;
|
|
18936
|
-
const
|
|
18937
|
-
if (
|
|
19108
|
+
const isDisabled = this.draw.isReadonly() || this.draw.isDisabled();
|
|
19109
|
+
if (isDisabled)
|
|
18938
19110
|
return;
|
|
18939
19111
|
const cloneElementList = deepClone(payload);
|
|
18940
19112
|
const { startIndex } = this.range.getRange();
|
|
18941
19113
|
const elementList = this.draw.getElementList();
|
|
18942
19114
|
formatElementContext(elementList, cloneElementList, startIndex, {
|
|
18943
|
-
isBreakWhenWrap: true
|
|
19115
|
+
isBreakWhenWrap: true,
|
|
19116
|
+
editorOptions: this.options
|
|
18944
19117
|
});
|
|
18945
19118
|
this.draw.insertElementList(cloneElementList);
|
|
18946
19119
|
}
|
|
@@ -19220,8 +19393,8 @@ class CommandAdapt {
|
|
|
19220
19393
|
}
|
|
19221
19394
|
}
|
|
19222
19395
|
insertControl(payload) {
|
|
19223
|
-
const
|
|
19224
|
-
if (
|
|
19396
|
+
const isDisabled = this.draw.isReadonly() || this.draw.isDisabled();
|
|
19397
|
+
if (isDisabled)
|
|
19225
19398
|
return;
|
|
19226
19399
|
const cloneElement = deepClone(payload);
|
|
19227
19400
|
const { startIndex } = this.range.getRange();
|
|
@@ -19346,8 +19519,8 @@ class CommandAdapt {
|
|
|
19346
19519
|
}
|
|
19347
19520
|
insertTitle(payload) {
|
|
19348
19521
|
var _a;
|
|
19349
|
-
const
|
|
19350
|
-
if (
|
|
19522
|
+
const isDisabled = this.draw.isReadonly() || this.draw.isDisabled();
|
|
19523
|
+
if (isDisabled)
|
|
19351
19524
|
return;
|
|
19352
19525
|
const cloneElement = deepClone(payload);
|
|
19353
19526
|
const { startIndex } = this.range.getRange();
|
|
@@ -19365,6 +19538,21 @@ class CommandAdapt {
|
|
|
19365
19538
|
});
|
|
19366
19539
|
this.draw.insertElementList([cloneElement]);
|
|
19367
19540
|
}
|
|
19541
|
+
focus(payload) {
|
|
19542
|
+
const { position = LocationPosition.AFTER } = payload || {};
|
|
19543
|
+
const curIndex = position === LocationPosition.BEFORE ? 0 : this.draw.getOriginalMainElementList().length - 1;
|
|
19544
|
+
this.range.setRange(curIndex, curIndex);
|
|
19545
|
+
this.draw.render({
|
|
19546
|
+
curIndex,
|
|
19547
|
+
isCompute: false,
|
|
19548
|
+
isSubmitHistory: false
|
|
19549
|
+
});
|
|
19550
|
+
const positionList = this.draw.getPosition().getPositionList();
|
|
19551
|
+
this.draw.getCursor().moveCursorToVisible({
|
|
19552
|
+
cursorPosition: positionList[curIndex],
|
|
19553
|
+
direction: MoveDirection.DOWN
|
|
19554
|
+
});
|
|
19555
|
+
}
|
|
19368
19556
|
}
|
|
19369
19557
|
class Listener {
|
|
19370
19558
|
constructor() {
|
|
@@ -20470,7 +20658,8 @@ class Editor {
|
|
|
20470
20658
|
];
|
|
20471
20659
|
pageComponentData.forEach((elementList) => {
|
|
20472
20660
|
formatElementList(elementList, {
|
|
20473
|
-
editorOptions
|
|
20661
|
+
editorOptions,
|
|
20662
|
+
isForceCompensation: true
|
|
20474
20663
|
});
|
|
20475
20664
|
});
|
|
20476
20665
|
this.listener = new Listener();
|