@hufe921/canvas-editor 0.9.78 → 0.9.79
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 +26 -0
- package/dist/canvas-editor.es.js +429 -81
- package/dist/canvas-editor.es.js.map +1 -1
- package/dist/canvas-editor.umd.js +36 -36
- package/dist/canvas-editor.umd.js.map +1 -1
- package/dist/src/editor/core/draw/control/Control.d.ts +4 -1
- package/dist/src/editor/dataset/constant/Element.d.ts +1 -1
- package/dist/src/editor/interface/Control.d.ts +9 -0
- package/dist/src/editor/interface/Draw.d.ts +1 -0
- package/dist/src/editor/interface/Element.d.ts +1 -0
- package/dist/src/editor/utils/element.d.ts +9 -2
- 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.79";
|
|
27
27
|
var MaxHeightRatio;
|
|
28
28
|
(function(MaxHeightRatio2) {
|
|
29
29
|
MaxHeightRatio2["HALF"] = "half";
|
|
@@ -177,19 +177,27 @@ function getUUID() {
|
|
|
177
177
|
}
|
|
178
178
|
function splitText(text) {
|
|
179
179
|
const data2 = [];
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
|
|
180
|
+
if (Intl.Segmenter) {
|
|
181
|
+
const segmenter = new Intl.Segmenter();
|
|
182
|
+
const segments = segmenter.segment(text);
|
|
183
|
+
for (const { segment } of segments) {
|
|
184
|
+
data2.push(segment);
|
|
185
|
+
}
|
|
186
|
+
} else {
|
|
187
|
+
const symbolMap = new Map();
|
|
188
|
+
for (const match of text.matchAll(UNICODE_SYMBOL_REG)) {
|
|
189
|
+
symbolMap.set(match.index, match[0]);
|
|
190
|
+
}
|
|
191
|
+
let t = 0;
|
|
192
|
+
while (t < text.length) {
|
|
193
|
+
const symbol = symbolMap.get(t);
|
|
194
|
+
if (symbol) {
|
|
195
|
+
data2.push(symbol);
|
|
196
|
+
t += symbol.length;
|
|
197
|
+
} else {
|
|
198
|
+
data2.push(text[t]);
|
|
199
|
+
t++;
|
|
200
|
+
}
|
|
193
201
|
}
|
|
194
202
|
}
|
|
195
203
|
return data2;
|
|
@@ -421,7 +429,6 @@ const EDITOR_ELEMENT_COPY_ATTR = [
|
|
|
421
429
|
"dateId",
|
|
422
430
|
"dateFormat",
|
|
423
431
|
"groupIds",
|
|
424
|
-
"rowFlex",
|
|
425
432
|
"rowMargin",
|
|
426
433
|
"textDecoration"
|
|
427
434
|
];
|
|
@@ -460,7 +467,8 @@ const EDITOR_ELEMENT_ZIP_ATTR = [
|
|
|
460
467
|
"imgDisplay",
|
|
461
468
|
"imgFloatPosition",
|
|
462
469
|
"textDecoration",
|
|
463
|
-
"extension"
|
|
470
|
+
"extension",
|
|
471
|
+
"externalId"
|
|
464
472
|
];
|
|
465
473
|
const TABLE_TD_ZIP_ATTR = [
|
|
466
474
|
"verticalAlign",
|
|
@@ -499,7 +507,8 @@ const CONTROL_STYLE_ATTR = [
|
|
|
499
507
|
const EDITOR_ELEMENT_CONTEXT_ATTR = [
|
|
500
508
|
...TABLE_CONTEXT_ATTR,
|
|
501
509
|
...TITLE_CONTEXT_ATTR,
|
|
502
|
-
...LIST_CONTEXT_ATTR
|
|
510
|
+
...LIST_CONTEXT_ATTR,
|
|
511
|
+
...EDITOR_ROW_ATTR
|
|
503
512
|
];
|
|
504
513
|
const TEXTLIKE_ELEMENT_TYPE = [
|
|
505
514
|
ElementType.TEXT,
|
|
@@ -513,7 +522,7 @@ const IMAGE_ELEMENT_TYPE = [
|
|
|
513
522
|
ElementType.IMAGE,
|
|
514
523
|
ElementType.LATEX
|
|
515
524
|
];
|
|
516
|
-
const
|
|
525
|
+
const BLOCK_ELEMENT_TYPE = [
|
|
517
526
|
ElementType.BLOCK,
|
|
518
527
|
ElementType.PAGE_BREAK,
|
|
519
528
|
ElementType.SEPARATOR,
|
|
@@ -4235,11 +4244,11 @@ function zipElementList(payload) {
|
|
|
4235
4244
|
if (controlId) {
|
|
4236
4245
|
const controlDefaultStyle = pickObject(element, CONTROL_STYLE_ATTR);
|
|
4237
4246
|
const control = __spreadValues(__spreadValues({}, element.control), controlDefaultStyle);
|
|
4238
|
-
const controlElement = {
|
|
4247
|
+
const controlElement = __spreadProps(__spreadValues({}, pickObject(element, EDITOR_ROW_ATTR)), {
|
|
4239
4248
|
type: ElementType.CONTROL,
|
|
4240
4249
|
value: "",
|
|
4241
4250
|
control
|
|
4242
|
-
};
|
|
4251
|
+
});
|
|
4243
4252
|
const valueList = [];
|
|
4244
4253
|
while (e < elementList.length) {
|
|
4245
4254
|
const controlE = elementList[e];
|
|
@@ -4277,7 +4286,7 @@ function zipElementList(payload) {
|
|
|
4277
4286
|
}
|
|
4278
4287
|
return zipElementListData;
|
|
4279
4288
|
}
|
|
4280
|
-
function
|
|
4289
|
+
function convertTextAlignToRowFlex(node) {
|
|
4281
4290
|
const textAlign = window.getComputedStyle(node).textAlign;
|
|
4282
4291
|
switch (textAlign) {
|
|
4283
4292
|
case "left":
|
|
@@ -4296,6 +4305,24 @@ function getElementRowFlex(node) {
|
|
|
4296
4305
|
return RowFlex.LEFT;
|
|
4297
4306
|
}
|
|
4298
4307
|
}
|
|
4308
|
+
function convertRowFlexToTextAlign(rowFlex) {
|
|
4309
|
+
return rowFlex === RowFlex.ALIGNMENT ? "justify" : rowFlex;
|
|
4310
|
+
}
|
|
4311
|
+
function convertRowFlexToJustifyContent(rowFlex) {
|
|
4312
|
+
switch (rowFlex) {
|
|
4313
|
+
case RowFlex.LEFT:
|
|
4314
|
+
return "flex-start";
|
|
4315
|
+
case RowFlex.CENTER:
|
|
4316
|
+
return "center";
|
|
4317
|
+
case RowFlex.RIGHT:
|
|
4318
|
+
return "flex-end";
|
|
4319
|
+
case RowFlex.ALIGNMENT:
|
|
4320
|
+
case RowFlex.JUSTIFY:
|
|
4321
|
+
return "space-between";
|
|
4322
|
+
default:
|
|
4323
|
+
return "flex-start";
|
|
4324
|
+
}
|
|
4325
|
+
}
|
|
4299
4326
|
function isTextLikeElement(element) {
|
|
4300
4327
|
return !element.type || TEXTLIKE_ELEMENT_TYPE.includes(element.type);
|
|
4301
4328
|
}
|
|
@@ -4319,9 +4346,10 @@ function formatElementContext(sourceElementList, formatElementList2, anchorIndex
|
|
|
4319
4346
|
isBreakWarped = true;
|
|
4320
4347
|
}
|
|
4321
4348
|
if (isBreakWarped || !copyElement.listId && targetElement.type === ElementType.LIST) {
|
|
4322
|
-
|
|
4349
|
+
const cloneAttr = [...TABLE_CONTEXT_ATTR, ...EDITOR_ROW_ATTR];
|
|
4350
|
+
cloneProperty(cloneAttr, copyElement, targetElement);
|
|
4323
4351
|
(_a = targetElement.valueList) == null ? void 0 : _a.forEach((valueItem) => {
|
|
4324
|
-
cloneProperty(
|
|
4352
|
+
cloneProperty(cloneAttr, copyElement, valueItem);
|
|
4325
4353
|
});
|
|
4326
4354
|
continue;
|
|
4327
4355
|
}
|
|
@@ -4337,14 +4365,11 @@ function convertElementToDom(element, options) {
|
|
|
4337
4365
|
tagName = "sup";
|
|
4338
4366
|
} else if (element.type === ElementType.SUBSCRIPT) {
|
|
4339
4367
|
tagName = "sub";
|
|
4340
|
-
} else if (element.rowFlex === RowFlex.CENTER || element.rowFlex === RowFlex.RIGHT) {
|
|
4341
|
-
tagName = "p";
|
|
4342
4368
|
}
|
|
4343
4369
|
const dom = document.createElement(tagName);
|
|
4344
4370
|
dom.style.fontFamily = element.font || options.defaultFont;
|
|
4345
4371
|
if (element.rowFlex) {
|
|
4346
|
-
|
|
4347
|
-
dom.style.textAlign = isAlignment ? "justify" : element.rowFlex;
|
|
4372
|
+
dom.style.textAlign = convertRowFlexToTextAlign(element.rowFlex);
|
|
4348
4373
|
}
|
|
4349
4374
|
if (element.color) {
|
|
4350
4375
|
dom.style.color = element.color;
|
|
@@ -4399,10 +4424,40 @@ function splitListElement(elementList) {
|
|
|
4399
4424
|
}
|
|
4400
4425
|
return listElementListMap;
|
|
4401
4426
|
}
|
|
4427
|
+
function groupElementListByRowFlex(elementList) {
|
|
4428
|
+
var _a;
|
|
4429
|
+
const elementListGroupList = [];
|
|
4430
|
+
if (!elementList.length)
|
|
4431
|
+
return elementListGroupList;
|
|
4432
|
+
let currentRowFlex = ((_a = elementList[0]) == null ? void 0 : _a.rowFlex) || null;
|
|
4433
|
+
elementListGroupList.push({
|
|
4434
|
+
rowFlex: currentRowFlex,
|
|
4435
|
+
data: [elementList[0]]
|
|
4436
|
+
});
|
|
4437
|
+
for (let e = 1; e < elementList.length; e++) {
|
|
4438
|
+
const element = elementList[e];
|
|
4439
|
+
const rowFlex = element.rowFlex || null;
|
|
4440
|
+
if (currentRowFlex === rowFlex && !getIsBlockElement(element) && !getIsBlockElement(elementList[e - 1])) {
|
|
4441
|
+
const lastElementListGroup = elementListGroupList[elementListGroupList.length - 1];
|
|
4442
|
+
lastElementListGroup.data.push(element);
|
|
4443
|
+
} else {
|
|
4444
|
+
elementListGroupList.push({
|
|
4445
|
+
rowFlex,
|
|
4446
|
+
data: [element]
|
|
4447
|
+
});
|
|
4448
|
+
currentRowFlex = rowFlex;
|
|
4449
|
+
}
|
|
4450
|
+
}
|
|
4451
|
+
for (let g = 0; g < elementListGroupList.length; g++) {
|
|
4452
|
+
const elementListGroup = elementListGroupList[g];
|
|
4453
|
+
elementListGroup.data = zipElementList(elementListGroup.data);
|
|
4454
|
+
}
|
|
4455
|
+
return elementListGroupList;
|
|
4456
|
+
}
|
|
4402
4457
|
function createDomFromElementList(elementList, options) {
|
|
4403
4458
|
function buildDom(payload) {
|
|
4404
4459
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
4405
|
-
const
|
|
4460
|
+
const clipboardDom2 = document.createElement("div");
|
|
4406
4461
|
for (let e = 0; e < payload.length; e++) {
|
|
4407
4462
|
const element = payload[e];
|
|
4408
4463
|
if (element.type === ElementType.TABLE) {
|
|
@@ -4452,7 +4507,7 @@ function createDomFromElementList(elementList, options) {
|
|
|
4452
4507
|
if ((_d = td.borderTypes) == null ? void 0 : _d.includes(TdBorder.LEFT)) {
|
|
4453
4508
|
tdDom.style.borderLeft = borderStyle;
|
|
4454
4509
|
}
|
|
4455
|
-
const childDom =
|
|
4510
|
+
const childDom = createDomFromElementList(td.value, options);
|
|
4456
4511
|
tdDom.innerHTML = childDom.innerHTML;
|
|
4457
4512
|
if (td.backgroundColor) {
|
|
4458
4513
|
tdDom.style.backgroundColor = td.backgroundColor;
|
|
@@ -4461,19 +4516,19 @@ function createDomFromElementList(elementList, options) {
|
|
|
4461
4516
|
}
|
|
4462
4517
|
tableDom.append(trDom);
|
|
4463
4518
|
}
|
|
4464
|
-
|
|
4519
|
+
clipboardDom2.append(tableDom);
|
|
4465
4520
|
} else if (element.type === ElementType.HYPERLINK) {
|
|
4466
4521
|
const a = document.createElement("a");
|
|
4467
4522
|
a.innerText = element.valueList.map((v) => v.value).join("");
|
|
4468
4523
|
if (element.url) {
|
|
4469
4524
|
a.href = element.url;
|
|
4470
4525
|
}
|
|
4471
|
-
|
|
4526
|
+
clipboardDom2.append(a);
|
|
4472
4527
|
} else if (element.type === ElementType.TITLE) {
|
|
4473
4528
|
const h = document.createElement(`h${titleOrderNumberMapping[element.level]}`);
|
|
4474
|
-
const childDom = buildDom(
|
|
4529
|
+
const childDom = buildDom(element.valueList);
|
|
4475
4530
|
h.innerHTML = childDom.innerHTML;
|
|
4476
|
-
|
|
4531
|
+
clipboardDom2.append(h);
|
|
4477
4532
|
} else if (element.type === ElementType.LIST) {
|
|
4478
4533
|
const list = document.createElement(listTypeElementMapping[element.listType]);
|
|
4479
4534
|
if (element.listStyle) {
|
|
@@ -4487,7 +4542,7 @@ function createDomFromElementList(elementList, options) {
|
|
|
4487
4542
|
li.innerHTML = childDom.innerHTML;
|
|
4488
4543
|
list.append(li);
|
|
4489
4544
|
});
|
|
4490
|
-
|
|
4545
|
+
clipboardDom2.append(list);
|
|
4491
4546
|
} else if (element.type === ElementType.IMAGE) {
|
|
4492
4547
|
const img = document.createElement("img");
|
|
4493
4548
|
if (element.value) {
|
|
@@ -4495,33 +4550,33 @@ function createDomFromElementList(elementList, options) {
|
|
|
4495
4550
|
img.width = element.width;
|
|
4496
4551
|
img.height = element.height;
|
|
4497
4552
|
}
|
|
4498
|
-
|
|
4553
|
+
clipboardDom2.append(img);
|
|
4499
4554
|
} else if (element.type === ElementType.SEPARATOR) {
|
|
4500
4555
|
const hr = document.createElement("hr");
|
|
4501
|
-
|
|
4556
|
+
clipboardDom2.append(hr);
|
|
4502
4557
|
} else if (element.type === ElementType.CHECKBOX) {
|
|
4503
4558
|
const checkbox = document.createElement("input");
|
|
4504
4559
|
checkbox.type = "checkbox";
|
|
4505
4560
|
if ((_e = element.checkbox) == null ? void 0 : _e.value) {
|
|
4506
4561
|
checkbox.setAttribute("checked", "true");
|
|
4507
4562
|
}
|
|
4508
|
-
|
|
4563
|
+
clipboardDom2.append(checkbox);
|
|
4509
4564
|
} else if (element.type === ElementType.RADIO) {
|
|
4510
4565
|
const radio = document.createElement("input");
|
|
4511
4566
|
radio.type = "radio";
|
|
4512
4567
|
if ((_f = element.radio) == null ? void 0 : _f.value) {
|
|
4513
4568
|
radio.setAttribute("checked", "true");
|
|
4514
4569
|
}
|
|
4515
|
-
|
|
4570
|
+
clipboardDom2.append(radio);
|
|
4516
4571
|
} else if (element.type === ElementType.TAB) {
|
|
4517
4572
|
const tab2 = document.createElement("span");
|
|
4518
4573
|
tab2.innerHTML = `${NON_BREAKING_SPACE}${NON_BREAKING_SPACE}`;
|
|
4519
|
-
|
|
4574
|
+
clipboardDom2.append(tab2);
|
|
4520
4575
|
} else if (element.type === ElementType.CONTROL) {
|
|
4521
4576
|
const controlElement = document.createElement("span");
|
|
4522
|
-
const childDom = buildDom(
|
|
4577
|
+
const childDom = buildDom(((_g = element.control) == null ? void 0 : _g.value) || []);
|
|
4523
4578
|
controlElement.innerHTML = childDom.innerHTML;
|
|
4524
|
-
|
|
4579
|
+
clipboardDom2.append(controlElement);
|
|
4525
4580
|
} else if (!element.type || element.type === ElementType.LATEX || TEXTLIKE_ELEMENT_TYPE.includes(element.type)) {
|
|
4526
4581
|
let text = "";
|
|
4527
4582
|
if (element.type === ElementType.DATE) {
|
|
@@ -4535,23 +4590,44 @@ function createDomFromElementList(elementList, options) {
|
|
|
4535
4590
|
if (((_i = payload[e - 1]) == null ? void 0 : _i.type) === ElementType.TITLE) {
|
|
4536
4591
|
text = text.replace(/^\n/, "");
|
|
4537
4592
|
}
|
|
4538
|
-
if (dom.tagName === "P") {
|
|
4539
|
-
text = text.replace(/\n$/, "");
|
|
4540
|
-
}
|
|
4541
4593
|
dom.innerText = text.replace(new RegExp(`${ZERO}`, "g"), "\n");
|
|
4542
|
-
|
|
4594
|
+
clipboardDom2.append(dom);
|
|
4543
4595
|
}
|
|
4544
4596
|
}
|
|
4545
|
-
return
|
|
4597
|
+
return clipboardDom2;
|
|
4546
4598
|
}
|
|
4547
|
-
|
|
4599
|
+
const clipboardDom = document.createElement("div");
|
|
4600
|
+
const groupElementList = groupElementListByRowFlex(elementList);
|
|
4601
|
+
for (let g = 0; g < groupElementList.length; g++) {
|
|
4602
|
+
const elementGroupRowFlex = groupElementList[g];
|
|
4603
|
+
const isDefaultRowFlex = !elementGroupRowFlex.rowFlex || elementGroupRowFlex.rowFlex === RowFlex.LEFT;
|
|
4604
|
+
const rowFlexDom = document.createElement("div");
|
|
4605
|
+
if (!isDefaultRowFlex) {
|
|
4606
|
+
const firstElement = elementGroupRowFlex.data[0];
|
|
4607
|
+
if (getIsBlockElement(firstElement)) {
|
|
4608
|
+
rowFlexDom.style.display = "flex";
|
|
4609
|
+
rowFlexDom.style.justifyContent = convertRowFlexToJustifyContent(firstElement.rowFlex);
|
|
4610
|
+
} else {
|
|
4611
|
+
rowFlexDom.style.textAlign = convertRowFlexToTextAlign(elementGroupRowFlex.rowFlex);
|
|
4612
|
+
}
|
|
4613
|
+
}
|
|
4614
|
+
rowFlexDom.innerHTML = buildDom(elementGroupRowFlex.data).innerHTML;
|
|
4615
|
+
if (!isDefaultRowFlex) {
|
|
4616
|
+
clipboardDom.append(rowFlexDom);
|
|
4617
|
+
} else {
|
|
4618
|
+
rowFlexDom.childNodes.forEach((child) => {
|
|
4619
|
+
clipboardDom.append(child.cloneNode(true));
|
|
4620
|
+
});
|
|
4621
|
+
}
|
|
4622
|
+
}
|
|
4623
|
+
return clipboardDom;
|
|
4548
4624
|
}
|
|
4549
4625
|
function convertTextNodeToElement(textNode) {
|
|
4550
4626
|
if (!textNode || textNode.nodeType !== 3)
|
|
4551
4627
|
return null;
|
|
4552
4628
|
const parentNode = textNode.parentNode;
|
|
4553
4629
|
const anchorNode = parentNode.nodeName === "FONT" ? parentNode.parentNode : parentNode;
|
|
4554
|
-
const rowFlex =
|
|
4630
|
+
const rowFlex = convertTextAlignToRowFlex(anchorNode);
|
|
4555
4631
|
const value = textNode.textContent;
|
|
4556
4632
|
const style = window.getComputedStyle(anchorNode);
|
|
4557
4633
|
if (!value || anchorNode.nodeName === "STYLE")
|
|
@@ -4820,8 +4896,8 @@ function getSlimCloneElementList(elementList) {
|
|
|
4820
4896
|
"style"
|
|
4821
4897
|
]);
|
|
4822
4898
|
}
|
|
4823
|
-
function
|
|
4824
|
-
return !!(element == null ? void 0 : element.type) && (
|
|
4899
|
+
function getIsBlockElement(element) {
|
|
4900
|
+
return !!(element == null ? void 0 : element.type) && (BLOCK_ELEMENT_TYPE.includes(element.type) || element.imgDisplay === ImageDisplay.INLINE);
|
|
4825
4901
|
}
|
|
4826
4902
|
function setClipboardData(data2) {
|
|
4827
4903
|
localStorage.setItem(EDITOR_CLIPBOARD, JSON.stringify({
|
|
@@ -5204,8 +5280,10 @@ class Cursor {
|
|
|
5204
5280
|
const cursorLeft = hitLineStartIndex ? leftTop[0] : rightTop[0];
|
|
5205
5281
|
agentCursorDom.style.left = `${cursorLeft}px`;
|
|
5206
5282
|
agentCursorDom.style.top = `${cursorTop + cursorHeight - defaultOffsetHeight}px`;
|
|
5207
|
-
if (!isShow)
|
|
5283
|
+
if (!isShow) {
|
|
5284
|
+
this.recoveryCursor();
|
|
5208
5285
|
return;
|
|
5286
|
+
}
|
|
5209
5287
|
const isReadonly = this.draw.isReadonly();
|
|
5210
5288
|
this.cursorDom.style.width = `${width * scale}px`;
|
|
5211
5289
|
this.cursorDom.style.backgroundColor = color;
|
|
@@ -6083,7 +6161,7 @@ function enter(evt, host) {
|
|
|
6083
6161
|
evt.preventDefault();
|
|
6084
6162
|
}
|
|
6085
6163
|
function left(evt, host) {
|
|
6086
|
-
var _a;
|
|
6164
|
+
var _a, _b;
|
|
6087
6165
|
const draw = host.getDraw();
|
|
6088
6166
|
const isReadonly = draw.isReadonly();
|
|
6089
6167
|
if (isReadonly)
|
|
@@ -6100,11 +6178,18 @@ function left(evt, host) {
|
|
|
6100
6178
|
const { startIndex, endIndex } = rangeManager.getRange();
|
|
6101
6179
|
const isCollapsed = rangeManager.getIsCollapsed();
|
|
6102
6180
|
const elementList = draw.getElementList();
|
|
6181
|
+
const control = draw.getControl();
|
|
6182
|
+
if (draw.getMode() === EditorMode.FORM && control.getActiveControl() && ((_a = elementList[index2]) == null ? void 0 : _a.controlComponent) === ControlComponent.PREFIX) {
|
|
6183
|
+
control.initNextControl({
|
|
6184
|
+
direction: MoveDirection.UP
|
|
6185
|
+
});
|
|
6186
|
+
return;
|
|
6187
|
+
}
|
|
6103
6188
|
let moveCount = 1;
|
|
6104
6189
|
if (isMod(evt)) {
|
|
6105
6190
|
const LETTER_REG = draw.getLetterReg();
|
|
6106
6191
|
const moveStartIndex = evt.shiftKey && !isCollapsed && startIndex === (cursorPosition == null ? void 0 : cursorPosition.index) ? endIndex : startIndex;
|
|
6107
|
-
if (LETTER_REG.test((
|
|
6192
|
+
if (LETTER_REG.test((_b = elementList[moveStartIndex]) == null ? void 0 : _b.value)) {
|
|
6108
6193
|
let i = moveStartIndex - 1;
|
|
6109
6194
|
while (i > 0) {
|
|
6110
6195
|
const element = elementList[i];
|
|
@@ -6214,7 +6299,7 @@ function left(evt, host) {
|
|
|
6214
6299
|
evt.preventDefault();
|
|
6215
6300
|
}
|
|
6216
6301
|
function right(evt, host) {
|
|
6217
|
-
var _a;
|
|
6302
|
+
var _a, _b;
|
|
6218
6303
|
const draw = host.getDraw();
|
|
6219
6304
|
const isReadonly = draw.isReadonly();
|
|
6220
6305
|
if (isReadonly)
|
|
@@ -6232,11 +6317,18 @@ function right(evt, host) {
|
|
|
6232
6317
|
const { startIndex, endIndex } = rangeManager.getRange();
|
|
6233
6318
|
const isCollapsed = rangeManager.getIsCollapsed();
|
|
6234
6319
|
let elementList = draw.getElementList();
|
|
6320
|
+
const control = draw.getControl();
|
|
6321
|
+
if (draw.getMode() === EditorMode.FORM && control.getActiveControl() && ((_a = elementList[index2 + 1]) == null ? void 0 : _a.controlComponent) === ControlComponent.POSTFIX) {
|
|
6322
|
+
control.initNextControl({
|
|
6323
|
+
direction: MoveDirection.DOWN
|
|
6324
|
+
});
|
|
6325
|
+
return;
|
|
6326
|
+
}
|
|
6235
6327
|
let moveCount = 1;
|
|
6236
6328
|
if (isMod(evt)) {
|
|
6237
6329
|
const LETTER_REG = draw.getLetterReg();
|
|
6238
6330
|
const moveStartIndex = evt.shiftKey && !isCollapsed && startIndex === (cursorPosition == null ? void 0 : cursorPosition.index) ? endIndex : startIndex;
|
|
6239
|
-
if (LETTER_REG.test((
|
|
6331
|
+
if (LETTER_REG.test((_b = elementList[moveStartIndex + 1]) == null ? void 0 : _b.value)) {
|
|
6240
6332
|
let i = moveStartIndex + 2;
|
|
6241
6333
|
while (i < elementList.length) {
|
|
6242
6334
|
const element = elementList[i];
|
|
@@ -6352,16 +6444,24 @@ function tab(evt, host) {
|
|
|
6352
6444
|
const isReadonly = draw.isReadonly();
|
|
6353
6445
|
if (isReadonly)
|
|
6354
6446
|
return;
|
|
6355
|
-
const tabElement = {
|
|
6356
|
-
type: ElementType.TAB,
|
|
6357
|
-
value: ""
|
|
6358
|
-
};
|
|
6359
|
-
const rangeManager = draw.getRange();
|
|
6360
|
-
const { startIndex } = rangeManager.getRange();
|
|
6361
|
-
const elementList = draw.getElementList();
|
|
6362
|
-
formatElementContext(elementList, [tabElement], startIndex);
|
|
6363
|
-
draw.insertElementList([tabElement]);
|
|
6364
6447
|
evt.preventDefault();
|
|
6448
|
+
const control = draw.getControl();
|
|
6449
|
+
const activeControl = control.getActiveControl();
|
|
6450
|
+
if (activeControl) {
|
|
6451
|
+
control.initNextControl({
|
|
6452
|
+
direction: evt.shiftKey ? MoveDirection.UP : MoveDirection.DOWN
|
|
6453
|
+
});
|
|
6454
|
+
} else {
|
|
6455
|
+
const tabElement = {
|
|
6456
|
+
type: ElementType.TAB,
|
|
6457
|
+
value: ""
|
|
6458
|
+
};
|
|
6459
|
+
const rangeManager = draw.getRange();
|
|
6460
|
+
const { startIndex } = rangeManager.getRange();
|
|
6461
|
+
const elementList = draw.getElementList();
|
|
6462
|
+
formatElementContext(elementList, [tabElement], startIndex);
|
|
6463
|
+
draw.insertElementList([tabElement]);
|
|
6464
|
+
}
|
|
6365
6465
|
}
|
|
6366
6466
|
function getNextPositionIndex(payload) {
|
|
6367
6467
|
const { positionList, index: index2, isUp, rowNo, cursorX } = payload;
|
|
@@ -10837,9 +10937,11 @@ class Control {
|
|
|
10837
10937
|
return positionList[endIndex] || null;
|
|
10838
10938
|
}
|
|
10839
10939
|
getPreY() {
|
|
10940
|
+
var _a, _b;
|
|
10840
10941
|
const height = this.draw.getHeight();
|
|
10841
10942
|
const pageGap = this.draw.getPageGap();
|
|
10842
|
-
|
|
10943
|
+
const pageNo = (_b = (_a = this.getPosition()) == null ? void 0 : _a.pageNo) != null ? _b : this.draw.getPageNo();
|
|
10944
|
+
return pageNo * (height + pageGap);
|
|
10843
10945
|
}
|
|
10844
10946
|
getRange() {
|
|
10845
10947
|
return this.range.getRange();
|
|
@@ -11228,6 +11330,7 @@ class Control {
|
|
|
11228
11330
|
editorOptions: this.options
|
|
11229
11331
|
});
|
|
11230
11332
|
const text = new TextControl(element, this);
|
|
11333
|
+
this.activeControl = text;
|
|
11231
11334
|
if (value) {
|
|
11232
11335
|
text.setValue(formatValue, controlContext, controlRule);
|
|
11233
11336
|
} else {
|
|
@@ -11235,6 +11338,7 @@ class Control {
|
|
|
11235
11338
|
}
|
|
11236
11339
|
} else if (type === ControlType.SELECT) {
|
|
11237
11340
|
const select = new SelectControl(element, this);
|
|
11341
|
+
this.activeControl = select;
|
|
11238
11342
|
if (value) {
|
|
11239
11343
|
select.setSelect(value, controlContext, controlRule);
|
|
11240
11344
|
} else {
|
|
@@ -11242,13 +11346,16 @@ class Control {
|
|
|
11242
11346
|
}
|
|
11243
11347
|
} else if (type === ControlType.CHECKBOX) {
|
|
11244
11348
|
const checkbox = new CheckboxControl(element, this);
|
|
11349
|
+
this.activeControl = checkbox;
|
|
11245
11350
|
const codes = (value == null ? void 0 : value.split(",")) || [];
|
|
11246
11351
|
checkbox.setSelect(codes, controlContext, controlRule);
|
|
11247
11352
|
} else if (type === ControlType.RADIO) {
|
|
11248
11353
|
const radio = new RadioControl(element, this);
|
|
11354
|
+
this.activeControl = radio;
|
|
11249
11355
|
const codes = value ? [value] : [];
|
|
11250
11356
|
radio.setSelect(codes, controlContext, controlRule);
|
|
11251
11357
|
}
|
|
11358
|
+
this.activeControl = null;
|
|
11252
11359
|
let newEndIndex = i;
|
|
11253
11360
|
while (newEndIndex < elementList.length) {
|
|
11254
11361
|
const nextElement = elementList[newEndIndex];
|
|
@@ -11259,6 +11366,7 @@ class Control {
|
|
|
11259
11366
|
i = newEndIndex;
|
|
11260
11367
|
}
|
|
11261
11368
|
};
|
|
11369
|
+
this.destroyControl();
|
|
11262
11370
|
const data2 = [
|
|
11263
11371
|
this.draw.getHeaderElementList(),
|
|
11264
11372
|
this.draw.getOriginalMainElementList(),
|
|
@@ -11388,6 +11496,237 @@ class Control {
|
|
|
11388
11496
|
drawBorder(ctx) {
|
|
11389
11497
|
this.controlBorder.render(ctx);
|
|
11390
11498
|
}
|
|
11499
|
+
getPreControlContext() {
|
|
11500
|
+
if (!this.activeControl)
|
|
11501
|
+
return null;
|
|
11502
|
+
const position = this.draw.getPosition();
|
|
11503
|
+
const positionContext = position.getPositionContext();
|
|
11504
|
+
if (!positionContext)
|
|
11505
|
+
return null;
|
|
11506
|
+
const controlElement = this.activeControl.getElement();
|
|
11507
|
+
function getPreContext(elementList2, start) {
|
|
11508
|
+
for (let e = start; e > 0; e--) {
|
|
11509
|
+
const element = elementList2[e];
|
|
11510
|
+
if (element.type === ElementType.TABLE) {
|
|
11511
|
+
const trList = element.trList || [];
|
|
11512
|
+
for (let r = trList.length - 1; r >= 0; r--) {
|
|
11513
|
+
const tr = trList[r];
|
|
11514
|
+
const tdList = tr.tdList;
|
|
11515
|
+
for (let d = tdList.length - 1; d >= 0; d--) {
|
|
11516
|
+
const td = tdList[d];
|
|
11517
|
+
const context2 = getPreContext(td.value, td.value.length - 1);
|
|
11518
|
+
if (context2) {
|
|
11519
|
+
return {
|
|
11520
|
+
positionContext: {
|
|
11521
|
+
isTable: true,
|
|
11522
|
+
index: e,
|
|
11523
|
+
trIndex: r,
|
|
11524
|
+
tdIndex: d,
|
|
11525
|
+
tdId: td.id,
|
|
11526
|
+
trId: tr.id,
|
|
11527
|
+
tableId: element.id
|
|
11528
|
+
},
|
|
11529
|
+
nextIndex: context2.nextIndex
|
|
11530
|
+
};
|
|
11531
|
+
}
|
|
11532
|
+
}
|
|
11533
|
+
}
|
|
11534
|
+
}
|
|
11535
|
+
if (!element.controlId || element.controlId === controlElement.controlId) {
|
|
11536
|
+
continue;
|
|
11537
|
+
}
|
|
11538
|
+
let nextIndex = e;
|
|
11539
|
+
while (nextIndex > 0) {
|
|
11540
|
+
const nextElement = elementList2[nextIndex];
|
|
11541
|
+
if (nextElement.controlComponent === ControlComponent.VALUE || nextElement.controlComponent === ControlComponent.PREFIX) {
|
|
11542
|
+
break;
|
|
11543
|
+
}
|
|
11544
|
+
nextIndex--;
|
|
11545
|
+
}
|
|
11546
|
+
return {
|
|
11547
|
+
positionContext: {
|
|
11548
|
+
isTable: false
|
|
11549
|
+
},
|
|
11550
|
+
nextIndex
|
|
11551
|
+
};
|
|
11552
|
+
}
|
|
11553
|
+
return null;
|
|
11554
|
+
}
|
|
11555
|
+
const { startIndex } = this.range.getRange();
|
|
11556
|
+
const elementList = this.getElementList();
|
|
11557
|
+
const context = getPreContext(elementList, startIndex);
|
|
11558
|
+
if (context) {
|
|
11559
|
+
return {
|
|
11560
|
+
positionContext: positionContext.isTable ? positionContext : context.positionContext,
|
|
11561
|
+
nextIndex: context.nextIndex
|
|
11562
|
+
};
|
|
11563
|
+
}
|
|
11564
|
+
if (controlElement.tableId) {
|
|
11565
|
+
const originalElementList = this.draw.getOriginalElementList();
|
|
11566
|
+
const { index: index2, trIndex, tdIndex } = positionContext;
|
|
11567
|
+
const trList = originalElementList[index2].trList;
|
|
11568
|
+
for (let r = trIndex; r >= 0; r--) {
|
|
11569
|
+
const tr = trList[r];
|
|
11570
|
+
const tdList = tr.tdList;
|
|
11571
|
+
for (let d = tdList.length - 1; d >= 0; d--) {
|
|
11572
|
+
if (trIndex === r && d >= tdIndex)
|
|
11573
|
+
continue;
|
|
11574
|
+
const td = tdList[d];
|
|
11575
|
+
const context3 = getPreContext(td.value, td.value.length - 1);
|
|
11576
|
+
if (context3) {
|
|
11577
|
+
return {
|
|
11578
|
+
positionContext: {
|
|
11579
|
+
isTable: true,
|
|
11580
|
+
index: positionContext.index,
|
|
11581
|
+
trIndex: r,
|
|
11582
|
+
tdIndex: d,
|
|
11583
|
+
tdId: td.id,
|
|
11584
|
+
trId: tr.id,
|
|
11585
|
+
tableId: controlElement.tableId
|
|
11586
|
+
},
|
|
11587
|
+
nextIndex: context3.nextIndex
|
|
11588
|
+
};
|
|
11589
|
+
}
|
|
11590
|
+
}
|
|
11591
|
+
}
|
|
11592
|
+
const context2 = getPreContext(originalElementList, index2 - 1);
|
|
11593
|
+
if (context2) {
|
|
11594
|
+
return {
|
|
11595
|
+
positionContext: {
|
|
11596
|
+
isTable: false
|
|
11597
|
+
},
|
|
11598
|
+
nextIndex: context2.nextIndex
|
|
11599
|
+
};
|
|
11600
|
+
}
|
|
11601
|
+
}
|
|
11602
|
+
return null;
|
|
11603
|
+
}
|
|
11604
|
+
getNextControlContext() {
|
|
11605
|
+
if (!this.activeControl)
|
|
11606
|
+
return null;
|
|
11607
|
+
const position = this.draw.getPosition();
|
|
11608
|
+
const positionContext = position.getPositionContext();
|
|
11609
|
+
if (!positionContext)
|
|
11610
|
+
return null;
|
|
11611
|
+
const controlElement = this.activeControl.getElement();
|
|
11612
|
+
function getNextContext(elementList2, start) {
|
|
11613
|
+
for (let e = start; e < elementList2.length; e++) {
|
|
11614
|
+
const element = elementList2[e];
|
|
11615
|
+
if (element.type === ElementType.TABLE) {
|
|
11616
|
+
const trList = element.trList || [];
|
|
11617
|
+
for (let r = 0; r < trList.length; r++) {
|
|
11618
|
+
const tr = trList[r];
|
|
11619
|
+
const tdList = tr.tdList;
|
|
11620
|
+
for (let d = 0; d < tdList.length; d++) {
|
|
11621
|
+
const td = tdList[d];
|
|
11622
|
+
const context2 = getNextContext(td.value, 0);
|
|
11623
|
+
if (context2) {
|
|
11624
|
+
return {
|
|
11625
|
+
positionContext: {
|
|
11626
|
+
isTable: true,
|
|
11627
|
+
index: e,
|
|
11628
|
+
trIndex: r,
|
|
11629
|
+
tdIndex: d,
|
|
11630
|
+
tdId: td.id,
|
|
11631
|
+
trId: tr.id,
|
|
11632
|
+
tableId: element.id
|
|
11633
|
+
},
|
|
11634
|
+
nextIndex: context2.nextIndex
|
|
11635
|
+
};
|
|
11636
|
+
}
|
|
11637
|
+
}
|
|
11638
|
+
}
|
|
11639
|
+
}
|
|
11640
|
+
if (!element.controlId || element.controlId === controlElement.controlId) {
|
|
11641
|
+
continue;
|
|
11642
|
+
}
|
|
11643
|
+
return {
|
|
11644
|
+
positionContext: {
|
|
11645
|
+
isTable: false
|
|
11646
|
+
},
|
|
11647
|
+
nextIndex: e
|
|
11648
|
+
};
|
|
11649
|
+
}
|
|
11650
|
+
return null;
|
|
11651
|
+
}
|
|
11652
|
+
const { endIndex } = this.range.getRange();
|
|
11653
|
+
const elementList = this.getElementList();
|
|
11654
|
+
const context = getNextContext(elementList, endIndex);
|
|
11655
|
+
if (context) {
|
|
11656
|
+
return {
|
|
11657
|
+
positionContext: positionContext.isTable ? positionContext : context.positionContext,
|
|
11658
|
+
nextIndex: context.nextIndex
|
|
11659
|
+
};
|
|
11660
|
+
}
|
|
11661
|
+
if (controlElement.tableId) {
|
|
11662
|
+
const originalElementList = this.draw.getOriginalElementList();
|
|
11663
|
+
const { index: index2, trIndex, tdIndex } = positionContext;
|
|
11664
|
+
const trList = originalElementList[index2].trList;
|
|
11665
|
+
for (let r = trIndex; r < trList.length; r++) {
|
|
11666
|
+
const tr = trList[r];
|
|
11667
|
+
const tdList = tr.tdList;
|
|
11668
|
+
for (let d = 0; d < tdList.length; d++) {
|
|
11669
|
+
if (trIndex === r && d <= tdIndex)
|
|
11670
|
+
continue;
|
|
11671
|
+
const td = tdList[d];
|
|
11672
|
+
const context3 = getNextContext(td.value, 0);
|
|
11673
|
+
if (context3) {
|
|
11674
|
+
return {
|
|
11675
|
+
positionContext: {
|
|
11676
|
+
isTable: true,
|
|
11677
|
+
index: positionContext.index,
|
|
11678
|
+
trIndex: r,
|
|
11679
|
+
tdIndex: d,
|
|
11680
|
+
tdId: td.id,
|
|
11681
|
+
trId: tr.id,
|
|
11682
|
+
tableId: controlElement.tableId
|
|
11683
|
+
},
|
|
11684
|
+
nextIndex: context3.nextIndex
|
|
11685
|
+
};
|
|
11686
|
+
}
|
|
11687
|
+
}
|
|
11688
|
+
}
|
|
11689
|
+
const context2 = getNextContext(originalElementList, index2 + 1);
|
|
11690
|
+
if (context2) {
|
|
11691
|
+
return {
|
|
11692
|
+
positionContext: {
|
|
11693
|
+
isTable: false
|
|
11694
|
+
},
|
|
11695
|
+
nextIndex: context2.nextIndex
|
|
11696
|
+
};
|
|
11697
|
+
}
|
|
11698
|
+
}
|
|
11699
|
+
return null;
|
|
11700
|
+
}
|
|
11701
|
+
initNextControl(option = {}) {
|
|
11702
|
+
const { direction = MoveDirection.DOWN } = option;
|
|
11703
|
+
let context = null;
|
|
11704
|
+
if (direction === MoveDirection.UP) {
|
|
11705
|
+
context = this.getPreControlContext();
|
|
11706
|
+
} else {
|
|
11707
|
+
context = this.getNextControlContext();
|
|
11708
|
+
}
|
|
11709
|
+
if (!context)
|
|
11710
|
+
return;
|
|
11711
|
+
const { nextIndex, positionContext } = context;
|
|
11712
|
+
const position = this.draw.getPosition();
|
|
11713
|
+
position.setPositionContext(positionContext);
|
|
11714
|
+
this.draw.getRange().replaceRange({
|
|
11715
|
+
startIndex: nextIndex,
|
|
11716
|
+
endIndex: nextIndex
|
|
11717
|
+
});
|
|
11718
|
+
this.draw.render({
|
|
11719
|
+
curIndex: nextIndex,
|
|
11720
|
+
isCompute: false,
|
|
11721
|
+
isSetCursor: true,
|
|
11722
|
+
isSubmitHistory: false
|
|
11723
|
+
});
|
|
11724
|
+
const positionList = position.getPositionList();
|
|
11725
|
+
this.draw.getCursor().moveCursorToVisible({
|
|
11726
|
+
cursorPosition: positionList[nextIndex],
|
|
11727
|
+
direction
|
|
11728
|
+
});
|
|
11729
|
+
}
|
|
11391
11730
|
}
|
|
11392
11731
|
class CheckboxParticle {
|
|
11393
11732
|
constructor(draw) {
|
|
@@ -11618,11 +11957,13 @@ class Previewer {
|
|
|
11618
11957
|
this.previewerImage = null;
|
|
11619
11958
|
}
|
|
11620
11959
|
_getElementPosition(element, position = null) {
|
|
11960
|
+
var _a;
|
|
11621
11961
|
let x = 0;
|
|
11622
11962
|
let y = 0;
|
|
11623
11963
|
const height = this.draw.getHeight();
|
|
11624
11964
|
const pageGap = this.draw.getPageGap();
|
|
11625
|
-
const
|
|
11965
|
+
const pageNo = (_a = position == null ? void 0 : position.pageNo) != null ? _a : this.draw.getPageNo();
|
|
11966
|
+
const preY = pageNo * (height + pageGap);
|
|
11626
11967
|
if (element.imgFloatPosition) {
|
|
11627
11968
|
x = element.imgFloatPosition.x;
|
|
11628
11969
|
y = element.imgFloatPosition.y + preY;
|
|
@@ -14256,10 +14597,18 @@ class Draw {
|
|
|
14256
14597
|
this.footer.recovery();
|
|
14257
14598
|
this.zone.setZone(EditorZone.MAIN);
|
|
14258
14599
|
}
|
|
14600
|
+
const { startIndex } = this.range.getRange();
|
|
14601
|
+
const isCollapsed = this.range.getIsCollapsed();
|
|
14259
14602
|
this.render({
|
|
14260
|
-
|
|
14261
|
-
|
|
14603
|
+
isSetCursor: true,
|
|
14604
|
+
curIndex: startIndex,
|
|
14605
|
+
isSubmitHistory: false
|
|
14262
14606
|
});
|
|
14607
|
+
if (!isCollapsed) {
|
|
14608
|
+
this.cursor.drawCursor({
|
|
14609
|
+
isShow: false
|
|
14610
|
+
});
|
|
14611
|
+
}
|
|
14263
14612
|
setTimeout(() => {
|
|
14264
14613
|
if (this.listener.pageModeChange) {
|
|
14265
14614
|
this.listener.pageModeChange(payload);
|
|
@@ -14518,14 +14867,11 @@ class Draw {
|
|
|
14518
14867
|
} else {
|
|
14519
14868
|
const elementWidth = element.width * scale;
|
|
14520
14869
|
const elementHeight = element.height * scale;
|
|
14521
|
-
|
|
14522
|
-
|
|
14523
|
-
|
|
14524
|
-
const adaptiveWidth = surplusWidth > 0 ? surplusWidth : Math.min(elementWidth, availableWidth);
|
|
14525
|
-
const adaptiveHeight = elementHeight * adaptiveWidth / elementWidth;
|
|
14526
|
-
element.width = adaptiveWidth / scale;
|
|
14870
|
+
if (elementWidth > availableWidth) {
|
|
14871
|
+
const adaptiveHeight = elementHeight * availableWidth / elementWidth;
|
|
14872
|
+
element.width = availableWidth / scale;
|
|
14527
14873
|
element.height = adaptiveHeight / scale;
|
|
14528
|
-
metrics.width =
|
|
14874
|
+
metrics.width = availableWidth;
|
|
14529
14875
|
metrics.height = adaptiveHeight;
|
|
14530
14876
|
metrics.boundingBoxDescent = adaptiveHeight;
|
|
14531
14877
|
} else {
|
|
@@ -14851,7 +15197,7 @@ class Draw {
|
|
|
14851
15197
|
rowList.push(row);
|
|
14852
15198
|
} else {
|
|
14853
15199
|
curRow.width += metrics.width;
|
|
14854
|
-
if (i === 0 &&
|
|
15200
|
+
if (i === 0 && getIsBlockElement(elementList[1])) {
|
|
14855
15201
|
curRow.height = defaultBasicRowMarginHeight;
|
|
14856
15202
|
curRow.ascent = defaultBasicRowMarginHeight;
|
|
14857
15203
|
} else if (curRow.height < height) {
|
|
@@ -15147,7 +15493,7 @@ class Draw {
|
|
|
15147
15493
|
_clearPage(pageNo) {
|
|
15148
15494
|
const ctx = this.ctxList[pageNo];
|
|
15149
15495
|
const pageDom = this.pageList[pageNo];
|
|
15150
|
-
ctx.clearRect(0, 0, pageDom.width, pageDom.height);
|
|
15496
|
+
ctx.clearRect(0, 0, Math.max(pageDom.width, this.getWidth()), Math.max(pageDom.height, this.getHeight()));
|
|
15151
15497
|
this.blockParticle.clear();
|
|
15152
15498
|
}
|
|
15153
15499
|
_drawPage(payload) {
|
|
@@ -17378,14 +17724,15 @@ class CommandAdapt {
|
|
|
17378
17724
|
const { startIndex, endIndex } = this.range.getRange();
|
|
17379
17725
|
if (!~startIndex && !~endIndex)
|
|
17380
17726
|
return;
|
|
17381
|
-
const { value, width, height } = payload;
|
|
17727
|
+
const { value, width, height, imgDisplay } = payload;
|
|
17382
17728
|
this.insertElementList([
|
|
17383
17729
|
{
|
|
17384
17730
|
value,
|
|
17385
17731
|
width,
|
|
17386
17732
|
height,
|
|
17387
17733
|
id: getUUID(),
|
|
17388
|
-
type: ElementType.IMAGE
|
|
17734
|
+
type: ElementType.IMAGE,
|
|
17735
|
+
imgDisplay
|
|
17389
17736
|
}
|
|
17390
17737
|
]);
|
|
17391
17738
|
}
|
|
@@ -17562,9 +17909,9 @@ class CommandAdapt {
|
|
|
17562
17909
|
if (element.imgDisplay === display)
|
|
17563
17910
|
return;
|
|
17564
17911
|
element.imgDisplay = display;
|
|
17912
|
+
const { startIndex, endIndex } = this.range.getRange();
|
|
17565
17913
|
if (display === ImageDisplay.FLOAT_TOP || display === ImageDisplay.FLOAT_BOTTOM) {
|
|
17566
17914
|
const positionList = this.position.getPositionList();
|
|
17567
|
-
const { startIndex } = this.range.getRange();
|
|
17568
17915
|
const { coordinate: { leftTop } } = positionList[startIndex];
|
|
17569
17916
|
element.imgFloatPosition = {
|
|
17570
17917
|
x: leftTop[0],
|
|
@@ -17575,7 +17922,8 @@ class CommandAdapt {
|
|
|
17575
17922
|
}
|
|
17576
17923
|
this.draw.getPreviewer().clearResizer();
|
|
17577
17924
|
this.draw.render({
|
|
17578
|
-
isSetCursor:
|
|
17925
|
+
isSetCursor: true,
|
|
17926
|
+
curIndex: endIndex
|
|
17579
17927
|
});
|
|
17580
17928
|
}
|
|
17581
17929
|
getImage(payload) {
|