@hufe921/canvas-editor 0.9.38 → 0.9.39
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 +15 -0
- package/dist/canvas-editor.es.js +27 -5
- package/dist/canvas-editor.es.js.map +1 -1
- package/dist/canvas-editor.umd.js +16 -16
- package/dist/canvas-editor.umd.js.map +1 -1
- 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/interface/Editor.d.ts +1 -0
- package/dist/src/editor/interface/Range.d.ts +8 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
## [0.9.39](https://github.com/Hufe921/canvas-editor/compare/v0.9.38...v0.9.39) (2023-07-14)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Documentation
|
|
5
|
+
|
|
6
|
+
* add clean mode remark #214 ([abcc241](https://github.com/Hufe921/canvas-editor/commit/abcc2417966dfa6a43246e3b33dfc39fc65595be)), closes [#214](https://github.com/Hufe921/canvas-editor/issues/214)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* add table row and col size option #214 ([8d1100c](https://github.com/Hufe921/canvas-editor/commit/8d1100cdb1646bf8822112993c00881cf9e39a5e)), closes [#214](https://github.com/Hufe921/canvas-editor/issues/214)
|
|
12
|
+
* get range context info ([09c4d53](https://github.com/Hufe921/canvas-editor/commit/09c4d53bca9744b115b5e7c94a42ebe81da487b8))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
1
16
|
## [0.9.38](https://github.com/Hufe921/canvas-editor/compare/v0.9.37...v0.9.38) (2023-07-12)
|
|
2
17
|
|
|
3
18
|
|
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.39";
|
|
27
27
|
var MaxHeightRatio;
|
|
28
28
|
(function(MaxHeightRatio2) {
|
|
29
29
|
MaxHeightRatio2["HALF"] = "half";
|
|
@@ -11824,6 +11824,7 @@ class Command {
|
|
|
11824
11824
|
__publicField(this, "getValue");
|
|
11825
11825
|
__publicField(this, "getWordCount");
|
|
11826
11826
|
__publicField(this, "getRangeText");
|
|
11827
|
+
__publicField(this, "getRangeContext");
|
|
11827
11828
|
__publicField(this, "getPaperMargin");
|
|
11828
11829
|
__publicField(this, "getSearchNavigateInfo");
|
|
11829
11830
|
this.executeMode = adapt.mode.bind(adapt);
|
|
@@ -11902,6 +11903,7 @@ class Command {
|
|
|
11902
11903
|
this.getValue = adapt.getValue.bind(adapt);
|
|
11903
11904
|
this.getWordCount = adapt.getWordCount.bind(adapt);
|
|
11904
11905
|
this.getRangeText = adapt.getRangeText.bind(adapt);
|
|
11906
|
+
this.getRangeContext = adapt.getRangeContext.bind(adapt);
|
|
11905
11907
|
this.getCatalog = adapt.getCatalog.bind(adapt);
|
|
11906
11908
|
this.getPaperMargin = adapt.getPaperMargin.bind(adapt);
|
|
11907
11909
|
this.getSearchNavigateInfo = adapt.getSearchNavigateInfo.bind(adapt);
|
|
@@ -11963,7 +11965,6 @@ function printImageBase64(base64List, width, height) {
|
|
|
11963
11965
|
}
|
|
11964
11966
|
class CommandAdapt {
|
|
11965
11967
|
constructor(draw) {
|
|
11966
|
-
__publicField(this, "defaultWidth", 40);
|
|
11967
11968
|
__publicField(this, "draw");
|
|
11968
11969
|
__publicField(this, "range");
|
|
11969
11970
|
__publicField(this, "position");
|
|
@@ -12464,7 +12465,7 @@ class CommandAdapt {
|
|
|
12464
12465
|
for (let r = 0; r < row; r++) {
|
|
12465
12466
|
const tdList = [];
|
|
12466
12467
|
const tr = {
|
|
12467
|
-
height:
|
|
12468
|
+
height: this.options.defaultTrMinHeight,
|
|
12468
12469
|
tdList
|
|
12469
12470
|
};
|
|
12470
12471
|
for (let c = 0; c < col; c++) {
|
|
@@ -12642,7 +12643,7 @@ class CommandAdapt {
|
|
|
12642
12643
|
}
|
|
12643
12644
|
const colgroup = element.colgroup;
|
|
12644
12645
|
colgroup.splice(curTdIndex, 0, {
|
|
12645
|
-
width: this.
|
|
12646
|
+
width: this.options.defaultColMinWidth
|
|
12646
12647
|
});
|
|
12647
12648
|
const colgroupWidth = colgroup.reduce((pre, cur) => pre + cur.width, 0);
|
|
12648
12649
|
const width = this.draw.getOriginalInnerWidth();
|
|
@@ -12696,7 +12697,7 @@ class CommandAdapt {
|
|
|
12696
12697
|
}
|
|
12697
12698
|
const colgroup = element.colgroup;
|
|
12698
12699
|
colgroup.splice(curTdIndex, 0, {
|
|
12699
|
-
width: this.
|
|
12700
|
+
width: this.options.defaultColMinWidth
|
|
12700
12701
|
});
|
|
12701
12702
|
const colgroupWidth = colgroup.reduce((pre, cur) => pre + cur.width, 0);
|
|
12702
12703
|
const width = this.draw.getOriginalInnerWidth();
|
|
@@ -13460,6 +13461,26 @@ class CommandAdapt {
|
|
|
13460
13461
|
getRangeText() {
|
|
13461
13462
|
return this.range.toString();
|
|
13462
13463
|
}
|
|
13464
|
+
getRangeContext() {
|
|
13465
|
+
const range = this.range.getRange();
|
|
13466
|
+
const { startIndex, endIndex } = range;
|
|
13467
|
+
if (!~startIndex && !~endIndex)
|
|
13468
|
+
return null;
|
|
13469
|
+
const isCollapsed = startIndex === endIndex;
|
|
13470
|
+
const elementList = this.draw.getElementList();
|
|
13471
|
+
const startElement = pickElementAttr(elementList[isCollapsed ? startIndex : startIndex + 1]);
|
|
13472
|
+
const endElement = pickElementAttr(elementList[endIndex]);
|
|
13473
|
+
const positionList = this.position.getPositionList();
|
|
13474
|
+
const startPageNo = positionList[startIndex].pageNo;
|
|
13475
|
+
const endPageNo = positionList[endIndex].pageNo;
|
|
13476
|
+
return deepClone({
|
|
13477
|
+
isCollapsed,
|
|
13478
|
+
startElement,
|
|
13479
|
+
endElement,
|
|
13480
|
+
startPageNo,
|
|
13481
|
+
endPageNo
|
|
13482
|
+
});
|
|
13483
|
+
}
|
|
13463
13484
|
pageMode(payload) {
|
|
13464
13485
|
this.draw.setPageMode(payload);
|
|
13465
13486
|
}
|
|
@@ -14466,6 +14487,7 @@ class Editor {
|
|
|
14466
14487
|
pageMode: PageMode.PAGING,
|
|
14467
14488
|
tdPadding: 5,
|
|
14468
14489
|
defaultTrMinHeight: 40,
|
|
14490
|
+
defaultColMinWidth: 40,
|
|
14469
14491
|
defaultHyperlinkColor: "#0000FF",
|
|
14470
14492
|
paperDirection: PaperDirection.VERTICAL,
|
|
14471
14493
|
inactiveAlpha: 0.6,
|