@hufe921/canvas-editor 0.9.41 → 0.9.43
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 +32 -0
- package/dist/canvas-editor.es.js +196 -84
- package/dist/canvas-editor.es.js.map +1 -1
- package/dist/canvas-editor.umd.js +22 -22
- 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 +1 -0
- package/dist/src/editor/core/cursor/Cursor.d.ts +7 -0
- package/dist/src/editor/core/draw/Draw.d.ts +0 -2
- package/dist/src/editor/core/draw/control/Control.d.ts +1 -0
- package/dist/src/editor/core/draw/frame/Footer.d.ts +1 -1
- package/dist/src/editor/core/draw/frame/Header.d.ts +1 -1
- package/dist/src/editor/dataset/enum/Editor.d.ts +2 -1
- package/dist/src/editor/interface/Draw.d.ts +1 -0
- package/dist/src/editor/interface/Editor.d.ts +1 -0
- package/dist/src/editor/utils/index.d.ts +2 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,35 @@
|
|
|
1
|
+
## [0.9.43](https://github.com/Hufe921/canvas-editor/compare/v0.9.42...v0.9.43) (2023-08-04)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* cursor navigation across pages #229 ([a96a77a](https://github.com/Hufe921/canvas-editor/commit/a96a77a237a62f0881a2b106b040f29c840fff58)), closes [#229](https://github.com/Hufe921/canvas-editor/issues/229)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* add form mode #221 ([94247c3](https://github.com/Hufe921/canvas-editor/commit/94247c324be8bd3688f4098ab9520fc563d20ded)), closes [#221](https://github.com/Hufe921/canvas-editor/issues/221)
|
|
12
|
+
* cursor following page scrolling #229 ([3db28cc](https://github.com/Hufe921/canvas-editor/commit/3db28cc04f84af502901da51a14e3f63c8a36964)), closes [#229](https://github.com/Hufe921/canvas-editor/issues/229)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
## [0.9.42](https://github.com/Hufe921/canvas-editor/compare/v0.9.41...v0.9.42) (2023-07-31)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
|
|
21
|
+
* contentChange call error during initialization #224 ([1b25afb](https://github.com/Hufe921/canvas-editor/commit/1b25afb664b6feff8a0e96dda53a0a3b252663c7)), closes [#224](https://github.com/Hufe921/canvas-editor/issues/224)
|
|
22
|
+
* control value style not affected by prefix #227 ([cf5dd35](https://github.com/Hufe921/canvas-editor/commit/cf5dd356869ac272dd8d3a1948ff5f4c6536b23d)), closes [#227](https://github.com/Hufe921/canvas-editor/issues/227)
|
|
23
|
+
* limit word break element type ([73014dc](https://github.com/Hufe921/canvas-editor/commit/73014dc87be5360ab8f09e211a12b06dfcbb77e2))
|
|
24
|
+
* set header and footer data error #224 ([b22f0b4](https://github.com/Hufe921/canvas-editor/commit/b22f0b45418b76ba008a2f6200bf8210f3c6f0dd)), closes [#224](https://github.com/Hufe921/canvas-editor/issues/224)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Features
|
|
28
|
+
|
|
29
|
+
* add SetHTML api ([52f7500](https://github.com/Hufe921/canvas-editor/commit/52f7500ae3e27b1746af423dcbf1faffc9134948))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
1
33
|
## [0.9.41](https://github.com/Hufe921/canvas-editor/compare/v0.9.40...v0.9.41) (2023-07-27)
|
|
2
34
|
|
|
3
35
|
|
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.43";
|
|
27
27
|
var MaxHeightRatio;
|
|
28
28
|
(function(MaxHeightRatio2) {
|
|
29
29
|
MaxHeightRatio2["HALF"] = "half";
|
|
@@ -228,6 +228,15 @@ function cloneProperty(properties, sourceElement, targetElement) {
|
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
|
+
function omitObject(object, keys) {
|
|
232
|
+
const cloneObject = deepClone(object);
|
|
233
|
+
for (const key in object) {
|
|
234
|
+
if (keys.includes(key)) {
|
|
235
|
+
delete cloneObject[key];
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
return cloneObject;
|
|
239
|
+
}
|
|
231
240
|
function convertStringToBase64(input2) {
|
|
232
241
|
const encoder = new TextEncoder();
|
|
233
242
|
const data2 = encoder.encode(input2);
|
|
@@ -235,6 +244,18 @@ function convertStringToBase64(input2) {
|
|
|
235
244
|
const base64 = window.btoa(charArray.join(""));
|
|
236
245
|
return base64;
|
|
237
246
|
}
|
|
247
|
+
function findScrollContainer(element) {
|
|
248
|
+
let parent = element.parentElement;
|
|
249
|
+
while (parent) {
|
|
250
|
+
const style = window.getComputedStyle(parent);
|
|
251
|
+
const overflowY = style.getPropertyValue("overflow-y");
|
|
252
|
+
if (parent.scrollHeight > parent.clientHeight && (overflowY === "auto" || overflowY === "scroll")) {
|
|
253
|
+
return parent;
|
|
254
|
+
}
|
|
255
|
+
parent = parent.parentElement;
|
|
256
|
+
}
|
|
257
|
+
return document.documentElement;
|
|
258
|
+
}
|
|
238
259
|
const CURSOR_AGENT_HEIGHT = 12;
|
|
239
260
|
const defaultCursorOption = {
|
|
240
261
|
width: 1,
|
|
@@ -244,6 +265,13 @@ const defaultCursorOption = {
|
|
|
244
265
|
};
|
|
245
266
|
const EDITOR_COMPONENT = "editor-component";
|
|
246
267
|
const EDITOR_PREFIX = "ce";
|
|
268
|
+
var MoveDirection;
|
|
269
|
+
(function(MoveDirection2) {
|
|
270
|
+
MoveDirection2["UP"] = "top";
|
|
271
|
+
MoveDirection2["DOWN"] = "down";
|
|
272
|
+
MoveDirection2["LEFT"] = "left";
|
|
273
|
+
MoveDirection2["RIGHT"] = "right";
|
|
274
|
+
})(MoveDirection || (MoveDirection = {}));
|
|
247
275
|
var ElementType;
|
|
248
276
|
(function(ElementType2) {
|
|
249
277
|
ElementType2["TEXT"] = "text";
|
|
@@ -4610,6 +4638,40 @@ class Cursor {
|
|
|
4610
4638
|
this.cursorDom.style.display = "none";
|
|
4611
4639
|
this._clearBlinkTimeout();
|
|
4612
4640
|
}
|
|
4641
|
+
moveCursorToVisible(payload) {
|
|
4642
|
+
const { cursorPosition, direction } = payload;
|
|
4643
|
+
if (!cursorPosition || !direction)
|
|
4644
|
+
return;
|
|
4645
|
+
const { pageNo, coordinate: { leftTop, leftBottom } } = cursorPosition;
|
|
4646
|
+
const prePageY = pageNo * (this.draw.getHeight() + this.draw.getPageGap()) + this.container.getBoundingClientRect().top;
|
|
4647
|
+
const isUp = direction === MoveDirection.UP;
|
|
4648
|
+
const x = leftBottom[0];
|
|
4649
|
+
const y = isUp ? leftTop[1] + prePageY : leftBottom[1] + prePageY;
|
|
4650
|
+
const scrollContainer = findScrollContainer(this.container);
|
|
4651
|
+
const rect = {
|
|
4652
|
+
left: 0,
|
|
4653
|
+
right: 0,
|
|
4654
|
+
top: 0,
|
|
4655
|
+
bottom: 0
|
|
4656
|
+
};
|
|
4657
|
+
if (scrollContainer === document.documentElement) {
|
|
4658
|
+
rect.right = window.innerWidth;
|
|
4659
|
+
rect.bottom = window.innerHeight;
|
|
4660
|
+
} else {
|
|
4661
|
+
const { left, right, top, bottom } = scrollContainer.getBoundingClientRect();
|
|
4662
|
+
rect.left = left;
|
|
4663
|
+
rect.right = right;
|
|
4664
|
+
rect.top = top;
|
|
4665
|
+
rect.bottom = bottom;
|
|
4666
|
+
}
|
|
4667
|
+
const { maskMargin } = this.options;
|
|
4668
|
+
rect.top += maskMargin[0];
|
|
4669
|
+
rect.bottom -= maskMargin[2];
|
|
4670
|
+
if (!(x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom)) {
|
|
4671
|
+
const { scrollLeft, scrollTop } = scrollContainer;
|
|
4672
|
+
isUp ? scrollContainer.scroll(scrollLeft, scrollTop - (rect.top - y)) : scrollContainer.scroll(scrollLeft, scrollTop + y - rect.bottom);
|
|
4673
|
+
}
|
|
4674
|
+
}
|
|
4613
4675
|
}
|
|
4614
4676
|
var MouseEventButton;
|
|
4615
4677
|
(function(MouseEventButton2) {
|
|
@@ -4916,6 +4978,8 @@ function mouseup(evt, host) {
|
|
|
4916
4978
|
var _a, _b, _c;
|
|
4917
4979
|
if (host.isAllowDrop) {
|
|
4918
4980
|
const draw = host.getDraw();
|
|
4981
|
+
if (draw.isReadonly())
|
|
4982
|
+
return;
|
|
4919
4983
|
const position = draw.getPosition();
|
|
4920
4984
|
const positionList = position.getPositionList();
|
|
4921
4985
|
const rangeManager = draw.getRange();
|
|
@@ -5266,7 +5330,6 @@ function keydown(evt, host) {
|
|
|
5266
5330
|
if (isReadonly)
|
|
5267
5331
|
return;
|
|
5268
5332
|
let anchorPosition = cursorPosition;
|
|
5269
|
-
const isUp = evt.key === KeyMap.Up;
|
|
5270
5333
|
if (evt.shiftKey) {
|
|
5271
5334
|
if (startIndex === cursorPosition.index) {
|
|
5272
5335
|
anchorPosition = positionList[endIndex];
|
|
@@ -5274,62 +5337,83 @@ function keydown(evt, host) {
|
|
|
5274
5337
|
anchorPosition = positionList[startIndex];
|
|
5275
5338
|
}
|
|
5276
5339
|
}
|
|
5277
|
-
const {
|
|
5278
|
-
|
|
5279
|
-
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
|
|
5287
|
-
|
|
5288
|
-
|
|
5289
|
-
|
|
5290
|
-
|
|
5291
|
-
|
|
5292
|
-
const curDistance = position2.coordinate.rightTop[0] - leftTop[0];
|
|
5293
|
-
if (curDistance > maxDistance) {
|
|
5294
|
-
maxIndex = position2.index;
|
|
5295
|
-
maxDistance = curDistance;
|
|
5296
|
-
break;
|
|
5297
|
-
}
|
|
5340
|
+
const { index: index22, rowNo, rowIndex, coordinate: { leftTop: [curLeftX], rightTop: [curRightX] } } = anchorPosition;
|
|
5341
|
+
const isUp = evt.key === KeyMap.Up;
|
|
5342
|
+
if (isUp && rowIndex === 0 || !isUp && rowIndex === draw.getRowCount() - 1) {
|
|
5343
|
+
return;
|
|
5344
|
+
}
|
|
5345
|
+
const probablePosition = [];
|
|
5346
|
+
if (isUp) {
|
|
5347
|
+
let p = index22 - 1;
|
|
5348
|
+
while (p > 0) {
|
|
5349
|
+
const position2 = positionList[p];
|
|
5350
|
+
p--;
|
|
5351
|
+
if (position2.rowNo === rowNo)
|
|
5352
|
+
continue;
|
|
5353
|
+
if (probablePosition[0] && probablePosition[0].rowNo !== position2.rowNo) {
|
|
5354
|
+
break;
|
|
5298
5355
|
}
|
|
5299
|
-
|
|
5300
|
-
|
|
5356
|
+
probablePosition.unshift(position2);
|
|
5357
|
+
}
|
|
5358
|
+
} else {
|
|
5359
|
+
let p = index22 + 1;
|
|
5360
|
+
while (p < positionList.length) {
|
|
5361
|
+
const position2 = positionList[p];
|
|
5362
|
+
p++;
|
|
5363
|
+
if (position2.rowNo === rowNo)
|
|
5364
|
+
continue;
|
|
5365
|
+
if (probablePosition[0] && probablePosition[0].rowNo !== position2.rowNo) {
|
|
5366
|
+
break;
|
|
5301
5367
|
}
|
|
5368
|
+
probablePosition.push(position2);
|
|
5302
5369
|
}
|
|
5303
|
-
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
|
|
5308
|
-
|
|
5309
|
-
|
|
5310
|
-
|
|
5311
|
-
|
|
5312
|
-
|
|
5370
|
+
}
|
|
5371
|
+
let nextIndex = 0;
|
|
5372
|
+
for (let p = 0; p < probablePosition.length; p++) {
|
|
5373
|
+
const nextPosition = probablePosition[p];
|
|
5374
|
+
const { coordinate: { leftTop: [nextLeftX], rightTop: [nextRightX] } } = nextPosition;
|
|
5375
|
+
if (p === probablePosition.length - 1) {
|
|
5376
|
+
nextIndex = nextPosition.index;
|
|
5377
|
+
}
|
|
5378
|
+
if (curRightX <= nextLeftX || curLeftX >= nextRightX)
|
|
5379
|
+
continue;
|
|
5380
|
+
nextIndex = nextPosition.index;
|
|
5381
|
+
break;
|
|
5382
|
+
}
|
|
5383
|
+
if (!nextIndex)
|
|
5384
|
+
return;
|
|
5385
|
+
let anchorStartIndex = nextIndex;
|
|
5386
|
+
let anchorEndIndex = nextIndex;
|
|
5387
|
+
if (evt.shiftKey) {
|
|
5388
|
+
if (startIndex !== endIndex) {
|
|
5389
|
+
if (startIndex === cursorPosition.index) {
|
|
5390
|
+
anchorStartIndex = startIndex;
|
|
5313
5391
|
} else {
|
|
5314
|
-
|
|
5315
|
-
|
|
5316
|
-
|
|
5317
|
-
|
|
5318
|
-
|
|
5392
|
+
anchorEndIndex = endIndex;
|
|
5393
|
+
}
|
|
5394
|
+
} else {
|
|
5395
|
+
if (isUp) {
|
|
5396
|
+
anchorEndIndex = endIndex;
|
|
5397
|
+
} else {
|
|
5398
|
+
anchorStartIndex = startIndex;
|
|
5319
5399
|
}
|
|
5320
5400
|
}
|
|
5321
|
-
if (anchorStartIndex > anchorEndIndex) {
|
|
5322
|
-
[anchorStartIndex, anchorEndIndex] = [anchorEndIndex, anchorStartIndex];
|
|
5323
|
-
}
|
|
5324
|
-
rangeManager.setRange(anchorStartIndex, anchorEndIndex);
|
|
5325
|
-
const isCollapsed2 = anchorStartIndex === anchorEndIndex;
|
|
5326
|
-
draw.render({
|
|
5327
|
-
curIndex: isCollapsed2 ? anchorStartIndex : void 0,
|
|
5328
|
-
isSetCursor: isCollapsed2,
|
|
5329
|
-
isSubmitHistory: false,
|
|
5330
|
-
isCompute: false
|
|
5331
|
-
});
|
|
5332
5401
|
}
|
|
5402
|
+
if (anchorStartIndex > anchorEndIndex) {
|
|
5403
|
+
[anchorStartIndex, anchorEndIndex] = [anchorEndIndex, anchorStartIndex];
|
|
5404
|
+
}
|
|
5405
|
+
rangeManager.setRange(anchorStartIndex, anchorEndIndex);
|
|
5406
|
+
const isCollapsed2 = anchorStartIndex === anchorEndIndex;
|
|
5407
|
+
draw.render({
|
|
5408
|
+
curIndex: isCollapsed2 ? anchorStartIndex : void 0,
|
|
5409
|
+
isSetCursor: isCollapsed2,
|
|
5410
|
+
isSubmitHistory: false,
|
|
5411
|
+
isCompute: false
|
|
5412
|
+
});
|
|
5413
|
+
draw.getCursor().moveCursorToVisible({
|
|
5414
|
+
cursorPosition: positionList[isUp ? anchorStartIndex : anchorEndIndex],
|
|
5415
|
+
direction: isUp ? MoveDirection.UP : MoveDirection.DOWN
|
|
5416
|
+
});
|
|
5333
5417
|
} else if (isMod(evt) && evt.key === KeyMap.Z) {
|
|
5334
5418
|
if (isReadonly)
|
|
5335
5419
|
return;
|
|
@@ -6047,6 +6131,7 @@ var EditorMode;
|
|
|
6047
6131
|
EditorMode2["EDIT"] = "edit";
|
|
6048
6132
|
EditorMode2["CLEAN"] = "clean";
|
|
6049
6133
|
EditorMode2["READONLY"] = "readonly";
|
|
6134
|
+
EditorMode2["FORM"] = "form";
|
|
6050
6135
|
})(EditorMode || (EditorMode = {}));
|
|
6051
6136
|
var EditorZone;
|
|
6052
6137
|
(function(EditorZone2) {
|
|
@@ -6410,11 +6495,10 @@ class Position {
|
|
|
6410
6495
|
};
|
|
6411
6496
|
}
|
|
6412
6497
|
adjustPositionContext(payload) {
|
|
6413
|
-
const isReadonly = this.draw.isReadonly();
|
|
6414
6498
|
const positionResult = this.getPositionByXY(payload);
|
|
6415
6499
|
if (!~positionResult.index)
|
|
6416
6500
|
return null;
|
|
6417
|
-
if (positionResult.isControl &&
|
|
6501
|
+
if (positionResult.isControl && this.draw.getMode() !== EditorMode.READONLY) {
|
|
6418
6502
|
const { index: index22, isTable: isTable2, trIndex: trIndex2, tdIndex: tdIndex2, tdValueIndex } = positionResult;
|
|
6419
6503
|
const control = this.draw.getControl();
|
|
6420
6504
|
const { newIndex } = control.moveCursor({
|
|
@@ -7225,7 +7309,7 @@ class TextParticle {
|
|
|
7225
7309
|
let i = curIndex;
|
|
7226
7310
|
while (i < elementList.length) {
|
|
7227
7311
|
const element = elementList[i];
|
|
7228
|
-
if (!LETTER_REG.test(element.value)) {
|
|
7312
|
+
if (element.type && element.type !== ElementType.TEXT || !LETTER_REG.test(element.value)) {
|
|
7229
7313
|
endElement = element;
|
|
7230
7314
|
break;
|
|
7231
7315
|
}
|
|
@@ -7400,13 +7484,6 @@ class ScrollObserver {
|
|
|
7400
7484
|
};
|
|
7401
7485
|
}
|
|
7402
7486
|
}
|
|
7403
|
-
var MoveDirection;
|
|
7404
|
-
(function(MoveDirection2) {
|
|
7405
|
-
MoveDirection2["UP"] = "top";
|
|
7406
|
-
MoveDirection2["DOWN"] = "down";
|
|
7407
|
-
MoveDirection2["LEFT"] = "left";
|
|
7408
|
-
MoveDirection2["RIGHT"] = "right";
|
|
7409
|
-
})(MoveDirection || (MoveDirection = {}));
|
|
7410
7487
|
class SelectionObserver {
|
|
7411
7488
|
constructor(draw) {
|
|
7412
7489
|
__publicField(this, "step", 5);
|
|
@@ -8096,7 +8173,7 @@ class HyperlinkParticle {
|
|
|
8096
8173
|
}
|
|
8097
8174
|
}
|
|
8098
8175
|
class Header {
|
|
8099
|
-
constructor(draw) {
|
|
8176
|
+
constructor(draw, data2) {
|
|
8100
8177
|
__publicField(this, "draw");
|
|
8101
8178
|
__publicField(this, "position");
|
|
8102
8179
|
__publicField(this, "options");
|
|
@@ -8106,7 +8183,7 @@ class Header {
|
|
|
8106
8183
|
this.draw = draw;
|
|
8107
8184
|
this.position = draw.getPosition();
|
|
8108
8185
|
this.options = draw.getOptions();
|
|
8109
|
-
this.elementList =
|
|
8186
|
+
this.elementList = data2 || [];
|
|
8110
8187
|
this.rowList = [];
|
|
8111
8188
|
this.positionList = [];
|
|
8112
8189
|
}
|
|
@@ -8433,11 +8510,12 @@ class SelectControl {
|
|
|
8433
8510
|
this.control.removePlaceholder(startIndex);
|
|
8434
8511
|
const elementList = this.control.getElementList();
|
|
8435
8512
|
const startElement = elementList[startIndex];
|
|
8513
|
+
const anchorElement = startElement.controlComponent === ControlComponent.PREFIX ? omitObject(startElement, EDITOR_ELEMENT_STYLE_ATTR) : startElement;
|
|
8436
8514
|
const start = startIndex + 1;
|
|
8437
8515
|
const data2 = splitText(valueSet.value);
|
|
8438
8516
|
const draw = this.control.getDraw();
|
|
8439
8517
|
for (let i = 0; i < data2.length; i++) {
|
|
8440
|
-
const newElement = __spreadProps(__spreadValues({},
|
|
8518
|
+
const newElement = __spreadProps(__spreadValues({}, anchorElement), {
|
|
8441
8519
|
value: data2[i],
|
|
8442
8520
|
controlComponent: ControlComponent.VALUE
|
|
8443
8521
|
});
|
|
@@ -8554,9 +8632,10 @@ class TextControl {
|
|
|
8554
8632
|
this.control.removePlaceholder(startIndex);
|
|
8555
8633
|
}
|
|
8556
8634
|
const startElement = elementList[startIndex];
|
|
8635
|
+
const anchorElement = startElement.controlComponent === ControlComponent.PREFIX ? omitObject(startElement, EDITOR_ELEMENT_STYLE_ATTR) : startElement;
|
|
8557
8636
|
const start = range.startIndex + 1;
|
|
8558
8637
|
for (let i = 0; i < data2.length; i++) {
|
|
8559
|
-
const newElement = __spreadProps(__spreadValues(__spreadValues({},
|
|
8638
|
+
const newElement = __spreadProps(__spreadValues(__spreadValues({}, anchorElement), data2[i]), {
|
|
8560
8639
|
controlComponent: ControlComponent.VALUE
|
|
8561
8640
|
});
|
|
8562
8641
|
formatElementContext(elementList, [newElement], startIndex);
|
|
@@ -8672,6 +8751,18 @@ class Control {
|
|
|
8672
8751
|
const element = elementList[startIndex];
|
|
8673
8752
|
return element.controlComponent === ControlComponent.POSTFIX;
|
|
8674
8753
|
}
|
|
8754
|
+
isRangeWithinControl() {
|
|
8755
|
+
const { startIndex, endIndex } = this.getRange();
|
|
8756
|
+
if (!~startIndex && !~endIndex)
|
|
8757
|
+
return false;
|
|
8758
|
+
const elementList = this.getElementList();
|
|
8759
|
+
const startElement = elementList[startIndex];
|
|
8760
|
+
const endElement = elementList[endIndex];
|
|
8761
|
+
if ((startElement.type === ElementType.CONTROL || endElement.type === ElementType.CONTROL) && endElement.controlComponent !== ControlComponent.POSTFIX && startElement.controlId === endElement.controlId) {
|
|
8762
|
+
return true;
|
|
8763
|
+
}
|
|
8764
|
+
return false;
|
|
8765
|
+
}
|
|
8675
8766
|
getContainer() {
|
|
8676
8767
|
return this.draw.getContainer();
|
|
8677
8768
|
}
|
|
@@ -10333,7 +10424,7 @@ class Zone {
|
|
|
10333
10424
|
}
|
|
10334
10425
|
}
|
|
10335
10426
|
class Footer {
|
|
10336
|
-
constructor(draw) {
|
|
10427
|
+
constructor(draw, data2) {
|
|
10337
10428
|
__publicField(this, "draw");
|
|
10338
10429
|
__publicField(this, "position");
|
|
10339
10430
|
__publicField(this, "options");
|
|
@@ -10343,7 +10434,7 @@ class Footer {
|
|
|
10343
10434
|
this.draw = draw;
|
|
10344
10435
|
this.position = draw.getPosition();
|
|
10345
10436
|
this.options = draw.getOptions();
|
|
10346
|
-
this.elementList =
|
|
10437
|
+
this.elementList = data2 || [];
|
|
10347
10438
|
this.rowList = [];
|
|
10348
10439
|
this.positionList = [];
|
|
10349
10440
|
}
|
|
@@ -10607,9 +10698,7 @@ class Draw {
|
|
|
10607
10698
|
__publicField(this, "options");
|
|
10608
10699
|
__publicField(this, "position");
|
|
10609
10700
|
__publicField(this, "zone");
|
|
10610
|
-
__publicField(this, "headerElementList");
|
|
10611
10701
|
__publicField(this, "elementList");
|
|
10612
|
-
__publicField(this, "footerElementList");
|
|
10613
10702
|
__publicField(this, "listener");
|
|
10614
10703
|
__publicField(this, "eventBus");
|
|
10615
10704
|
__publicField(this, "i18n");
|
|
@@ -10663,9 +10752,7 @@ class Draw {
|
|
|
10663
10752
|
this.pagePixelRatio = null;
|
|
10664
10753
|
this.mode = options.mode;
|
|
10665
10754
|
this.options = options;
|
|
10666
|
-
this.headerElementList = data2.header || [];
|
|
10667
10755
|
this.elementList = data2.main;
|
|
10668
|
-
this.footerElementList = data2.footer || [];
|
|
10669
10756
|
this.listener = listener;
|
|
10670
10757
|
this.eventBus = eventBus;
|
|
10671
10758
|
this._formatContainer();
|
|
@@ -10691,8 +10778,8 @@ class Draw {
|
|
|
10691
10778
|
this.pageNumber = new PageNumber(this);
|
|
10692
10779
|
this.waterMark = new Watermark(this);
|
|
10693
10780
|
this.placeholder = new Placeholder(this);
|
|
10694
|
-
this.header = new Header(this);
|
|
10695
|
-
this.footer = new Footer(this);
|
|
10781
|
+
this.header = new Header(this, data2.header);
|
|
10782
|
+
this.footer = new Footer(this, data2.footer);
|
|
10696
10783
|
this.hyperlinkParticle = new HyperlinkParticle(this);
|
|
10697
10784
|
this.dateParticle = new DateParticle(this);
|
|
10698
10785
|
this.separatorParticle = new SeparatorParticle();
|
|
@@ -10719,7 +10806,10 @@ class Draw {
|
|
|
10719
10806
|
this.visiblePageNoList = [];
|
|
10720
10807
|
this.intersectionPageNo = 0;
|
|
10721
10808
|
this.lazyRenderIntersectionObserver = null;
|
|
10722
|
-
this.render({
|
|
10809
|
+
this.render({
|
|
10810
|
+
isInit: true,
|
|
10811
|
+
isSetCursor: false
|
|
10812
|
+
});
|
|
10723
10813
|
}
|
|
10724
10814
|
getMode() {
|
|
10725
10815
|
return this.mode;
|
|
@@ -10728,7 +10818,14 @@ class Draw {
|
|
|
10728
10818
|
this.mode = payload;
|
|
10729
10819
|
}
|
|
10730
10820
|
isReadonly() {
|
|
10731
|
-
|
|
10821
|
+
switch (this.mode) {
|
|
10822
|
+
case EditorMode.READONLY:
|
|
10823
|
+
return true;
|
|
10824
|
+
case EditorMode.FORM:
|
|
10825
|
+
return !this.control.isRangeWithinControl();
|
|
10826
|
+
default:
|
|
10827
|
+
return false;
|
|
10828
|
+
}
|
|
10732
10829
|
}
|
|
10733
10830
|
getOriginalWidth() {
|
|
10734
10831
|
const { paperDirection, width, height } = this.options;
|
|
@@ -10884,7 +10981,7 @@ class Draw {
|
|
|
10884
10981
|
return this.range;
|
|
10885
10982
|
}
|
|
10886
10983
|
getHeaderElementList() {
|
|
10887
|
-
return this.
|
|
10984
|
+
return this.header.getElementList();
|
|
10888
10985
|
}
|
|
10889
10986
|
getTableElementList(sourceElementList) {
|
|
10890
10987
|
const positionContext = this.position.getPositionContext();
|
|
@@ -10903,10 +11000,10 @@ class Draw {
|
|
|
10903
11000
|
getOriginalElementList() {
|
|
10904
11001
|
const zoneManager = this.getZone();
|
|
10905
11002
|
if (zoneManager.isHeaderActive()) {
|
|
10906
|
-
return this.
|
|
11003
|
+
return this.getHeaderElementList();
|
|
10907
11004
|
}
|
|
10908
11005
|
if (zoneManager.isFooterActive()) {
|
|
10909
|
-
return this.
|
|
11006
|
+
return this.getFooterElementList();
|
|
10910
11007
|
}
|
|
10911
11008
|
return this.elementList;
|
|
10912
11009
|
}
|
|
@@ -10914,7 +11011,7 @@ class Draw {
|
|
|
10914
11011
|
return this.elementList;
|
|
10915
11012
|
}
|
|
10916
11013
|
getFooterElementList() {
|
|
10917
|
-
return this.
|
|
11014
|
+
return this.footer.getElementList();
|
|
10918
11015
|
}
|
|
10919
11016
|
insertElementList(payload) {
|
|
10920
11017
|
if (!payload.length)
|
|
@@ -11217,9 +11314,9 @@ class Draw {
|
|
|
11217
11314
|
mainElementList = this.pageRowList[pageNo].flatMap((row) => row.elementList);
|
|
11218
11315
|
}
|
|
11219
11316
|
const data2 = {
|
|
11220
|
-
header: zipElementList(this.
|
|
11317
|
+
header: zipElementList(this.getHeaderElementList()),
|
|
11221
11318
|
main: zipElementList(mainElementList),
|
|
11222
|
-
footer: zipElementList(this.
|
|
11319
|
+
footer: zipElementList(this.getFooterElementList())
|
|
11223
11320
|
};
|
|
11224
11321
|
return {
|
|
11225
11322
|
version,
|
|
@@ -11863,7 +11960,7 @@ class Draw {
|
|
|
11863
11960
|
render(payload) {
|
|
11864
11961
|
var _a;
|
|
11865
11962
|
const { header, footer } = this.options;
|
|
11866
|
-
const { isSubmitHistory = true, isSetCursor = true, isCompute = true, isLazy = true } = payload || {};
|
|
11963
|
+
const { isSubmitHistory = true, isSetCursor = true, isCompute = true, isLazy = true, isInit = false } = payload || {};
|
|
11867
11964
|
let { curIndex } = payload || {};
|
|
11868
11965
|
const innerWidth = this.getInnerWidth();
|
|
11869
11966
|
const isPagingMode = this.getIsPagingMode();
|
|
@@ -11953,7 +12050,7 @@ class Draw {
|
|
|
11953
12050
|
if (this.eventBus.isSubscribe("pageSizeChange")) {
|
|
11954
12051
|
this.eventBus.emit("pageSizeChange", this.pageRowList.length);
|
|
11955
12052
|
}
|
|
11956
|
-
if (isSubmitHistory) {
|
|
12053
|
+
if (isSubmitHistory && !isInit) {
|
|
11957
12054
|
if (this.listener.contentChange) {
|
|
11958
12055
|
this.listener.contentChange();
|
|
11959
12056
|
}
|
|
@@ -12044,6 +12141,7 @@ class Command {
|
|
|
12044
12141
|
__publicField(this, "executeSetLocale");
|
|
12045
12142
|
__publicField(this, "executeLocationCatalog");
|
|
12046
12143
|
__publicField(this, "executeWordTool");
|
|
12144
|
+
__publicField(this, "executeSetHTML");
|
|
12047
12145
|
__publicField(this, "getCatalog");
|
|
12048
12146
|
__publicField(this, "getImage");
|
|
12049
12147
|
__publicField(this, "getValue");
|
|
@@ -12125,6 +12223,7 @@ class Command {
|
|
|
12125
12223
|
this.executeSetLocale = adapt.setLocale.bind(adapt);
|
|
12126
12224
|
this.executeLocationCatalog = adapt.locationCatalog.bind(adapt);
|
|
12127
12225
|
this.executeWordTool = adapt.wordTool.bind(adapt);
|
|
12226
|
+
this.executeSetHTML = adapt.setHTML.bind(adapt);
|
|
12128
12227
|
this.getImage = adapt.getImage.bind(adapt);
|
|
12129
12228
|
this.getValue = adapt.getValue.bind(adapt);
|
|
12130
12229
|
this.getHTML = adapt.getHTML.bind(adapt);
|
|
@@ -13861,6 +13960,18 @@ class CommandAdapt {
|
|
|
13861
13960
|
});
|
|
13862
13961
|
}
|
|
13863
13962
|
}
|
|
13963
|
+
setHTML(payload) {
|
|
13964
|
+
const { header, main, footer } = payload;
|
|
13965
|
+
const innerWidth = this.draw.getOriginalInnerWidth();
|
|
13966
|
+
const getElementList = (htmlText) => htmlText !== void 0 ? getElementListByHTML(htmlText, {
|
|
13967
|
+
innerWidth
|
|
13968
|
+
}) : void 0;
|
|
13969
|
+
this.setValue({
|
|
13970
|
+
header: getElementList(header),
|
|
13971
|
+
main: getElementList(main),
|
|
13972
|
+
footer: getElementList(footer)
|
|
13973
|
+
});
|
|
13974
|
+
}
|
|
13864
13975
|
}
|
|
13865
13976
|
class Listener {
|
|
13866
13977
|
constructor() {
|
|
@@ -14784,7 +14895,8 @@ class Editor {
|
|
|
14784
14895
|
inactiveAlpha: 0.6,
|
|
14785
14896
|
historyMaxRecordCount: 100,
|
|
14786
14897
|
wordBreak: WordBreak.BREAK_WORD,
|
|
14787
|
-
printPixelRatio: 3
|
|
14898
|
+
printPixelRatio: 3,
|
|
14899
|
+
maskMargin: [0, 0, 0, 0]
|
|
14788
14900
|
}, options), {
|
|
14789
14901
|
header: headerOptions,
|
|
14790
14902
|
footer: footerOptions,
|