@hailin-zheng/editor-core 2.0.15 → 2.0.17
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/index-cjs.js +214 -100
- package/index-cjs.js.map +1 -1
- package/index.js +214 -100
- package/index.js.map +1 -1
- package/med_editor/doc-editor.d.ts +1 -0
- package/med_editor/framework/document-event.d.ts +8 -0
- package/med_editor/framework/element-props.d.ts +2 -0
- package/med_editor/framework/element-util.d.ts +6 -0
- package/med_editor/framework/impl/data-element/data-element-check-impl.d.ts +2 -0
- package/med_editor/framework/impl/table/table-util.d.ts +10 -0
- package/package.json +1 -1
package/index-cjs.js
CHANGED
@@ -2273,12 +2273,14 @@ class DataEleListProps extends DataEleBaseTextProps {
|
|
2273
2273
|
* 是否允许多选
|
2274
2274
|
*/
|
2275
2275
|
multiSelect;
|
2276
|
+
displayField = 'value';
|
2276
2277
|
clone(dest) {
|
2277
2278
|
const clone = dest ?? new DataEleListProps();
|
2278
2279
|
super.clone(clone);
|
2279
2280
|
clone.options = [...this.options];
|
2280
2281
|
clone.dropDownStyle = this.dropDownStyle;
|
2281
2282
|
clone.multiSelect = this.multiSelect;
|
2283
|
+
clone.displayField = this.displayField;
|
2282
2284
|
return clone;
|
2283
2285
|
}
|
2284
2286
|
getSerializeProps(options) {
|
@@ -2287,6 +2289,9 @@ class DataEleListProps extends DataEleBaseTextProps {
|
|
2287
2289
|
multiSelect: this.multiSelect,
|
2288
2290
|
dropDownStyle: this.dropDownStyle,
|
2289
2291
|
};
|
2292
|
+
if (this.displayField && this.displayField !== 'value') {
|
2293
|
+
props['displayField'] = this.displayField;
|
2294
|
+
}
|
2290
2295
|
super.getBaseProps(props, options);
|
2291
2296
|
return props;
|
2292
2297
|
}
|
@@ -2295,6 +2300,7 @@ class DataEleListProps extends DataEleBaseTextProps {
|
|
2295
2300
|
this.options = props.options;
|
2296
2301
|
this.multiSelect = props.multiSelect;
|
2297
2302
|
this.dropDownStyle = props.dropDownStyle;
|
2303
|
+
this.displayField = props.displayField;
|
2298
2304
|
}
|
2299
2305
|
}
|
2300
2306
|
class CommContentProps extends INotifyPropertyChanged {
|
@@ -2348,6 +2354,7 @@ class DataEleCheckProps extends DataEleBaseProps {
|
|
2348
2354
|
falseChar = falseChar;
|
2349
2355
|
trueStateColor = '#f00000';
|
2350
2356
|
falseStateColor = '#000000';
|
2357
|
+
style = 'CheckBox';
|
2351
2358
|
clone(dest) {
|
2352
2359
|
const clone = dest ?? new DataEleCheckProps();
|
2353
2360
|
super.cloneBaseProps(clone);
|
@@ -2362,6 +2369,7 @@ class DataEleCheckProps extends DataEleBaseProps {
|
|
2362
2369
|
clone.border = this.border;
|
2363
2370
|
clone.trueStateColor = this.trueStateColor;
|
2364
2371
|
clone.falseStateColor = this.falseStateColor;
|
2372
|
+
clone.style = this.style;
|
2365
2373
|
return clone;
|
2366
2374
|
}
|
2367
2375
|
getSerializeProps(options) {
|
@@ -2390,6 +2398,9 @@ class DataEleCheckProps extends DataEleBaseProps {
|
|
2390
2398
|
if (this.falseStateColor !== '#000000') {
|
2391
2399
|
props.falseStateColor = this.falseStateColor;
|
2392
2400
|
}
|
2401
|
+
if (this.style !== 'CheckBox') {
|
2402
|
+
props.style = this.style;
|
2403
|
+
}
|
2393
2404
|
this.getBaseProps(props, options);
|
2394
2405
|
return props;
|
2395
2406
|
}
|
@@ -2406,6 +2417,7 @@ class DataEleCheckProps extends DataEleBaseProps {
|
|
2406
2417
|
this.trueStateColor = props.trueStateColor;
|
2407
2418
|
this.falseStateColor = props.falseStateColor;
|
2408
2419
|
this.border = props.border;
|
2420
|
+
this.style = props.style;
|
2409
2421
|
}
|
2410
2422
|
}
|
2411
2423
|
class DataEleImageProps extends DataEleBaseProps {
|
@@ -2771,6 +2783,7 @@ class DataDecorateElement extends LeafElement {
|
|
2771
2783
|
}
|
2772
2784
|
}
|
2773
2785
|
});
|
2786
|
+
this.disableClick = !isPrefix;
|
2774
2787
|
this.isDecorate = true;
|
2775
2788
|
}
|
2776
2789
|
createRenderObject() {
|
@@ -3388,7 +3401,6 @@ class DocumentRenderObject extends BlockContainerRenderObject {
|
|
3388
3401
|
'font-family': '仿宋',
|
3389
3402
|
'font-size': '14',
|
3390
3403
|
"fill": this.element.props.color,
|
3391
|
-
'font-style': 'italic',
|
3392
3404
|
x: 0,
|
3393
3405
|
y: 0,
|
3394
3406
|
}
|
@@ -4279,7 +4291,7 @@ class PSymbolElement extends LeafElement {
|
|
4279
4291
|
createRenderObject() {
|
4280
4292
|
const symbol = new PSymbolRenderObject(this);
|
4281
4293
|
symbol.rect.height = this.defaultHeight;
|
4282
|
-
symbol.rect.width =
|
4294
|
+
symbol.rect.width = 1;
|
4283
4295
|
return symbol;
|
4284
4296
|
}
|
4285
4297
|
serialize() {
|
@@ -4779,7 +4791,7 @@ class TextGroupRenderObject extends LeafRenderObject {
|
|
4779
4791
|
return curr.actualSize + prev;
|
4780
4792
|
}, this.rect.x);
|
4781
4793
|
const x = arr.join(' ');
|
4782
|
-
const y = this.textMeasures.map(item => this.rect.y + vertHeight).join(' ');
|
4794
|
+
const y = this.rect.y + vertHeight; //this.textMeasures.map(item => this.rect.y + vertHeight).join(' ');
|
4783
4795
|
const text = this.textMeasures.map(item => {
|
4784
4796
|
return item.char;
|
4785
4797
|
}).join('');
|
@@ -4828,6 +4840,10 @@ class TextGroupRenderObject extends LeafRenderObject {
|
|
4828
4840
|
const path = `M${event.relativePagePos.x} ${event.relativePagePos.y} L${event.relativePagePos.x + this.rect.width} ${event.relativePagePos.y}`;
|
4829
4841
|
event.highlights.push(ElementUtil.getStrokeSvgPath(path, '#000', 1));
|
4830
4842
|
}
|
4843
|
+
//处理null-text
|
4844
|
+
if (this.element.isDecorate && this.element.disableClick && !this.element.parent) {
|
4845
|
+
t.data.attrs['opacity'] = '0.58';
|
4846
|
+
}
|
4831
4847
|
return t;
|
4832
4848
|
}
|
4833
4849
|
}
|
@@ -5099,10 +5115,7 @@ class SelectionRange {
|
|
5099
5115
|
}
|
5100
5116
|
setInfo(control, offset) {
|
5101
5117
|
if (control instanceof LeafElement) {
|
5102
|
-
|
5103
|
-
offset = offset === -1 ? control.text.length : offset;
|
5104
|
-
}
|
5105
|
-
offset = offset === -1 ? 1 : offset;
|
5118
|
+
offset = ElementUtil.fixedOffset(control, offset);
|
5106
5119
|
return { control, offset };
|
5107
5120
|
}
|
5108
5121
|
else if (control instanceof BranchElement) {
|
@@ -6301,6 +6314,40 @@ class TableUtil {
|
|
6301
6314
|
});
|
6302
6315
|
}
|
6303
6316
|
}
|
6317
|
+
static getTableData(tb) {
|
6318
|
+
//根据实际要提取的行索引进行调整
|
6319
|
+
const rowData = [];
|
6320
|
+
for (let i = 0; i < tb.length; i++) {
|
6321
|
+
const row = tb.getChild(i);
|
6322
|
+
const cellData = [];
|
6323
|
+
for (let j = 0; j < row.length; j++) {
|
6324
|
+
const cell = row.getChild(j);
|
6325
|
+
cellData.push(this.getCellData(cell));
|
6326
|
+
}
|
6327
|
+
rowData.push(cellData);
|
6328
|
+
}
|
6329
|
+
return rowData;
|
6330
|
+
}
|
6331
|
+
/**
|
6332
|
+
* 获取单元格内的数据元的值
|
6333
|
+
* @param target
|
6334
|
+
*/
|
6335
|
+
static getCellData(target) {
|
6336
|
+
if (validateDataEle(target)) {
|
6337
|
+
const dataEle = target;
|
6338
|
+
return { id: dataEle.props.id, value: dataEle.getValue() };
|
6339
|
+
}
|
6340
|
+
if (target instanceof BranchElement) {
|
6341
|
+
for (let i = 0; i < target.length; i++) {
|
6342
|
+
const child = target.getChild(i);
|
6343
|
+
const val = this.getCellData(child);
|
6344
|
+
if (val !== null) {
|
6345
|
+
return val;
|
6346
|
+
}
|
6347
|
+
}
|
6348
|
+
}
|
6349
|
+
return null;
|
6350
|
+
}
|
6304
6351
|
}
|
6305
6352
|
|
6306
6353
|
class TableElement extends BlockContainerElement {
|
@@ -8681,6 +8728,46 @@ class ElementUtil {
|
|
8681
8728
|
]
|
8682
8729
|
};
|
8683
8730
|
}
|
8731
|
+
/**
|
8732
|
+
* 判断是否光标可以设置接受编辑
|
8733
|
+
* @returns
|
8734
|
+
*/
|
8735
|
+
static canSetCursor(startControl, startOffset, editable, viewOptions) {
|
8736
|
+
if (!startControl || !editable) {
|
8737
|
+
return false;
|
8738
|
+
}
|
8739
|
+
if (viewOptions.docMode === exports.DocMode.Design) {
|
8740
|
+
return true;
|
8741
|
+
}
|
8742
|
+
//浏览模式
|
8743
|
+
if (viewOptions.docMode === exports.DocMode.View) {
|
8744
|
+
return false;
|
8745
|
+
}
|
8746
|
+
//表单模式下,如果不在数据元素中,则不显示光标
|
8747
|
+
if (viewOptions.docMode === exports.DocMode.FormEdit) {
|
8748
|
+
if (!IsInSideDataElement(startControl, startOffset)) {
|
8749
|
+
return false;
|
8750
|
+
}
|
8751
|
+
}
|
8752
|
+
if (!ElementUtil.verifyHitable(startControl)) {
|
8753
|
+
return false;
|
8754
|
+
}
|
8755
|
+
//表单模式下,数据元不可编辑
|
8756
|
+
if (viewOptions.docMode === exports.DocMode.FormEdit && IsInSideDataElement(startControl, startOffset)) {
|
8757
|
+
const dataEle = ElementUtil.getDataElement(startControl);
|
8758
|
+
if (dataEle && !dataEle.props.editable) {
|
8759
|
+
return false;
|
8760
|
+
}
|
8761
|
+
}
|
8762
|
+
return true;
|
8763
|
+
}
|
8764
|
+
static fixedOffset(control, offset) {
|
8765
|
+
if (control instanceof TextGroupElement) {
|
8766
|
+
offset = offset === -1 ? control.text.length : offset;
|
8767
|
+
}
|
8768
|
+
offset = offset === -1 ? 1 : offset;
|
8769
|
+
return offset;
|
8770
|
+
}
|
8684
8771
|
}
|
8685
8772
|
|
8686
8773
|
class RenderContext {
|
@@ -10814,74 +10901,83 @@ class DataElementCheckRenderObject extends LeafRenderObject {
|
|
10814
10901
|
});
|
10815
10902
|
}
|
10816
10903
|
else {
|
10904
|
+
const style = props.style;
|
10817
10905
|
if (props.multiSelect) {
|
10818
|
-
t.
|
10819
|
-
|
10820
|
-
data: {
|
10821
|
-
ns: "http://www.w3.org/2000/svg",
|
10822
|
-
attrs: {
|
10823
|
-
x: 2,
|
10824
|
-
y: 0,
|
10825
|
-
width,
|
10826
|
-
height,
|
10827
|
-
stroke: 'black',
|
10828
|
-
fill: 'none',
|
10829
|
-
'stroke-width': 1
|
10830
|
-
}
|
10831
|
-
}
|
10832
|
-
});
|
10833
|
-
if (props.checked) {
|
10834
|
-
const paths = ElementUtil.getCheckboxPath(2, 0, props.size, props.size);
|
10835
|
-
t.children.push({
|
10836
|
-
sel: 'path',
|
10837
|
-
data: {
|
10838
|
-
ns: "http://www.w3.org/2000/svg",
|
10839
|
-
attrs: {
|
10840
|
-
d: paths.map((item, index) => {
|
10841
|
-
return `${index === 0 ? 'M' : 'L'}${item.x},${item.y}`;
|
10842
|
-
}).join(' '),
|
10843
|
-
stroke: 'red',
|
10844
|
-
fill: 'none',
|
10845
|
-
'stroke-width': 2
|
10846
|
-
}
|
10847
|
-
}
|
10848
|
-
});
|
10849
|
-
}
|
10906
|
+
style === 'RadioButton' ? this.drawCircleCheckbox(t, width, height, props.checked)
|
10907
|
+
: this.drawRectCheckbox(t, width, height, props.size, props.checked);
|
10850
10908
|
}
|
10851
10909
|
else {
|
10852
|
-
t.
|
10853
|
-
|
10854
|
-
|
10855
|
-
|
10856
|
-
|
10857
|
-
|
10858
|
-
|
10859
|
-
|
10860
|
-
|
10861
|
-
|
10862
|
-
|
10863
|
-
|
10910
|
+
style === 'CheckBox' ? this.drawRectCheckbox(t, width, height, props.size, props.checked)
|
10911
|
+
: this.drawCircleCheckbox(t, width, height, props.checked);
|
10912
|
+
}
|
10913
|
+
}
|
10914
|
+
return t;
|
10915
|
+
}
|
10916
|
+
drawRectCheckbox(t, width, height, size, checked) {
|
10917
|
+
t.children.push({
|
10918
|
+
sel: 'rect',
|
10919
|
+
data: {
|
10920
|
+
ns: "http://www.w3.org/2000/svg",
|
10921
|
+
attrs: {
|
10922
|
+
x: 2,
|
10923
|
+
y: 0,
|
10924
|
+
width,
|
10925
|
+
height,
|
10926
|
+
stroke: 'black',
|
10927
|
+
fill: 'none',
|
10928
|
+
'stroke-width': 1
|
10929
|
+
}
|
10930
|
+
}
|
10931
|
+
});
|
10932
|
+
if (checked) {
|
10933
|
+
const paths = ElementUtil.getCheckboxPath(2, 0, size, size);
|
10934
|
+
t.children.push({
|
10935
|
+
sel: 'path',
|
10936
|
+
data: {
|
10937
|
+
ns: "http://www.w3.org/2000/svg",
|
10938
|
+
attrs: {
|
10939
|
+
d: paths.map((item, index) => {
|
10940
|
+
return `${index === 0 ? 'M' : 'L'}${item.x},${item.y}`;
|
10941
|
+
}).join(' '),
|
10942
|
+
stroke: 'red',
|
10943
|
+
fill: 'none',
|
10944
|
+
'stroke-width': 2
|
10864
10945
|
}
|
10865
|
-
}
|
10866
|
-
|
10867
|
-
|
10868
|
-
|
10869
|
-
|
10870
|
-
|
10871
|
-
|
10872
|
-
|
10873
|
-
|
10874
|
-
|
10875
|
-
|
10876
|
-
|
10877
|
-
|
10878
|
-
|
10879
|
-
|
10880
|
-
|
10946
|
+
}
|
10947
|
+
});
|
10948
|
+
}
|
10949
|
+
}
|
10950
|
+
drawCircleCheckbox(t, width, height, checked) {
|
10951
|
+
t.children.push({
|
10952
|
+
sel: 'circle',
|
10953
|
+
data: {
|
10954
|
+
ns: "http://www.w3.org/2000/svg",
|
10955
|
+
attrs: {
|
10956
|
+
cx: 2 + width / 2,
|
10957
|
+
cy: height / 2,
|
10958
|
+
r: width / 3,
|
10959
|
+
stroke: 'black',
|
10960
|
+
fill: 'none',
|
10961
|
+
'stroke-width': 1
|
10881
10962
|
}
|
10882
10963
|
}
|
10964
|
+
});
|
10965
|
+
if (checked) {
|
10966
|
+
t.children.push({
|
10967
|
+
sel: 'circle',
|
10968
|
+
data: {
|
10969
|
+
ns: "http://www.w3.org/2000/svg",
|
10970
|
+
attrs: {
|
10971
|
+
cx: 2 + width / 2,
|
10972
|
+
cy: height / 2,
|
10973
|
+
r: width / 5,
|
10974
|
+
stroke: 'black',
|
10975
|
+
fill: 'black',
|
10976
|
+
'stroke-width': 1
|
10977
|
+
}
|
10978
|
+
}
|
10979
|
+
});
|
10883
10980
|
}
|
10884
|
-
return t;
|
10885
10981
|
}
|
10886
10982
|
}
|
10887
10983
|
class DataElementCheckFactory extends ElementFactory {
|
@@ -10906,6 +11002,7 @@ class DataElementCheckFactory extends ElementFactory {
|
|
10906
11002
|
dataEleProps.trueChar = props.trueChar ?? trueChar;
|
10907
11003
|
dataEleProps.falseChar = props.falseChar ?? falseChar;
|
10908
11004
|
dataEleProps.border = props.border ?? true;
|
11005
|
+
dataEleProps.style = props.style ?? 'CheckBox';
|
10909
11006
|
return dataEleProps;
|
10910
11007
|
}
|
10911
11008
|
}
|
@@ -11300,6 +11397,8 @@ class DataElementList extends DataElementInlineGroup {
|
|
11300
11397
|
}
|
11301
11398
|
this.pubOnChange('self');
|
11302
11399
|
this.clearInnerItems();
|
11400
|
+
let displayField = this.props.displayField;
|
11401
|
+
displayField = displayField ? displayField : 'value';
|
11303
11402
|
if (this.props.multiSelect) {
|
11304
11403
|
for (let i = 0; i < vals.length; i++) {
|
11305
11404
|
const val = vals[i];
|
@@ -11308,12 +11407,14 @@ class DataElementList extends DataElementInlineGroup {
|
|
11308
11407
|
const valueText = new TextGroupElement();
|
11309
11408
|
this.props.valueTextProps.clone(valueText.props);
|
11310
11409
|
const splitSymbol = i < vals.length - 1 ? ';' : '';
|
11311
|
-
valueText.text = option
|
11410
|
+
valueText.text = option[displayField] + splitSymbol;
|
11312
11411
|
this.addChild(valueText, this.length - 1);
|
11313
11412
|
}
|
11314
11413
|
}
|
11315
11414
|
}
|
11316
11415
|
else {
|
11416
|
+
let displayField = this.props.displayField;
|
11417
|
+
displayField = displayField ? displayField : 'value';
|
11317
11418
|
if (vals.length > 1) {
|
11318
11419
|
console.warn('当前下拉框是单选模式,不能传入多个值');
|
11319
11420
|
}
|
@@ -11322,7 +11423,7 @@ class DataElementList extends DataElementInlineGroup {
|
|
11322
11423
|
if (option) {
|
11323
11424
|
const valueText = new TextGroupElement();
|
11324
11425
|
this.props.valueTextProps.clone(valueText.props);
|
11325
|
-
valueText.text = option
|
11426
|
+
valueText.text = option[displayField];
|
11326
11427
|
this.addChild(valueText, this.length - 1);
|
11327
11428
|
}
|
11328
11429
|
}
|
@@ -11333,10 +11434,12 @@ class DataElementList extends DataElementInlineGroup {
|
|
11333
11434
|
if (!values) {
|
11334
11435
|
return '';
|
11335
11436
|
}
|
11437
|
+
let displayField = this.props.displayField;
|
11438
|
+
displayField = displayField ? displayField : 'value';
|
11336
11439
|
const valueItems = values.split(';');
|
11337
11440
|
const valueCode = [];
|
11338
11441
|
for (const valueItem of valueItems) {
|
11339
|
-
const option = this.props.options.find(item => item
|
11442
|
+
const option = this.props.options.find(item => item[displayField] === valueItem);
|
11340
11443
|
if (option) {
|
11341
11444
|
valueCode.push(option.code);
|
11342
11445
|
}
|
@@ -11381,6 +11484,7 @@ class DataElementListFactory extends DataElementBaseFactory {
|
|
11381
11484
|
dataEleProps.multiSelect = props.multiSelect;
|
11382
11485
|
dataEleProps.options = [...options];
|
11383
11486
|
dataEleProps.dropDownStyle = props.dropDownStyle;
|
11487
|
+
dataEleProps.displayField = props.displayField ?? 'value';
|
11384
11488
|
return dataEleProps;
|
11385
11489
|
}
|
11386
11490
|
}
|
@@ -17566,7 +17670,6 @@ class DocumentEvent {
|
|
17566
17670
|
if (resizeColWidth < minColWidth || cellWidth < minColWidth) {
|
17567
17671
|
return;
|
17568
17672
|
}
|
17569
|
-
console.log(resizeColWidth, cellWidth);
|
17570
17673
|
table.setCellWidth(resizeColIndex, resizeColWidth);
|
17571
17674
|
table.setCellWidth(cellIndex, cellWidth);
|
17572
17675
|
this.edgeRenderInfo.mousedownPos = this.currentPos;
|
@@ -17740,6 +17843,15 @@ class DocumentEvent {
|
|
17740
17843
|
*/
|
17741
17844
|
moveCursorToLeft() {
|
17742
17845
|
const { startControl, startOffset } = this.selectionState;
|
17846
|
+
this.moveCursorToLeftHandle(startControl, startOffset);
|
17847
|
+
}
|
17848
|
+
/**
|
17849
|
+
* 向左移动光标处理函数
|
17850
|
+
* @param startControl
|
17851
|
+
* @param startOffset
|
17852
|
+
* @private
|
17853
|
+
*/
|
17854
|
+
moveCursorToLeftHandle(startControl, startOffset) {
|
17743
17855
|
if (startOffset === 0) {
|
17744
17856
|
const oldRegion = ElementUtil.getElementRegion(startControl);
|
17745
17857
|
const prevEle = ElementUtil.getRecursionPrevSiblingElement(startControl, false, true, this.viewOptions);
|
@@ -17748,6 +17860,10 @@ class DocumentEvent {
|
|
17748
17860
|
if (newRegion !== oldRegion) {
|
17749
17861
|
return;
|
17750
17862
|
}
|
17863
|
+
if (this.viewOptions.docMode === exports.DocMode.FormEdit && !ElementUtil.canSetCursor(prevEle, ElementUtil.fixedOffset(prevEle, -1), true, this.viewOptions)) {
|
17864
|
+
this.moveCursorToLeftHandle(prevEle, 0);
|
17865
|
+
return;
|
17866
|
+
}
|
17751
17867
|
this.selectionState.resetRange(prevEle, -1);
|
17752
17868
|
return;
|
17753
17869
|
}
|
@@ -17757,6 +17873,10 @@ class DocumentEvent {
|
|
17757
17873
|
this.selectionState.resetRange(startControl, startOffset - 1);
|
17758
17874
|
}
|
17759
17875
|
else {
|
17876
|
+
if (this.viewOptions.docMode === exports.DocMode.FormEdit && !ElementUtil.canSetCursor(startControl, ElementUtil.fixedOffset(startControl, 0), true, this.viewOptions)) {
|
17877
|
+
this.moveCursorToLeftHandle(startControl, 0);
|
17878
|
+
return;
|
17879
|
+
}
|
17760
17880
|
this.selectionState.resetRange(startControl, 0);
|
17761
17881
|
}
|
17762
17882
|
}
|
@@ -17766,6 +17886,9 @@ class DocumentEvent {
|
|
17766
17886
|
*/
|
17767
17887
|
moveCursorToRight() {
|
17768
17888
|
const { startControl, startOffset } = this.selectionState;
|
17889
|
+
this.moveCursorToRightHandle(startControl, startOffset);
|
17890
|
+
}
|
17891
|
+
moveCursorToRightHandle(startControl, startOffset) {
|
17769
17892
|
if (this.isLeafEleEndOffset(startControl, startOffset)) {
|
17770
17893
|
const oldRegion = ElementUtil.getElementRegion(startControl);
|
17771
17894
|
const nextEle = ElementUtil.getRecursionNextSiblingElement(startControl, false, true, this.viewOptions);
|
@@ -17774,7 +17897,11 @@ class DocumentEvent {
|
|
17774
17897
|
if (oldRegion !== newRegion) {
|
17775
17898
|
return;
|
17776
17899
|
}
|
17777
|
-
this.
|
17900
|
+
if (this.viewOptions.docMode === exports.DocMode.FormEdit && !ElementUtil.canSetCursor(nextEle, ElementUtil.fixedOffset(nextEle, -1), true, this.viewOptions)) {
|
17901
|
+
this.moveCursorToRightHandle(nextEle, ElementUtil.fixedOffset(nextEle, -1));
|
17902
|
+
return;
|
17903
|
+
}
|
17904
|
+
this.selectionState.resetRange(nextEle, 1);
|
17778
17905
|
return;
|
17779
17906
|
}
|
17780
17907
|
}
|
@@ -17783,6 +17910,10 @@ class DocumentEvent {
|
|
17783
17910
|
this.selectionState.resetRange(startControl, startOffset + 1);
|
17784
17911
|
}
|
17785
17912
|
else {
|
17913
|
+
if (this.viewOptions.docMode === exports.DocMode.FormEdit && !ElementUtil.canSetCursor(startControl, 0, true, this.viewOptions)) {
|
17914
|
+
this.moveCursorToRightHandle(startControl, ElementUtil.fixedOffset(startControl, -1));
|
17915
|
+
return;
|
17916
|
+
}
|
17786
17917
|
this.selectionState.resetRange(startControl, 1);
|
17787
17918
|
}
|
17788
17919
|
}
|
@@ -26968,33 +27099,7 @@ class DocEditor {
|
|
26968
27099
|
*/
|
26969
27100
|
canSetCursor() {
|
26970
27101
|
const { startControl, startOffset, editable } = this.selectionState;
|
26971
|
-
|
26972
|
-
return false;
|
26973
|
-
}
|
26974
|
-
if (this.viewOptions.docMode === exports.DocMode.Design) {
|
26975
|
-
return true;
|
26976
|
-
}
|
26977
|
-
//浏览模式
|
26978
|
-
if (this.viewOptions.docMode === exports.DocMode.View) {
|
26979
|
-
return false;
|
26980
|
-
}
|
26981
|
-
//表单模式下,如果不在数据元素中,则不显示光标
|
26982
|
-
if (this.viewOptions.docMode === exports.DocMode.FormEdit) {
|
26983
|
-
if (!IsInSideDataElement(startControl, startOffset)) {
|
26984
|
-
return false;
|
26985
|
-
}
|
26986
|
-
}
|
26987
|
-
if (!ElementUtil.verifyHitable(startControl)) {
|
26988
|
-
return false;
|
26989
|
-
}
|
26990
|
-
//表单模式下,数据元不可编辑
|
26991
|
-
if (this.viewOptions.docMode === exports.DocMode.FormEdit && IsInSideDataElement(startControl, startOffset)) {
|
26992
|
-
const dataEle = ElementUtil.getDataElement(startControl);
|
26993
|
-
if (dataEle && !dataEle.props.editable) {
|
26994
|
-
return false;
|
26995
|
-
}
|
26996
|
-
}
|
26997
|
-
return true;
|
27102
|
+
return ElementUtil.canSetCursor(startControl, startOffset, editable, this.viewOptions);
|
26998
27103
|
}
|
26999
27104
|
/**
|
27000
27105
|
* 修改光标
|
@@ -27488,6 +27593,15 @@ class DocEditor {
|
|
27488
27593
|
const { startControl, startOffset } = this.selectionState;
|
27489
27594
|
this.insertElement(startControl, startOffset, [ele]);
|
27490
27595
|
}
|
27596
|
+
test() {
|
27597
|
+
const text = new TextGroupElement();
|
27598
|
+
text.props.fontName = '宋体';
|
27599
|
+
text.props.fontSize = 14;
|
27600
|
+
text.text = '哈哈';
|
27601
|
+
const br = new BreakElement();
|
27602
|
+
const { startControl, startOffset } = this.selectionState;
|
27603
|
+
this.insertElement(startControl, startOffset, [text, br]);
|
27604
|
+
}
|
27491
27605
|
switchPageLayout(mode) {
|
27492
27606
|
this.viewOptions.pageLayoutMode = mode;
|
27493
27607
|
this.flushToSchedule();
|