@hufe921/canvas-editor 0.9.103 → 0.9.104
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 +20 -0
- package/dist/canvas-editor.es.js +83 -61
- package/dist/canvas-editor.es.js.map +1 -1
- package/dist/canvas-editor.umd.js +7 -7
- package/dist/canvas-editor.umd.js.map +1 -1
- package/dist/src/editor/core/draw/Draw.d.ts +1 -1
- package/dist/src/editor/interface/Element.d.ts +5 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
## [0.9.104](https://github.com/Hufe921/canvas-editor/compare/v0.9.103...v0.9.104) (2025-02-22)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* missing some fields when zip elements #1023 ([c41fc9e](https://github.com/Hufe921/canvas-editor/commit/c41fc9eb578d4dc0f59cbb642050cee49158b460)), closes [#1023](https://github.com/Hufe921/canvas-editor/issues/1023)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* add imgToolDisabled option #1028 ([01b2c16](https://github.com/Hufe921/canvas-editor/commit/01b2c16596e9208bfdc08182b5e329f7a78a6b45)), closes [#1028](https://github.com/Hufe921/canvas-editor/issues/1028)
|
|
12
|
+
* increase priority when zip area elements #1020 ([21543cc](https://github.com/Hufe921/canvas-editor/commit/21543cc15f87302cd89d53da56f1a0a95b0a9f54)), closes [#1020](https://github.com/Hufe921/canvas-editor/issues/1020)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Performance Improvements
|
|
16
|
+
|
|
17
|
+
* spliceElementList method performance #1021 ([2066d0d](https://github.com/Hufe921/canvas-editor/commit/2066d0de80a2f2aae5f0b8bc4f0bc8378aaaa47d)), closes [#1021](https://github.com/Hufe921/canvas-editor/issues/1021)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
1
21
|
## [0.9.103](https://github.com/Hufe921/canvas-editor/compare/v0.9.102...v0.9.103) (2025-02-16)
|
|
2
22
|
|
|
3
23
|
|
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.104";
|
|
27
27
|
var MaxHeightRatio;
|
|
28
28
|
(function(MaxHeightRatio2) {
|
|
29
29
|
MaxHeightRatio2["HALF"] = "half";
|
|
@@ -488,6 +488,7 @@ const EDITOR_ELEMENT_ZIP_ATTR = [
|
|
|
488
488
|
"rowMargin",
|
|
489
489
|
"dashArray",
|
|
490
490
|
"trList",
|
|
491
|
+
"tableToolDisabled",
|
|
491
492
|
"borderType",
|
|
492
493
|
"borderColor",
|
|
493
494
|
"width",
|
|
@@ -509,6 +510,7 @@ const EDITOR_ELEMENT_ZIP_ATTR = [
|
|
|
509
510
|
"conceptId",
|
|
510
511
|
"imgDisplay",
|
|
511
512
|
"imgFloatPosition",
|
|
513
|
+
"imgToolDisabled",
|
|
512
514
|
"textDecoration",
|
|
513
515
|
"extension",
|
|
514
516
|
"externalId",
|
|
@@ -522,7 +524,9 @@ const TABLE_TD_ZIP_ATTR = [
|
|
|
522
524
|
"verticalAlign",
|
|
523
525
|
"backgroundColor",
|
|
524
526
|
"borderTypes",
|
|
525
|
-
"slashTypes"
|
|
527
|
+
"slashTypes",
|
|
528
|
+
"disabled",
|
|
529
|
+
"deletable"
|
|
526
530
|
];
|
|
527
531
|
const TABLE_CONTEXT_ATTR = [
|
|
528
532
|
"tdId",
|
|
@@ -4559,7 +4563,36 @@ function zipElementList(payload, options = {}) {
|
|
|
4559
4563
|
e++;
|
|
4560
4564
|
continue;
|
|
4561
4565
|
}
|
|
4562
|
-
if (element.
|
|
4566
|
+
if (element.areaId && element.area) {
|
|
4567
|
+
const areaId = element.areaId;
|
|
4568
|
+
const area = element.area;
|
|
4569
|
+
const valueList = [];
|
|
4570
|
+
while (e < elementList.length) {
|
|
4571
|
+
const areaE = elementList[e];
|
|
4572
|
+
if (areaId !== areaE.areaId) {
|
|
4573
|
+
e--;
|
|
4574
|
+
break;
|
|
4575
|
+
}
|
|
4576
|
+
delete areaE.area;
|
|
4577
|
+
delete areaE.areaId;
|
|
4578
|
+
valueList.push(areaE);
|
|
4579
|
+
e++;
|
|
4580
|
+
}
|
|
4581
|
+
const areaElementList = zipElementList(valueList, options);
|
|
4582
|
+
if (isClassifyArea) {
|
|
4583
|
+
const areaElement = {
|
|
4584
|
+
type: ElementType.AREA,
|
|
4585
|
+
value: "",
|
|
4586
|
+
areaId,
|
|
4587
|
+
area
|
|
4588
|
+
};
|
|
4589
|
+
areaElement.valueList = areaElementList;
|
|
4590
|
+
element = areaElement;
|
|
4591
|
+
} else {
|
|
4592
|
+
zipElementListData.splice(e, 0, ...areaElementList);
|
|
4593
|
+
continue;
|
|
4594
|
+
}
|
|
4595
|
+
} else if (element.titleId && element.level) {
|
|
4563
4596
|
const titleId = element.titleId;
|
|
4564
4597
|
if (titleId) {
|
|
4565
4598
|
const level = element.level;
|
|
@@ -4612,35 +4645,6 @@ function zipElementList(payload, options = {}) {
|
|
|
4612
4645
|
listElement.valueList = zipElementList(valueList, options);
|
|
4613
4646
|
element = listElement;
|
|
4614
4647
|
}
|
|
4615
|
-
} else if (element.areaId && element.area) {
|
|
4616
|
-
const areaId = element.areaId;
|
|
4617
|
-
const area = element.area;
|
|
4618
|
-
const valueList = [];
|
|
4619
|
-
while (e < elementList.length) {
|
|
4620
|
-
const areaE = elementList[e];
|
|
4621
|
-
if (areaId !== areaE.areaId) {
|
|
4622
|
-
e--;
|
|
4623
|
-
break;
|
|
4624
|
-
}
|
|
4625
|
-
delete areaE.area;
|
|
4626
|
-
delete areaE.areaId;
|
|
4627
|
-
valueList.push(areaE);
|
|
4628
|
-
e++;
|
|
4629
|
-
}
|
|
4630
|
-
const areaElementList = zipElementList(valueList, options);
|
|
4631
|
-
if (isClassifyArea) {
|
|
4632
|
-
const areaElement = {
|
|
4633
|
-
type: ElementType.AREA,
|
|
4634
|
-
value: "",
|
|
4635
|
-
areaId,
|
|
4636
|
-
area
|
|
4637
|
-
};
|
|
4638
|
-
areaElement.valueList = areaElementList;
|
|
4639
|
-
element = areaElement;
|
|
4640
|
-
} else {
|
|
4641
|
-
zipElementListData.splice(e, 0, ...areaElementList);
|
|
4642
|
-
continue;
|
|
4643
|
-
}
|
|
4644
4648
|
} else if (element.type === ElementType.TABLE) {
|
|
4645
4649
|
if (element.pagingId) {
|
|
4646
4650
|
let tableIndex = e + 1;
|
|
@@ -6520,7 +6524,7 @@ function mouseup(evt, host) {
|
|
|
6520
6524
|
rangeEnd = activeControl.setValue(replaceElementList);
|
|
6521
6525
|
rangeStart = rangeEnd - replaceLength;
|
|
6522
6526
|
} else {
|
|
6523
|
-
draw.spliceElementList(elementList, rangeStart + 1, 0,
|
|
6527
|
+
draw.spliceElementList(elementList, rangeStart + 1, 0, replaceElementList);
|
|
6524
6528
|
}
|
|
6525
6529
|
if (!~rangeEnd) {
|
|
6526
6530
|
draw.render({
|
|
@@ -6914,9 +6918,9 @@ function enter(evt, host) {
|
|
|
6914
6918
|
return;
|
|
6915
6919
|
const { index: index2 } = cursorPosition;
|
|
6916
6920
|
if (isCollapsed) {
|
|
6917
|
-
draw.spliceElementList(elementList, index2 + 1, 0, enterText);
|
|
6921
|
+
draw.spliceElementList(elementList, index2 + 1, 0, [enterText]);
|
|
6918
6922
|
} else {
|
|
6919
|
-
draw.spliceElementList(elementList, startIndex + 1, endIndex - startIndex, enterText);
|
|
6923
|
+
draw.spliceElementList(elementList, startIndex + 1, endIndex - startIndex, [enterText]);
|
|
6920
6924
|
}
|
|
6921
6925
|
curIndex = index2 + 1;
|
|
6922
6926
|
}
|
|
@@ -7659,7 +7663,7 @@ function input(data2, host) {
|
|
|
7659
7663
|
formatElementContext(elementList, inputData, startIndex, {
|
|
7660
7664
|
editorOptions: draw.getOptions()
|
|
7661
7665
|
});
|
|
7662
|
-
draw.spliceElementList(elementList, start, 0,
|
|
7666
|
+
draw.spliceElementList(elementList, start, 0, inputData);
|
|
7663
7667
|
curIndex = startIndex + inputData.length;
|
|
7664
7668
|
}
|
|
7665
7669
|
if (~curIndex) {
|
|
@@ -9944,9 +9948,11 @@ class Search {
|
|
|
9944
9948
|
if (p === 0) {
|
|
9945
9949
|
tableElement.value = value;
|
|
9946
9950
|
} else {
|
|
9947
|
-
this.draw.spliceElementList(tableElementList, curIndex + p, 0,
|
|
9948
|
-
|
|
9949
|
-
|
|
9951
|
+
this.draw.spliceElementList(tableElementList, curIndex + p, 0, [
|
|
9952
|
+
__spreadProps(__spreadValues({}, tableElement), {
|
|
9953
|
+
value
|
|
9954
|
+
})
|
|
9955
|
+
]);
|
|
9950
9956
|
tableDiffCount++;
|
|
9951
9957
|
}
|
|
9952
9958
|
}
|
|
@@ -9969,9 +9975,11 @@ class Search {
|
|
|
9969
9975
|
if (p === 0) {
|
|
9970
9976
|
element.value = value;
|
|
9971
9977
|
} else {
|
|
9972
|
-
this.draw.spliceElementList(elementList, curIndex + p, 0,
|
|
9973
|
-
|
|
9974
|
-
|
|
9978
|
+
this.draw.spliceElementList(elementList, curIndex + p, 0, [
|
|
9979
|
+
__spreadProps(__spreadValues({}, element), {
|
|
9980
|
+
value
|
|
9981
|
+
})
|
|
9982
|
+
]);
|
|
9975
9983
|
pageDiffCount++;
|
|
9976
9984
|
}
|
|
9977
9985
|
}
|
|
@@ -11801,7 +11809,7 @@ class SelectControl {
|
|
|
11801
11809
|
formatElementContext(elementList, [newElement], startIndex, {
|
|
11802
11810
|
editorOptions: this.options
|
|
11803
11811
|
});
|
|
11804
|
-
draw.spliceElementList(elementList, start + i, 0, newElement);
|
|
11812
|
+
draw.spliceElementList(elementList, start + i, 0, [newElement]);
|
|
11805
11813
|
}
|
|
11806
11814
|
return start + data2.length - 1;
|
|
11807
11815
|
}
|
|
@@ -11955,7 +11963,7 @@ class SelectControl {
|
|
|
11955
11963
|
formatElementContext(elementList, [newElement], prefixIndex, {
|
|
11956
11964
|
editorOptions: this.options
|
|
11957
11965
|
});
|
|
11958
|
-
draw.spliceElementList(elementList, start + i, 0, newElement);
|
|
11966
|
+
draw.spliceElementList(elementList, start + i, 0, [newElement]);
|
|
11959
11967
|
}
|
|
11960
11968
|
this.control.setControlProperties({
|
|
11961
11969
|
code
|
|
@@ -12117,7 +12125,7 @@ class TextControl {
|
|
|
12117
12125
|
formatElementContext(elementList, [newElement], startIndex, {
|
|
12118
12126
|
editorOptions: this.options
|
|
12119
12127
|
});
|
|
12120
|
-
draw.spliceElementList(elementList, start + i, 0, newElement);
|
|
12128
|
+
draw.spliceElementList(elementList, start + i, 0, [newElement]);
|
|
12121
12129
|
}
|
|
12122
12130
|
return start + data2.length - 1;
|
|
12123
12131
|
}
|
|
@@ -12759,7 +12767,7 @@ class DateControl {
|
|
|
12759
12767
|
formatElementContext(elementList, [newElement], startIndex, {
|
|
12760
12768
|
editorOptions: this.options
|
|
12761
12769
|
});
|
|
12762
|
-
draw.spliceElementList(elementList, start + i, 0, newElement);
|
|
12770
|
+
draw.spliceElementList(elementList, start + i, 0, [newElement]);
|
|
12763
12771
|
}
|
|
12764
12772
|
return start + data2.length - 1;
|
|
12765
12773
|
}
|
|
@@ -12807,7 +12815,7 @@ class DateControl {
|
|
|
12807
12815
|
formatElementContext(elementList, [newElement], prefixIndex, {
|
|
12808
12816
|
editorOptions: this.options
|
|
12809
12817
|
});
|
|
12810
|
-
draw.spliceElementList(elementList, start + i, 0, newElement);
|
|
12818
|
+
draw.spliceElementList(elementList, start + i, 0, [newElement]);
|
|
12811
12819
|
}
|
|
12812
12820
|
if (!context.range) {
|
|
12813
12821
|
const newIndex = start + date.length - 1;
|
|
@@ -13480,7 +13488,9 @@ class Control {
|
|
|
13480
13488
|
formatElementContext(elementList, [newElement], startIndex, {
|
|
13481
13489
|
editorOptions: this.options
|
|
13482
13490
|
});
|
|
13483
|
-
this.draw.spliceElementList(elementList, startIndex + p + 1, 0,
|
|
13491
|
+
this.draw.spliceElementList(elementList, startIndex + p + 1, 0, [
|
|
13492
|
+
newElement
|
|
13493
|
+
]);
|
|
13484
13494
|
}
|
|
13485
13495
|
}
|
|
13486
13496
|
setValue(data2) {
|
|
@@ -13849,7 +13859,8 @@ class Control {
|
|
|
13849
13859
|
for (const key in pageComponentData) {
|
|
13850
13860
|
const pageComponentKey = key;
|
|
13851
13861
|
const elementList = zipElementList(pageComponentData[pageComponentKey], {
|
|
13852
|
-
isClassifyArea: true
|
|
13862
|
+
isClassifyArea: true,
|
|
13863
|
+
extraPickAttrs: ["id"]
|
|
13853
13864
|
});
|
|
13854
13865
|
pageComponentData[pageComponentKey] = elementList;
|
|
13855
13866
|
formatElementList(elementList, {
|
|
@@ -14754,10 +14765,15 @@ class Previewer {
|
|
|
14754
14765
|
this.resizerSize.innerText = `${Math.round(width)} \xD7 ${Math.round(height)}`;
|
|
14755
14766
|
}
|
|
14756
14767
|
render() {
|
|
14768
|
+
if (!this.curElement || this.curElement.imgToolDisabled && !this.draw.isDesignMode()) {
|
|
14769
|
+
return;
|
|
14770
|
+
}
|
|
14757
14771
|
this._drawPreviewer();
|
|
14758
14772
|
document.body.style.overflow = "hidden";
|
|
14759
14773
|
}
|
|
14760
14774
|
drawResizer(element, position = null, options = {}) {
|
|
14775
|
+
if (element.imgToolDisabled && !this.draw.isDesignMode())
|
|
14776
|
+
return;
|
|
14761
14777
|
this.previewerDrawOption = options;
|
|
14762
14778
|
this.curElementSrc = element[options.srcKey || "value"] || "";
|
|
14763
14779
|
this.updateResizer(element, position);
|
|
@@ -15626,9 +15642,11 @@ class ListParticle {
|
|
|
15626
15642
|
if (element.value === ZERO && !element.listWrap)
|
|
15627
15643
|
break;
|
|
15628
15644
|
if (element.listId !== endElement.listId) {
|
|
15629
|
-
this.draw.spliceElementList(elementList, start, 0,
|
|
15630
|
-
|
|
15631
|
-
|
|
15645
|
+
this.draw.spliceElementList(elementList, start, 0, [
|
|
15646
|
+
{
|
|
15647
|
+
value: ZERO
|
|
15648
|
+
}
|
|
15649
|
+
]);
|
|
15632
15650
|
break;
|
|
15633
15651
|
}
|
|
15634
15652
|
start++;
|
|
@@ -16218,7 +16236,7 @@ class TableOperate {
|
|
|
16218
16236
|
editorOptions: this.options
|
|
16219
16237
|
});
|
|
16220
16238
|
const curIndex = startIndex + 1;
|
|
16221
|
-
this.draw.spliceElementList(elementList, curIndex, startIndex === endIndex ? 0 : endIndex - startIndex, element);
|
|
16239
|
+
this.draw.spliceElementList(elementList, curIndex, startIndex === endIndex ? 0 : endIndex - startIndex, [element]);
|
|
16222
16240
|
this.range.setRange(curIndex, curIndex);
|
|
16223
16241
|
this.draw.render({ curIndex, isSetCursor: false });
|
|
16224
16242
|
}
|
|
@@ -17734,7 +17752,7 @@ class Draw {
|
|
|
17734
17752
|
if (!isCollapsed) {
|
|
17735
17753
|
this.spliceElementList(elementList, start, endIndex - startIndex);
|
|
17736
17754
|
}
|
|
17737
|
-
this.spliceElementList(elementList, start, 0,
|
|
17755
|
+
this.spliceElementList(elementList, start, 0, payload);
|
|
17738
17756
|
curIndex = startIndex + payload.length;
|
|
17739
17757
|
const preElement = elementList[start - 1];
|
|
17740
17758
|
if (payload[0].listId && preElement && !preElement.listId && (preElement == null ? void 0 : preElement.value) === ZERO && (!preElement.type || preElement.type === ElementType.TEXT)) {
|
|
@@ -17770,7 +17788,7 @@ class Draw {
|
|
|
17770
17788
|
curIndex
|
|
17771
17789
|
});
|
|
17772
17790
|
}
|
|
17773
|
-
spliceElementList(elementList, start, deleteCount,
|
|
17791
|
+
spliceElementList(elementList, start, deleteCount, items) {
|
|
17774
17792
|
var _a, _b, _c, _d, _e;
|
|
17775
17793
|
const isDesignMode = this.isDesignMode();
|
|
17776
17794
|
if (deleteCount > 0) {
|
|
@@ -17804,8 +17822,10 @@ class Draw {
|
|
|
17804
17822
|
elementList.splice(start, deleteCount);
|
|
17805
17823
|
}
|
|
17806
17824
|
}
|
|
17807
|
-
|
|
17808
|
-
|
|
17825
|
+
if (items == null ? void 0 : items.length) {
|
|
17826
|
+
for (let i = 0; i < items.length; i++) {
|
|
17827
|
+
elementList.splice(start + i, 0, items[i]);
|
|
17828
|
+
}
|
|
17809
17829
|
}
|
|
17810
17830
|
}
|
|
17811
17831
|
getCanvasEvent() {
|
|
@@ -18416,7 +18436,7 @@ class Draw {
|
|
|
18416
18436
|
}
|
|
18417
18437
|
cloneElement.trList = cloneTrList;
|
|
18418
18438
|
cloneElement.id = getUUID();
|
|
18419
|
-
this.spliceElementList(elementList, i + 1, 0, cloneElement);
|
|
18439
|
+
this.spliceElementList(elementList, i + 1, 0, [cloneElement]);
|
|
18420
18440
|
}
|
|
18421
18441
|
}
|
|
18422
18442
|
if (element.pagingId) {
|
|
@@ -20403,7 +20423,7 @@ class CommandAdapt {
|
|
|
20403
20423
|
formatElementContext(elementList, newElementList, startIndex, {
|
|
20404
20424
|
editorOptions: this.options
|
|
20405
20425
|
});
|
|
20406
|
-
this.draw.spliceElementList(elementList, start, startIndex === endIndex ? 0 : endIndex - startIndex,
|
|
20426
|
+
this.draw.spliceElementList(elementList, start, startIndex === endIndex ? 0 : endIndex - startIndex, newElementList);
|
|
20407
20427
|
const curIndex = start + newElementList.length - 1;
|
|
20408
20428
|
this.range.setRange(curIndex, curIndex);
|
|
20409
20429
|
this.draw.render({ curIndex });
|
|
@@ -20532,10 +20552,12 @@ class CommandAdapt {
|
|
|
20532
20552
|
editorOptions: this.options
|
|
20533
20553
|
});
|
|
20534
20554
|
if (startIndex !== 0 && elementList[startIndex].value === ZERO) {
|
|
20535
|
-
this.draw.spliceElementList(elementList, startIndex, 1, newElement);
|
|
20555
|
+
this.draw.spliceElementList(elementList, startIndex, 1, [newElement]);
|
|
20536
20556
|
curIndex = startIndex - 1;
|
|
20537
20557
|
} else {
|
|
20538
|
-
this.draw.spliceElementList(elementList, startIndex + 1, 0,
|
|
20558
|
+
this.draw.spliceElementList(elementList, startIndex + 1, 0, [
|
|
20559
|
+
newElement
|
|
20560
|
+
]);
|
|
20539
20561
|
curIndex = startIndex;
|
|
20540
20562
|
}
|
|
20541
20563
|
}
|