@visactor/vrender-core 0.19.12 → 0.19.13-alpha.1
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/cjs/graphic/richtext.d.ts +1 -1
- package/cjs/graphic/richtext.js +2 -2
- package/cjs/graphic/richtext.js.map +1 -1
- package/cjs/index.d.ts +1 -2
- package/cjs/index.js +2 -3
- package/cjs/index.js.map +1 -1
- package/cjs/plugins/builtin-plugin/edit-module.d.ts +21 -0
- package/cjs/plugins/builtin-plugin/edit-module.js +81 -0
- package/cjs/plugins/builtin-plugin/edit-module.js.map +1 -0
- package/cjs/plugins/builtin-plugin/richtext-edit-plugin.d.ts +52 -0
- package/cjs/plugins/builtin-plugin/richtext-edit-plugin.js +279 -0
- package/cjs/plugins/builtin-plugin/richtext-edit-plugin.js.map +1 -0
- package/cjs/render/contributions/render/draw-interceptor.js +2 -2
- package/cjs/render/contributions/render/draw-interceptor.js.map +1 -1
- package/dist/index.es.js +479 -5
- package/es/graphic/richtext.d.ts +1 -1
- package/es/graphic/richtext.js +2 -2
- package/es/graphic/richtext.js.map +1 -1
- package/es/index.d.ts +1 -2
- package/es/index.js +2 -4
- package/es/index.js.map +1 -1
- package/es/plugins/builtin-plugin/edit-module.d.ts +21 -0
- package/es/plugins/builtin-plugin/edit-module.js +73 -0
- package/es/plugins/builtin-plugin/edit-module.js.map +1 -0
- package/es/plugins/builtin-plugin/richtext-edit-plugin.d.ts +52 -0
- package/es/plugins/builtin-plugin/richtext-edit-plugin.js +276 -0
- package/es/plugins/builtin-plugin/richtext-edit-plugin.js.map +1 -0
- package/es/render/contributions/render/draw-interceptor.js +2 -2
- package/es/render/contributions/render/draw-interceptor.js.map +1 -1
- package/package.json +2 -2
package/dist/index.es.js
CHANGED
|
@@ -16883,10 +16883,11 @@ class RichText extends Graphic {
|
|
|
16883
16883
|
fillOpacity,
|
|
16884
16884
|
strokeOpacity }, config);
|
|
16885
16885
|
}
|
|
16886
|
-
doUpdateFrameCache() {
|
|
16886
|
+
doUpdateFrameCache(tc) {
|
|
16887
16887
|
var _a;
|
|
16888
|
-
const { textConfig = [], maxWidth, maxHeight, width, height, ellipsis, wordBreak, verticalDirection, textAlign, textBaseline, layoutDirection, singleLine, disableAutoWrapLine } = this.attribute;
|
|
16888
|
+
const { textConfig: _tc = [], maxWidth, maxHeight, width, height, ellipsis, wordBreak, verticalDirection, textAlign, textBaseline, layoutDirection, singleLine, disableAutoWrapLine } = this.attribute;
|
|
16889
16889
|
const paragraphs = [];
|
|
16890
|
+
const textConfig = tc !== null && tc !== void 0 ? tc : _tc;
|
|
16890
16891
|
for (let i = 0; i < textConfig.length; i++) {
|
|
16891
16892
|
if ('image' in textConfig[i]) {
|
|
16892
16893
|
const config = this.combinedStyleToCharacter(textConfig[i]);
|
|
@@ -22819,13 +22820,25 @@ class ShadowRootDrawItemInterceptorContribution {
|
|
|
22819
22820
|
this.order = 1;
|
|
22820
22821
|
}
|
|
22821
22822
|
afterDrawItem(graphic, renderService, drawContext, drawContribution, params) {
|
|
22822
|
-
if (graphic.attribute.shadowRootIdx
|
|
22823
|
+
if (graphic.attribute.shadowRootIdx == null &&
|
|
22824
|
+
graphic.shadowRoot &&
|
|
22825
|
+
graphic.shadowRoot.attribute.shadowRootIdx < 0) {
|
|
22826
|
+
return false;
|
|
22827
|
+
}
|
|
22828
|
+
if (graphic.attribute.shadowRootIdx > 0 ||
|
|
22829
|
+
!graphic.attribute.shadowRootIdx ||
|
|
22830
|
+
(graphic.shadowRoot && graphic.shadowRoot.attribute.shadowRootIdx > 0)) {
|
|
22823
22831
|
this.drawItem(graphic, renderService, drawContext, drawContribution, params);
|
|
22824
22832
|
}
|
|
22825
22833
|
return false;
|
|
22826
22834
|
}
|
|
22827
22835
|
beforeDrawItem(graphic, renderService, drawContext, drawContribution, params) {
|
|
22828
|
-
if (graphic.attribute.shadowRootIdx
|
|
22836
|
+
if (graphic.attribute.shadowRootIdx == null &&
|
|
22837
|
+
graphic.shadowRoot &&
|
|
22838
|
+
graphic.shadowRoot.attribute.shadowRootIdx > 0) {
|
|
22839
|
+
return false;
|
|
22840
|
+
}
|
|
22841
|
+
if (graphic.attribute.shadowRootIdx < 0 || (graphic.shadowRoot && graphic.shadowRoot.attribute.shadowRootIdx < 0)) {
|
|
22829
22842
|
this.drawItem(graphic, renderService, drawContext, drawContribution, params);
|
|
22830
22843
|
}
|
|
22831
22844
|
return false;
|
|
@@ -27568,6 +27581,467 @@ function flatten_simplify(points, tolerance, highestQuality) {
|
|
|
27568
27581
|
return points;
|
|
27569
27582
|
}
|
|
27570
27583
|
|
|
27584
|
+
class EditModule {
|
|
27585
|
+
constructor(container) {
|
|
27586
|
+
this.handleKeyDown = (e) => {
|
|
27587
|
+
if (e.key === 'Delete' || e.key === 'Backspace') {
|
|
27588
|
+
this.handleInput({ data: null, type: 'Backspace' });
|
|
27589
|
+
}
|
|
27590
|
+
};
|
|
27591
|
+
this.handleCompositionStart = () => {
|
|
27592
|
+
const { textConfig = [] } = this.currRt.attribute;
|
|
27593
|
+
const lastConfig = textConfig[this.cursorIndex];
|
|
27594
|
+
textConfig.splice(this.cursorIndex + 1, 0, Object.assign(Object.assign({}, lastConfig), { text: '' }));
|
|
27595
|
+
this.isComposing = true;
|
|
27596
|
+
};
|
|
27597
|
+
this.handleCompositionEnd = () => {
|
|
27598
|
+
this.isComposing = false;
|
|
27599
|
+
const curIdx = this.cursorIndex + 1;
|
|
27600
|
+
const { textConfig = [] } = this.currRt.attribute;
|
|
27601
|
+
const lastConfig = textConfig[curIdx];
|
|
27602
|
+
textConfig.splice(curIdx, 1);
|
|
27603
|
+
const text = lastConfig.text;
|
|
27604
|
+
const textList = Array.from(text.toString());
|
|
27605
|
+
for (let i = 0; i < textList.length; i++) {
|
|
27606
|
+
textConfig.splice(i + curIdx, 0, Object.assign(Object.assign({}, lastConfig), { text: textList[i] }));
|
|
27607
|
+
}
|
|
27608
|
+
this.currRt.setAttributes({ textConfig });
|
|
27609
|
+
this.onChangeCbList.forEach(cb => {
|
|
27610
|
+
cb(text, this.isComposing, this.cursorIndex + textList.length, this.currRt);
|
|
27611
|
+
});
|
|
27612
|
+
};
|
|
27613
|
+
this.handleInput = (ev) => {
|
|
27614
|
+
if (!this.currRt) {
|
|
27615
|
+
return;
|
|
27616
|
+
}
|
|
27617
|
+
const str = ev.data || '\n';
|
|
27618
|
+
const { textConfig = [] } = this.currRt.attribute;
|
|
27619
|
+
let startIdx = this.selectionStartCursorIdx;
|
|
27620
|
+
let endIdx = this.cursorIndex;
|
|
27621
|
+
if (startIdx > endIdx) {
|
|
27622
|
+
[startIdx, endIdx] = [endIdx, startIdx];
|
|
27623
|
+
}
|
|
27624
|
+
this.selectionStartCursorIdx = startIdx;
|
|
27625
|
+
this.cursorIndex = startIdx;
|
|
27626
|
+
const lastConfig = textConfig[startIdx + (this.isComposing ? 1 : 0)];
|
|
27627
|
+
let currConfig = lastConfig;
|
|
27628
|
+
if (ev.type === 'Backspace' && !this.isComposing) {
|
|
27629
|
+
if (startIdx !== endIdx) {
|
|
27630
|
+
textConfig.splice(startIdx + 1, endIdx - startIdx);
|
|
27631
|
+
}
|
|
27632
|
+
else {
|
|
27633
|
+
textConfig.splice(startIdx, 1);
|
|
27634
|
+
startIdx -= 1;
|
|
27635
|
+
}
|
|
27636
|
+
}
|
|
27637
|
+
else {
|
|
27638
|
+
if (startIdx !== endIdx) {
|
|
27639
|
+
textConfig.splice(startIdx + 1, endIdx - startIdx);
|
|
27640
|
+
}
|
|
27641
|
+
if (!this.isComposing) {
|
|
27642
|
+
currConfig = Object.assign(Object.assign({}, lastConfig), { text: '' });
|
|
27643
|
+
startIdx += 1;
|
|
27644
|
+
textConfig.splice(startIdx, 0, currConfig);
|
|
27645
|
+
}
|
|
27646
|
+
currConfig.text = str;
|
|
27647
|
+
}
|
|
27648
|
+
this.currRt.setAttributes({ textConfig });
|
|
27649
|
+
if (!this.isComposing) {
|
|
27650
|
+
this.onChangeCbList.forEach(cb => {
|
|
27651
|
+
cb(str, this.isComposing, startIdx, this.currRt);
|
|
27652
|
+
});
|
|
27653
|
+
}
|
|
27654
|
+
else {
|
|
27655
|
+
this.onInputCbList.forEach(cb => {
|
|
27656
|
+
cb(str, this.isComposing, startIdx, this.currRt);
|
|
27657
|
+
});
|
|
27658
|
+
}
|
|
27659
|
+
};
|
|
27660
|
+
this.container = container !== null && container !== void 0 ? container : document.body;
|
|
27661
|
+
const textAreaDom = document.createElement('textarea');
|
|
27662
|
+
textAreaDom.autocomplete = 'off';
|
|
27663
|
+
textAreaDom.innerText = '';
|
|
27664
|
+
this.applyStyle(textAreaDom);
|
|
27665
|
+
this.container.append(textAreaDom);
|
|
27666
|
+
this.textAreaDom = textAreaDom;
|
|
27667
|
+
this.isComposing = false;
|
|
27668
|
+
this.onInputCbList = [];
|
|
27669
|
+
this.onChangeCbList = [];
|
|
27670
|
+
}
|
|
27671
|
+
onInput(cb) {
|
|
27672
|
+
this.onInputCbList.push(cb);
|
|
27673
|
+
}
|
|
27674
|
+
onChange(cb) {
|
|
27675
|
+
this.onChangeCbList.push(cb);
|
|
27676
|
+
}
|
|
27677
|
+
applyStyle(textAreaDom) {
|
|
27678
|
+
textAreaDom.setAttribute('style', `width: 100px; height: 30px; left: 0; position: absolute; z-index: -1; outline: none; resize: none; border: none; overflow: hidden; color: transparent; user-select: none; caret-color: transparent;background-color: transparent;`);
|
|
27679
|
+
textAreaDom.addEventListener('input', this.handleInput);
|
|
27680
|
+
textAreaDom.addEventListener('compositionstart', this.handleCompositionStart);
|
|
27681
|
+
textAreaDom.addEventListener('compositionend', this.handleCompositionEnd);
|
|
27682
|
+
window.addEventListener('keydown', this.handleKeyDown);
|
|
27683
|
+
}
|
|
27684
|
+
moveTo(x, y, rt, cursorIndex, selectionStartCursorIdx) {
|
|
27685
|
+
this.textAreaDom.style.left = `${x}px`;
|
|
27686
|
+
this.textAreaDom.style.top = `${y}px`;
|
|
27687
|
+
setTimeout(() => {
|
|
27688
|
+
this.textAreaDom.focus();
|
|
27689
|
+
this.textAreaDom.setSelectionRange(0, 0);
|
|
27690
|
+
});
|
|
27691
|
+
this.currRt = rt;
|
|
27692
|
+
this.cursorIndex = cursorIndex;
|
|
27693
|
+
this.selectionStartCursorIdx = selectionStartCursorIdx;
|
|
27694
|
+
}
|
|
27695
|
+
release() {
|
|
27696
|
+
this.textAreaDom.removeEventListener('input', this.handleInput);
|
|
27697
|
+
this.textAreaDom.removeEventListener('compositionstart', this.handleCompositionStart);
|
|
27698
|
+
this.textAreaDom.removeEventListener('compositionend', this.handleCompositionEnd);
|
|
27699
|
+
window.removeEventListener('keydown', this.handleKeyDown);
|
|
27700
|
+
}
|
|
27701
|
+
}
|
|
27702
|
+
|
|
27703
|
+
class RichTextEditPlugin {
|
|
27704
|
+
constructor() {
|
|
27705
|
+
this.name = 'RichTextEditPlugin';
|
|
27706
|
+
this.activeEvent = 'onRegister';
|
|
27707
|
+
this._uid = Generator.GenAutoIncrementId();
|
|
27708
|
+
this.key = this.name + this._uid;
|
|
27709
|
+
this.editing = false;
|
|
27710
|
+
this.pointerDown = false;
|
|
27711
|
+
this.handleInput = (text, isComposing, cursorIdx, rt) => {
|
|
27712
|
+
const p = this.getPointByColumnIdx(cursorIdx, rt);
|
|
27713
|
+
this.hideSelection();
|
|
27714
|
+
this.setCursor(p.x, p.y1, p.y2);
|
|
27715
|
+
};
|
|
27716
|
+
this.handleChange = (text, isComposing, cursorIdx, rt) => {
|
|
27717
|
+
const p = this.getPointByColumnIdx(cursorIdx, rt);
|
|
27718
|
+
this.curCursorIdx = cursorIdx;
|
|
27719
|
+
this.selectionStartCursorIdx = cursorIdx;
|
|
27720
|
+
this.setCursorAndTextArea(p.x, p.y1, p.y2, rt);
|
|
27721
|
+
this.hideSelection();
|
|
27722
|
+
};
|
|
27723
|
+
this.handleMove = (e) => {
|
|
27724
|
+
if (!this.isRichtext(e)) {
|
|
27725
|
+
return;
|
|
27726
|
+
}
|
|
27727
|
+
this.handleEnter(e);
|
|
27728
|
+
e.target.once('pointerleave', this.handleLeave);
|
|
27729
|
+
this.showSelection(e);
|
|
27730
|
+
};
|
|
27731
|
+
this.handlePointerDown = (e) => {
|
|
27732
|
+
if (this.editing) {
|
|
27733
|
+
this.onFocus(e);
|
|
27734
|
+
}
|
|
27735
|
+
else {
|
|
27736
|
+
this.deFocus(e);
|
|
27737
|
+
}
|
|
27738
|
+
this.applyUpdate();
|
|
27739
|
+
this.pointerDown = true;
|
|
27740
|
+
};
|
|
27741
|
+
this.handlePointerUp = (e) => {
|
|
27742
|
+
this.pointerDown = false;
|
|
27743
|
+
};
|
|
27744
|
+
this.handleEnter = (e) => {
|
|
27745
|
+
this.editing = true;
|
|
27746
|
+
this.pluginService.stage.setCursor('text');
|
|
27747
|
+
};
|
|
27748
|
+
this.handleLeave = (e) => {
|
|
27749
|
+
this.editing = false;
|
|
27750
|
+
this.pluginService.stage.setCursor('default');
|
|
27751
|
+
};
|
|
27752
|
+
}
|
|
27753
|
+
activate(context) {
|
|
27754
|
+
this.pluginService = context;
|
|
27755
|
+
this.editModule = new EditModule();
|
|
27756
|
+
context.stage.on('pointermove', this.handleMove);
|
|
27757
|
+
context.stage.on('pointerdown', this.handlePointerDown);
|
|
27758
|
+
context.stage.on('pointerup', this.handlePointerUp);
|
|
27759
|
+
context.stage.on('pointerleave', this.handlePointerUp);
|
|
27760
|
+
this.editModule.onInput(this.handleInput);
|
|
27761
|
+
this.editModule.onChange(this.handleChange);
|
|
27762
|
+
}
|
|
27763
|
+
showSelection(e) {
|
|
27764
|
+
const cache = e.target.getFrameCache();
|
|
27765
|
+
if (!(cache && this.editBg)) {
|
|
27766
|
+
return;
|
|
27767
|
+
}
|
|
27768
|
+
if (this.pointerDown) {
|
|
27769
|
+
let p0 = this.lastPoint;
|
|
27770
|
+
let p1 = this.getEventPosition(e);
|
|
27771
|
+
let line1Info = this.getLineByPoint(cache, p1);
|
|
27772
|
+
const column1 = this.getColumnByLinePoint(line1Info, p1);
|
|
27773
|
+
const y1 = line1Info.top;
|
|
27774
|
+
const y2 = line1Info.top + line1Info.height;
|
|
27775
|
+
let x = column1.left + column1.width;
|
|
27776
|
+
let cursorIndex = this.getColumnIndex(cache, column1);
|
|
27777
|
+
if (p1.x < column1.left + column1.width / 2) {
|
|
27778
|
+
x = column1.left;
|
|
27779
|
+
cursorIndex -= 1;
|
|
27780
|
+
}
|
|
27781
|
+
p1.x = x;
|
|
27782
|
+
p1.y = (y1 + y2) / 2;
|
|
27783
|
+
let line0Info = this.getLineByPoint(cache, p0);
|
|
27784
|
+
if (p0.y > p1.y || (p0.y === p1.y && p0.x > p1.x)) {
|
|
27785
|
+
[p0, p1] = [p1, p0];
|
|
27786
|
+
[line1Info, line0Info] = [line0Info, line1Info];
|
|
27787
|
+
}
|
|
27788
|
+
this.editBg.removeAllChild();
|
|
27789
|
+
if (line0Info === line1Info) {
|
|
27790
|
+
const column0 = this.getColumnByLinePoint(line0Info, p0);
|
|
27791
|
+
this.editBg.setAttributes({
|
|
27792
|
+
x: p0.x,
|
|
27793
|
+
y: line0Info.top,
|
|
27794
|
+
width: p1.x - p0.x,
|
|
27795
|
+
height: column0.height,
|
|
27796
|
+
fill: '#336df4',
|
|
27797
|
+
fillOpacity: 0.2
|
|
27798
|
+
});
|
|
27799
|
+
}
|
|
27800
|
+
else {
|
|
27801
|
+
this.editBg.setAttributes({ x: 0, y: line0Info.top, width: 0, height: 0 });
|
|
27802
|
+
const startIdx = cache.lines.findIndex(item => item === line0Info);
|
|
27803
|
+
const endIdx = cache.lines.findIndex(item => item === line1Info);
|
|
27804
|
+
let y = 0;
|
|
27805
|
+
for (let i = startIdx; i <= endIdx; i++) {
|
|
27806
|
+
const line = cache.lines[i];
|
|
27807
|
+
if (i === startIdx) {
|
|
27808
|
+
const p = line.paragraphs[line.paragraphs.length - 1];
|
|
27809
|
+
this.editBg.add(createRect({
|
|
27810
|
+
x: p0.x,
|
|
27811
|
+
y,
|
|
27812
|
+
width: p.left + p.width - p0.x,
|
|
27813
|
+
height: line.height,
|
|
27814
|
+
fill: '#336df4',
|
|
27815
|
+
fillOpacity: 0.2
|
|
27816
|
+
}));
|
|
27817
|
+
}
|
|
27818
|
+
else if (i === endIdx) {
|
|
27819
|
+
const p = line.paragraphs[0];
|
|
27820
|
+
this.editBg.add(createRect({
|
|
27821
|
+
x: p.left,
|
|
27822
|
+
y,
|
|
27823
|
+
width: p1.x - p.left,
|
|
27824
|
+
height: line.height,
|
|
27825
|
+
fill: '#336df4',
|
|
27826
|
+
fillOpacity: 0.2
|
|
27827
|
+
}));
|
|
27828
|
+
}
|
|
27829
|
+
else {
|
|
27830
|
+
const p0 = line.paragraphs[0];
|
|
27831
|
+
const p1 = line.paragraphs[line.paragraphs.length - 1];
|
|
27832
|
+
this.editBg.add(createRect({
|
|
27833
|
+
x: p0.left,
|
|
27834
|
+
y,
|
|
27835
|
+
width: p1.left + p1.width - p0.left,
|
|
27836
|
+
height: line.height,
|
|
27837
|
+
fill: '#336df4',
|
|
27838
|
+
fillOpacity: 0.2
|
|
27839
|
+
}));
|
|
27840
|
+
}
|
|
27841
|
+
y += line.height;
|
|
27842
|
+
}
|
|
27843
|
+
}
|
|
27844
|
+
this.curCursorIdx = cursorIndex;
|
|
27845
|
+
this.setCursorAndTextArea(x, y1 + 2, y2 - 2, e.target);
|
|
27846
|
+
}
|
|
27847
|
+
this.applyUpdate();
|
|
27848
|
+
}
|
|
27849
|
+
hideSelection() {
|
|
27850
|
+
if (this.editBg) {
|
|
27851
|
+
this.editBg.removeAllChild();
|
|
27852
|
+
this.editBg.setAttributes({ fill: 'transparent' });
|
|
27853
|
+
}
|
|
27854
|
+
}
|
|
27855
|
+
isRichtext(e) {
|
|
27856
|
+
return !!(e.target && e.target.type === 'richtext');
|
|
27857
|
+
}
|
|
27858
|
+
getEventPosition(e) {
|
|
27859
|
+
const p = this.pluginService.stage.eventPointTransform(e);
|
|
27860
|
+
const p1 = { x: 0, y: 0 };
|
|
27861
|
+
e.target.globalTransMatrix.transformPoint(p, p1);
|
|
27862
|
+
return p1;
|
|
27863
|
+
}
|
|
27864
|
+
getLineByPoint(cache, p1) {
|
|
27865
|
+
let lineInfo = cache.lines[0];
|
|
27866
|
+
for (let i = 0; i < cache.lines.length; i++) {
|
|
27867
|
+
if (lineInfo.top <= p1.y && lineInfo.top + lineInfo.height >= p1.y) {
|
|
27868
|
+
break;
|
|
27869
|
+
}
|
|
27870
|
+
lineInfo = cache.lines[i + 1];
|
|
27871
|
+
}
|
|
27872
|
+
return lineInfo;
|
|
27873
|
+
}
|
|
27874
|
+
getColumnByLinePoint(lineInfo, p1) {
|
|
27875
|
+
let columnInfo = lineInfo.paragraphs[0];
|
|
27876
|
+
for (let i = 0; i < lineInfo.paragraphs.length; i++) {
|
|
27877
|
+
if (columnInfo.left <= p1.x && columnInfo.left + columnInfo.width >= p1.x) {
|
|
27878
|
+
break;
|
|
27879
|
+
}
|
|
27880
|
+
columnInfo = lineInfo.paragraphs[i];
|
|
27881
|
+
}
|
|
27882
|
+
return columnInfo;
|
|
27883
|
+
}
|
|
27884
|
+
onFocus(e) {
|
|
27885
|
+
this.deFocus(e);
|
|
27886
|
+
const target = e.target;
|
|
27887
|
+
this.tryUpdateRichtext(target);
|
|
27888
|
+
const shadowRoot = target.attachShadow();
|
|
27889
|
+
shadowRoot.setAttributes({ shadowRootIdx: -1 });
|
|
27890
|
+
const cache = target.getFrameCache();
|
|
27891
|
+
if (!cache) {
|
|
27892
|
+
return;
|
|
27893
|
+
}
|
|
27894
|
+
if (!this.editLine) {
|
|
27895
|
+
const line = createLine({ x: 0, y: 0, lineWidth: 1, stroke: 'black' });
|
|
27896
|
+
line
|
|
27897
|
+
.animate()
|
|
27898
|
+
.to({ opacity: 1 }, 10, 'linear')
|
|
27899
|
+
.wait(700)
|
|
27900
|
+
.to({ opacity: 0 }, 10, 'linear')
|
|
27901
|
+
.wait(700)
|
|
27902
|
+
.loop(Infinity);
|
|
27903
|
+
this.editLine = line;
|
|
27904
|
+
const g = createGroup({ x: 0, y: 0, width: 0, height: 0 });
|
|
27905
|
+
this.editBg = g;
|
|
27906
|
+
shadowRoot.add(this.editLine);
|
|
27907
|
+
shadowRoot.add(this.editBg);
|
|
27908
|
+
}
|
|
27909
|
+
const p1 = this.getEventPosition(e);
|
|
27910
|
+
const lineInfo = this.getLineByPoint(cache, p1);
|
|
27911
|
+
if (lineInfo) {
|
|
27912
|
+
const columnInfo = this.getColumnByLinePoint(lineInfo, p1);
|
|
27913
|
+
if (!columnInfo) {
|
|
27914
|
+
return;
|
|
27915
|
+
}
|
|
27916
|
+
let y1 = lineInfo.top;
|
|
27917
|
+
let y2 = lineInfo.top + lineInfo.height;
|
|
27918
|
+
let x = columnInfo.left + columnInfo.width;
|
|
27919
|
+
y1 += 2;
|
|
27920
|
+
y2 -= 2;
|
|
27921
|
+
let cursorIndex = this.getColumnIndex(cache, columnInfo);
|
|
27922
|
+
if (p1.x < columnInfo.left + columnInfo.width / 2) {
|
|
27923
|
+
x = columnInfo.left;
|
|
27924
|
+
cursorIndex -= 1;
|
|
27925
|
+
}
|
|
27926
|
+
this.lastPoint = { x, y: (y1 + y2) / 2 };
|
|
27927
|
+
this.curCursorIdx = cursorIndex;
|
|
27928
|
+
this.selectionStartCursorIdx = cursorIndex;
|
|
27929
|
+
this.setCursorAndTextArea(x, y1, y2, target);
|
|
27930
|
+
}
|
|
27931
|
+
}
|
|
27932
|
+
getPointByColumnIdx(idx, rt) {
|
|
27933
|
+
const cache = rt.getFrameCache();
|
|
27934
|
+
const { lineInfo, columnInfo } = this.getColumnByIndex(cache, idx);
|
|
27935
|
+
let y1 = lineInfo.top;
|
|
27936
|
+
let y2 = lineInfo.top + lineInfo.height;
|
|
27937
|
+
const x = columnInfo.left + columnInfo.width;
|
|
27938
|
+
y1 += 2;
|
|
27939
|
+
y2 -= 2;
|
|
27940
|
+
return { x, y1, y2 };
|
|
27941
|
+
}
|
|
27942
|
+
getColumnIndex(cache, cInfo) {
|
|
27943
|
+
let inputIndex = -1;
|
|
27944
|
+
for (let i = 0; i < cache.lines.length; i++) {
|
|
27945
|
+
const line = cache.lines[i];
|
|
27946
|
+
for (let j = 0; j < line.paragraphs.length; j++) {
|
|
27947
|
+
inputIndex++;
|
|
27948
|
+
if (cInfo === line.paragraphs[j]) {
|
|
27949
|
+
return inputIndex;
|
|
27950
|
+
}
|
|
27951
|
+
}
|
|
27952
|
+
}
|
|
27953
|
+
return -1;
|
|
27954
|
+
}
|
|
27955
|
+
getColumnByIndex(cache, index) {
|
|
27956
|
+
let inputIndex = -1;
|
|
27957
|
+
for (let i = 0; i < cache.lines.length; i++) {
|
|
27958
|
+
const lineInfo = cache.lines[i];
|
|
27959
|
+
for (let j = 0; j < lineInfo.paragraphs.length; j++) {
|
|
27960
|
+
const columnInfo = lineInfo.paragraphs[j];
|
|
27961
|
+
inputIndex++;
|
|
27962
|
+
if (inputIndex === index) {
|
|
27963
|
+
return {
|
|
27964
|
+
lineInfo,
|
|
27965
|
+
columnInfo
|
|
27966
|
+
};
|
|
27967
|
+
}
|
|
27968
|
+
}
|
|
27969
|
+
}
|
|
27970
|
+
return null;
|
|
27971
|
+
}
|
|
27972
|
+
setCursorAndTextArea(x, y1, y2, rt) {
|
|
27973
|
+
this.editLine.setAttributes({
|
|
27974
|
+
points: [
|
|
27975
|
+
{ x, y: y1 },
|
|
27976
|
+
{ x, y: y2 }
|
|
27977
|
+
]
|
|
27978
|
+
});
|
|
27979
|
+
const out = { x: 0, y: 0 };
|
|
27980
|
+
rt.globalTransMatrix.getInverse().transformPoint({ x, y: y1 }, out);
|
|
27981
|
+
const { left, top } = this.pluginService.stage.window.getBoundingClientRect();
|
|
27982
|
+
out.x += left;
|
|
27983
|
+
out.y += top;
|
|
27984
|
+
this.editModule.moveTo(out.x, out.y, rt, this.curCursorIdx, this.selectionStartCursorIdx);
|
|
27985
|
+
}
|
|
27986
|
+
setCursor(x, y1, y2) {
|
|
27987
|
+
this.editLine.setAttributes({
|
|
27988
|
+
points: [
|
|
27989
|
+
{ x, y: y1 },
|
|
27990
|
+
{ x, y: y2 }
|
|
27991
|
+
]
|
|
27992
|
+
});
|
|
27993
|
+
}
|
|
27994
|
+
applyUpdate() {
|
|
27995
|
+
this.pluginService.stage.renderNextFrame();
|
|
27996
|
+
}
|
|
27997
|
+
deFocus(e) {
|
|
27998
|
+
const target = e.target;
|
|
27999
|
+
target.detachShadow();
|
|
28000
|
+
if (this.editLine) {
|
|
28001
|
+
this.editLine.parent.removeChild(this.editLine);
|
|
28002
|
+
this.editLine.release();
|
|
28003
|
+
this.editLine = null;
|
|
28004
|
+
this.editBg.parent.removeChild(this.editBg);
|
|
28005
|
+
this.editBg.release();
|
|
28006
|
+
this.editBg = null;
|
|
28007
|
+
}
|
|
28008
|
+
}
|
|
28009
|
+
splitText(text) {
|
|
28010
|
+
return Array.from(text);
|
|
28011
|
+
}
|
|
28012
|
+
tryUpdateRichtext(richtext) {
|
|
28013
|
+
const cache = richtext.getFrameCache();
|
|
28014
|
+
if (!cache.lines.every(line => line.paragraphs.every(item => !(item.text && isString(item.text) && this.splitText(item.text).length > 1)))) {
|
|
28015
|
+
const tc = [];
|
|
28016
|
+
richtext.attribute.textConfig.forEach((item) => {
|
|
28017
|
+
const textList = this.splitText(item.text.toString());
|
|
28018
|
+
if (isString(item.text) && textList.length > 1) {
|
|
28019
|
+
for (let i = 0; i < textList.length; i++) {
|
|
28020
|
+
const t = textList[i];
|
|
28021
|
+
tc.push(Object.assign(Object.assign({}, item), { text: t }));
|
|
28022
|
+
}
|
|
28023
|
+
}
|
|
28024
|
+
else {
|
|
28025
|
+
tc.push(item);
|
|
28026
|
+
}
|
|
28027
|
+
});
|
|
28028
|
+
richtext.doUpdateFrameCache(tc);
|
|
28029
|
+
}
|
|
28030
|
+
}
|
|
28031
|
+
onSelect() {
|
|
28032
|
+
return;
|
|
28033
|
+
}
|
|
28034
|
+
deactivate(context) {
|
|
28035
|
+
context.stage.off('pointermove', this.handleMove);
|
|
28036
|
+
context.stage.off('pointerdown', this.handlePointerDown);
|
|
28037
|
+
context.stage.off('pointerup', this.handlePointerUp);
|
|
28038
|
+
context.stage.off('pointerleave', this.handlePointerUp);
|
|
28039
|
+
}
|
|
28040
|
+
release() {
|
|
28041
|
+
this.editModule.release();
|
|
28042
|
+
}
|
|
28043
|
+
}
|
|
28044
|
+
|
|
27571
28045
|
class DefaultGraphicAllocate {
|
|
27572
28046
|
constructor() {
|
|
27573
28047
|
this.pools = [];
|
|
@@ -28569,4 +29043,4 @@ function registerWrapTextGraphic() {
|
|
|
28569
29043
|
graphicCreator.RegisterGraphicCreator('wrapText', createWrapText);
|
|
28570
29044
|
}
|
|
28571
29045
|
|
|
28572
|
-
export { ACustomAnimate, ARC3D_NUMBER_TYPE, ARC_NUMBER_TYPE, AREA_NUMBER_TYPE, AbstractGraphicRender, Animate, AnimateGroup, AnimateGroup1, AnimateMode, AnimateStatus, AnimateStepType, Application, Arc, Arc3d, Arc3dRender, ArcRender, ArcRenderContribution, Area, AreaRender, AreaRenderContribution, AttributeAnimate, AttributeUpdateType, AutoEnablePlugins, BaseCanvas, BaseEnvContribution, BaseRender, BaseRenderContributionTime, BaseWindowHandlerContribution, Basis, BeforeRenderConstribution, BoundsContext, BoundsPicker, CIRCLE_NUMBER_TYPE, Canvas3DDrawItemInterceptor, Canvas3DPickItemInterceptor, CanvasFactory, CanvasTextLayout, CbAnimate, Circle, CircleRender, CircleRenderContribution, ClipAngleAnimate, ClipDirectionAnimate, ClipGraphicAnimate, ClipRadiusAnimate, ColorInterpolate, ColorStore, ColorType, CommonDrawItemInterceptorContribution, CommonRenderContribution, Container, ContainerModule, Context2dFactory, ContributionProvider, CurveContext, CurveTypeEnum, CustomEvent, CustomPath2D, CustomSymbolClass, DebugDrawItemInterceptorContribution, DefaultArcAllocate, DefaultArcAttribute, DefaultArcRenderContribution, DefaultAreaAllocate, DefaultAreaAttribute, DefaultAreaTextureRenderContribution, DefaultAttribute, DefaultBaseBackgroundRenderContribution, DefaultBaseInteractiveRenderContribution, DefaultBaseTextureRenderContribution, DefaultCanvasAllocate, DefaultCanvasArcRender, DefaultCanvasAreaRender, DefaultCanvasCircleRender, DefaultCanvasImageRender, DefaultCanvasLineRender, DefaultCanvasPathRender, DefaultCanvasPolygonRender, DefaultCanvasRectRender, DefaultCanvasSymbolRender, DefaultCanvasTextRender, DefaultCircleAllocate, DefaultCircleAttribute, DefaultCircleRenderContribution, DefaultConnectAttribute, DefaultDebugAttribute, DefaultFillStyle, DefaultGlobal, DefaultGlobalPickerService, DefaultGlyphAttribute, DefaultGraphicAllocate, DefaultGraphicMemoryManager, DefaultGraphicService, DefaultGraphicUtil, DefaultGroupAttribute, DefaultGroupBackgroundRenderContribution, DefaultImageAttribute, DefaultImageBackgroundRenderContribution, DefaultImageRenderContribution, DefaultLayerService, DefaultLayout, DefaultLineAllocate, DefaultLineAttribute, DefaultMat4Allocate, DefaultMatrixAllocate, DefaultMorphingAnimateConfig, DefaultPathAllocate, DefaultPathAttribute, DefaultPickService, DefaultPickStyle, DefaultPolygonAttribute, DefaultRect3dAttribute, DefaultRectAllocate, DefaultRectAttribute, DefaultRectRenderContribution, DefaultRenderService, DefaultRichTextAttribute, DefaultRichTextIconAttribute, DefaultStateAnimateConfig, DefaultStrokeStyle, DefaultStyle, DefaultSymbolAllocate, DefaultSymbolAttribute, DefaultSymbolRenderContribution, DefaultTextAllocate, DefaultTextAttribute, DefaultTextMeasureContribution, DefaultTextStyle, DefaultTicker, DefaultTimeline, DefaultTransform, DefaultTransformUtil, DefaultWindow, Direction$1 as Direction, DrawContribution, DrawItemInterceptor, DynamicLayerHandlerContribution, Edge, EmptyContext2d, EnvContribution, EventManager, EventSystem, EventTarget, FadeInPlus, FederatedEvent, FederatedMouseEvent, FederatedPointerEvent, FederatedWheelEvent, GLYPH_NUMBER_TYPE, GRAPHIC_UPDATE_TAG_KEY, GROUP_NUMBER_TYPE, Generator, GlobalPickerService, Glyph, GlyphRender, Graphic, GraphicAnimate, GraphicCreator$1 as GraphicCreator, GraphicPicker, GraphicRender, GraphicService, GraphicUtil, Group, GroupFadeIn, GroupFadeOut, GroupRender, GroupRenderContribution, GroupUpdateAABBBoundsMode,
|
|
29046
|
+
export { ACustomAnimate, ARC3D_NUMBER_TYPE, ARC_NUMBER_TYPE, AREA_NUMBER_TYPE, AbstractGraphicRender, Animate, AnimateGroup, AnimateGroup1, AnimateMode, AnimateStatus, AnimateStepType, Application, Arc, Arc3d, Arc3dRender, ArcRender, ArcRenderContribution, Area, AreaRender, AreaRenderContribution, AttributeAnimate, AttributeUpdateType, AutoEnablePlugins, BaseCanvas, BaseEnvContribution, BaseRender, BaseRenderContributionTime, BaseWindowHandlerContribution, Basis, BeforeRenderConstribution, BoundsContext, BoundsPicker, CIRCLE_NUMBER_TYPE, Canvas3DDrawItemInterceptor, Canvas3DPickItemInterceptor, CanvasFactory, CanvasTextLayout, CbAnimate, Circle, CircleRender, CircleRenderContribution, ClipAngleAnimate, ClipDirectionAnimate, ClipGraphicAnimate, ClipRadiusAnimate, ColorInterpolate, ColorStore, ColorType, CommonDrawItemInterceptorContribution, CommonRenderContribution, Container, ContainerModule, Context2dFactory, ContributionProvider, CurveContext, CurveTypeEnum, CustomEvent, CustomPath2D, CustomSymbolClass, DebugDrawItemInterceptorContribution, DefaultArcAllocate, DefaultArcAttribute, DefaultArcRenderContribution, DefaultAreaAllocate, DefaultAreaAttribute, DefaultAreaTextureRenderContribution, DefaultAttribute, DefaultBaseBackgroundRenderContribution, DefaultBaseInteractiveRenderContribution, DefaultBaseTextureRenderContribution, DefaultCanvasAllocate, DefaultCanvasArcRender, DefaultCanvasAreaRender, DefaultCanvasCircleRender, DefaultCanvasImageRender, DefaultCanvasLineRender, DefaultCanvasPathRender, DefaultCanvasPolygonRender, DefaultCanvasRectRender, DefaultCanvasSymbolRender, DefaultCanvasTextRender, DefaultCircleAllocate, DefaultCircleAttribute, DefaultCircleRenderContribution, DefaultConnectAttribute, DefaultDebugAttribute, DefaultFillStyle, DefaultGlobal, DefaultGlobalPickerService, DefaultGlyphAttribute, DefaultGraphicAllocate, DefaultGraphicMemoryManager, DefaultGraphicService, DefaultGraphicUtil, DefaultGroupAttribute, DefaultGroupBackgroundRenderContribution, DefaultImageAttribute, DefaultImageBackgroundRenderContribution, DefaultImageRenderContribution, DefaultLayerService, DefaultLayout, DefaultLineAllocate, DefaultLineAttribute, DefaultMat4Allocate, DefaultMatrixAllocate, DefaultMorphingAnimateConfig, DefaultPathAllocate, DefaultPathAttribute, DefaultPickService, DefaultPickStyle, DefaultPolygonAttribute, DefaultRect3dAttribute, DefaultRectAllocate, DefaultRectAttribute, DefaultRectRenderContribution, DefaultRenderService, DefaultRichTextAttribute, DefaultRichTextIconAttribute, DefaultStateAnimateConfig, DefaultStrokeStyle, DefaultStyle, DefaultSymbolAllocate, DefaultSymbolAttribute, DefaultSymbolRenderContribution, DefaultTextAllocate, DefaultTextAttribute, DefaultTextMeasureContribution, DefaultTextStyle, DefaultTicker, DefaultTimeline, DefaultTransform, DefaultTransformUtil, DefaultWindow, Direction$1 as Direction, DrawContribution, DrawItemInterceptor, DynamicLayerHandlerContribution, Edge, EmptyContext2d, EnvContribution, EventManager, EventSystem, EventTarget, FadeInPlus, FederatedEvent, FederatedMouseEvent, FederatedPointerEvent, FederatedWheelEvent, GLYPH_NUMBER_TYPE, GRAPHIC_UPDATE_TAG_KEY, GROUP_NUMBER_TYPE, Generator, GlobalPickerService, Glyph, GlyphRender, Graphic, GraphicAnimate, GraphicCreator$1 as GraphicCreator, GraphicPicker, GraphicRender, GraphicService, GraphicUtil, Group, GroupFadeIn, GroupFadeOut, GroupRender, GroupRenderContribution, GroupUpdateAABBBoundsMode, IContainPointMode, IMAGE_NUMBER_TYPE, Image, ImageRender, ImageRenderContribution, IncreaseCount, IncrementalDrawContribution, InputText, InteractiveDrawItemInterceptorContribution, InteractivePickItemInterceptorContribution, InteractiveSubRenderContribution, LINE_NUMBER_TYPE, Layer, LayerService, Line$1 as Line, LineRender, Linear, LinearClosed, ManualTickHandler, ManualTicker, Mat4Allocate, MatrixAllocate, Meteor, MonotoneX, MonotoneY, MorphingPath, MotionPath, MultiToOneMorphingPath, NOWORK_ANIMATE_ATTR, Node, PATH_NUMBER_TYPE, POLYGON_NUMBER_TYPE, PURE_STYLE_KEY, PYRAMID3D_NUMBER_TYPE, Path, PathRender, PathRenderContribution, PickItemInterceptor, PickerService, PluginService, Polygon, PolygonRender, PolygonRenderContribution, Pyramid3d, Pyramid3dRender, RAFTickHandler, RECT3D_NUMBER_TYPE, RECT_NUMBER_TYPE, RICHTEXT_NUMBER_TYPE, RafBasedSTO, Rect, Rect3DRender, Rect3d, RectRender, RectRenderContribution, ReflectSegContext, RenderSelector, RenderService, ResourceLoader, RichText, RichTextEditPlugin, RichTextRender, RotateBySphereAnimate, SVG_ATTRIBUTE_MAP, SVG_ATTRIBUTE_MAP_KEYS, SVG_PARSE_ATTRIBUTE_MAP, SVG_PARSE_ATTRIBUTE_MAP_KEYS, SYMBOL_NUMBER_TYPE, SegContext, ShadowRoot, ShadowRootDrawItemInterceptorContribution, ShadowRootPickItemInterceptorContribution, SplitRectAfterRenderContribution, SplitRectBeforeRenderContribution, Stage, StaticLayerHandlerContribution, Step$1 as Step, StreamLight, SubAnimate, Symbol$1 as Symbol, SymbolRender, SymbolRenderContribution, TEXT_NUMBER_TYPE, TagPointsUpdate, Text, TextDirection, TextMeasureContribution, TextRender, TextRenderContribution, Theme, TimeOutTickHandler, TransformUtil, UpdateTag, VGlobal, VWindow, VirtualLayerHandlerContribution, WILDCARD, WindowHandlerContribution, WrapText, XMLParser, _interpolateColor, addArcToBezierPath, addAttributeToPrototype, alignBezierCurves, alignSubpath, application, applyTransformOnBezierCurves, arc3dModule, arcModule, areaModule, bezier, bezierCurversToPath, binarySplitPolygon, bindContributionProvider, bindContributionProviderNoSingletonScope, boundStroke, builtInSymbolStrMap, builtinSymbols, builtinSymbolsMap, calcLineCache$1 as calcLineCache, calculateLineHeight, canvasAllocate, centroidOfSubpath, circleBounds, circleModule, clock, cloneGraphic, colorEqual, colorStringInterpolationToStr, container, cornerTangents, createArc, createArc3d, createArea, createCircle, createColor, createConicalGradient, createGlyph, createGroup, createImage, createLine, createMat4, createPath, createPolygon, createPyramid3d, createRect, createRect3d, createRectPath, createRichText, createShadowRoot, createStage, createSymbol, createText, createWrapText, cubicCalc, cubicLength, cubicPointAt, cubicSubdivide, defaultArcAllocate, defaultArcBackgroundRenderContribution, defaultArcRenderContribution, defaultArcTextureRenderContribution, defaultAreaAllocate, defaultBaseBackgroundRenderContribution, defaultBaseTextureRenderContribution, defaultCircleAllocate, defaultCircleBackgroundRenderContribution, defaultCircleRenderContribution, defaultCircleTextureRenderContribution, defaultGraphicMemoryManager, defaultGroupBackgroundRenderContribution, defaultImageBackgroundRenderContribution, defaultImageRenderContribution, defaultLineAllocate, defaultPathAllocate, defaultRectAllocate, defaultRectBackgroundRenderContribution, defaultRectRenderContribution, defaultRectTextureRenderContribution, defaultSymbolAllocate, defaultSymbolBackgroundRenderContribution, defaultSymbolRenderContribution, defaultSymbolTextureRenderContribution, defaultTextAllocate, defaultTicker, defaultTimeline, drawArc, drawArcPath$1 as drawArcPath, drawAreaSegments, drawIncrementalAreaSegments, drawIncrementalSegments, drawPathProxy, drawSegments, enumCommandMap, fillVisible, findBestMorphingRotation, findNextGraphic, flatten_simplify, foreach, foreachAsync, genBasisSegments, genBasisTypeSegments, genLinearClosedSegments, genLinearClosedTypeSegments, genLinearSegments, genLinearTypeSegments, genMonotoneXSegments, genMonotoneXTypeSegments, genMonotoneYSegments, genMonotoneYTypeSegments, genNumberType, genStepSegments, genStepTypeSegments, getAttributeFromDefaultAttrList, getConicGradientAt, getContextFont, getCurrentEnv, getExtraModelMatrix, getModelMatrix, getRichTextBounds, getScaledStroke, getTextBounds, getTheme, getThemeFromGroup, globalTheme, glyphModule, graphicCreator, graphicService, graphicUtil, imageModule, incrementalAddTo, inject, injectable, interpolateColor, interpolateGradientConicalColor, interpolateGradientLinearColor, interpolateGradientRadialColor, interpolatePureColorArray, intersect, isBrowserEnv, isNodeEnv, isSvg, isTransformKey, isXML, layerService, lineModule, lookAt, mat3Tomat4, mat4Allocate, matrixAllocate, morphPath, multiInject, multiToOneMorph, multiply, multiplyMat4Mat3, multiplyMat4Mat4, named, newThemeObj, oneToMultiMorph, ortho, parsePadding, parseStroke, parseSvgPath, pathModule, pathToBezierCurves, point$2 as point, pointEqual, pointInterpolation, pointInterpolationHighPerformance, pointsEqual, pointsInterpolation, polygonModule, preLoadAllModule, pyramid3dModule, rafBasedSto, rect3dModule, rectFillVisible, rectModule, rectStrokeVisible, recursiveCallBinarySplit, registerArc3dGraphic, registerArcGraphic, registerAreaGraphic, registerCircleGraphic, registerGlyphGraphic, registerGroupGraphic, registerImageGraphic, registerLineGraphic, registerPathGraphic, registerPolygonGraphic, registerPyramid3dGraphic, registerRect3dGraphic, registerRectGraphic, registerRichtextGraphic, registerShadowRootGraphic, registerSymbolGraphic, registerTextGraphic, registerWrapTextGraphic, renderCommandList, rewriteProto, richtextModule, rotateX, rotateY, runFill, runStroke, segments, shouldUseMat4, snapLength, splitArc, splitArea, splitCircle, splitGraphic, splitLine, splitPath, splitPolygon, splitRect, splitToGrids, strCommandMap, strokeVisible, symbolModule, textAttributesToStyle, textDrawOffsetX, textDrawOffsetY, textLayoutOffsetY, textModule, transformKeys, transformMat4, transformUtil, translate, verticalLayout, vglobal, waitForAllSubLayers, wrapCanvas, wrapContext, xul };
|
package/es/graphic/richtext.d.ts
CHANGED
|
@@ -121,7 +121,7 @@ export declare class RichText extends Graphic<IRichTextGraphicAttribute> impleme
|
|
|
121
121
|
fillOpacity: number;
|
|
122
122
|
strokeOpacity: number;
|
|
123
123
|
};
|
|
124
|
-
doUpdateFrameCache(): void;
|
|
124
|
+
doUpdateFrameCache(tc?: IRichTextCharacter[]): void;
|
|
125
125
|
clone(): RichText;
|
|
126
126
|
setStage(stage?: IStage, layer?: ILayer): void;
|
|
127
127
|
bindIconEvent(): void;
|
package/es/graphic/richtext.js
CHANGED
|
@@ -134,9 +134,9 @@ export class RichText extends Graphic {
|
|
|
134
134
|
strokeOpacity: strokeOpacity
|
|
135
135
|
}, config);
|
|
136
136
|
}
|
|
137
|
-
doUpdateFrameCache() {
|
|
137
|
+
doUpdateFrameCache(tc) {
|
|
138
138
|
var _a;
|
|
139
|
-
const {textConfig:
|
|
139
|
+
const {textConfig: _tc = [], maxWidth: maxWidth, maxHeight: maxHeight, width: width, height: height, ellipsis: ellipsis, wordBreak: wordBreak, verticalDirection: verticalDirection, textAlign: textAlign, textBaseline: textBaseline, layoutDirection: layoutDirection, singleLine: singleLine, disableAutoWrapLine: disableAutoWrapLine} = this.attribute, paragraphs = [], textConfig = null != tc ? tc : _tc;
|
|
140
140
|
for (let i = 0; i < textConfig.length; i++) if ("image" in textConfig[i]) {
|
|
141
141
|
const config = this.combinedStyleToCharacter(textConfig[i]), iconCache = config.id && this._frameCache && this._frameCache.icons && this._frameCache.icons.get(config.id);
|
|
142
142
|
if (iconCache) paragraphs.push(iconCache); else {
|