@hailin-zheng/editor-core 2.0.20 → 2.0.22
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 +52 -20
- package/index-cjs.js.map +1 -1
- package/index.js +52 -20
- package/index.js.map +1 -1
- package/med_editor/doc-editor.d.ts +4 -0
- package/med_editor/framework/document-event.d.ts +10 -1
- package/package.json +1 -1
package/index.js
CHANGED
@@ -4328,7 +4328,7 @@ class TableCellElement extends BlockContainerElement {
|
|
4328
4328
|
const cellRender = new TableCellRenderObject(this);
|
4329
4329
|
cellRender.rect.width = cellWidth;
|
4330
4330
|
//cellRender.rect.maxWidth = cellWidth;
|
4331
|
-
cellRender.padding = new PaddingProps(0, 0,
|
4331
|
+
cellRender.padding = new PaddingProps(0, 0, 0, 0);
|
4332
4332
|
cellRender.rect.x = cellOffset;
|
4333
4333
|
return cellRender;
|
4334
4334
|
}
|
@@ -13583,8 +13583,10 @@ class DocumentContext {
|
|
13583
13583
|
const dataEle = this.getControlById(id);
|
13584
13584
|
if (dataEle) {
|
13585
13585
|
dataEle.setValue(value);
|
13586
|
+
if (dataEle.isFocused) {
|
13587
|
+
this.ss.clear();
|
13588
|
+
}
|
13586
13589
|
}
|
13587
|
-
this.ss.clear();
|
13588
13590
|
}
|
13589
13591
|
setControlValueByName(name, val) {
|
13590
13592
|
const dataEle = this.getControlByName(name);
|
@@ -17897,6 +17899,23 @@ class DocumentEvent {
|
|
17897
17899
|
}
|
17898
17900
|
}
|
17899
17901
|
}
|
17902
|
+
/**
|
17903
|
+
* 移动光标到下一个数据元素上
|
17904
|
+
*/
|
17905
|
+
moveFocusToNextDataElement() {
|
17906
|
+
if (this.viewOptions.docMode !== DocMode.FormEdit) {
|
17907
|
+
return;
|
17908
|
+
}
|
17909
|
+
const currDataEle = this.getCurrentDataElement();
|
17910
|
+
if (currDataEle) {
|
17911
|
+
if (currDataEle instanceof DataElementLeaf) {
|
17912
|
+
this.moveCursorToRightHandle(currDataEle, 1);
|
17913
|
+
}
|
17914
|
+
else {
|
17915
|
+
this.moveCursorToRightHandle(currDataEle.endDecorate, 1);
|
17916
|
+
}
|
17917
|
+
}
|
17918
|
+
}
|
17900
17919
|
/**
|
17901
17920
|
* 向右移动光标
|
17902
17921
|
*/
|
@@ -18152,6 +18171,30 @@ class DocumentEvent {
|
|
18152
18171
|
this.clicks = 0;
|
18153
18172
|
}
|
18154
18173
|
}
|
18174
|
+
/**
|
18175
|
+
* 获取当前光标所在的数据元
|
18176
|
+
* @returns
|
18177
|
+
*/
|
18178
|
+
getCurrentDataElement() {
|
18179
|
+
const selectionState = this.selectionState;
|
18180
|
+
const { startControl, startOffset, collapsed, ancestorCommonControl } = selectionState;
|
18181
|
+
if (startControl && collapsed) {
|
18182
|
+
if (!ElementUtil.verifyHitable(startControl)) {
|
18183
|
+
return null;
|
18184
|
+
}
|
18185
|
+
const dataEle = ElementUtil.getParent(startControl, validateDataEle);
|
18186
|
+
if (dataEle instanceof DataElementLeaf || IsInSideDataElement(startControl, startOffset)) {
|
18187
|
+
return dataEle;
|
18188
|
+
}
|
18189
|
+
else {
|
18190
|
+
return null;
|
18191
|
+
}
|
18192
|
+
}
|
18193
|
+
else if (!collapsed && ancestorCommonControl) {
|
18194
|
+
return ElementUtil.getParent(ancestorCommonControl, validateDataEle);
|
18195
|
+
}
|
18196
|
+
return null;
|
18197
|
+
}
|
18155
18198
|
}
|
18156
18199
|
|
18157
18200
|
/**
|
@@ -27234,24 +27277,13 @@ class DocEditor {
|
|
27234
27277
|
* @returns
|
27235
27278
|
*/
|
27236
27279
|
getCurrentDataElement() {
|
27237
|
-
|
27238
|
-
|
27239
|
-
|
27240
|
-
|
27241
|
-
|
27242
|
-
|
27243
|
-
|
27244
|
-
if (dataEle instanceof DataElementLeaf || IsInSideDataElement(startControl, startOffset)) {
|
27245
|
-
return dataEle;
|
27246
|
-
}
|
27247
|
-
else {
|
27248
|
-
return null;
|
27249
|
-
}
|
27250
|
-
}
|
27251
|
-
else if (!collapsed && ancestorCommonControl) {
|
27252
|
-
return ElementUtil.getParent(ancestorCommonControl, validateDataEle);
|
27253
|
-
}
|
27254
|
-
return null;
|
27280
|
+
return this.documentEvent.getCurrentDataElement();
|
27281
|
+
}
|
27282
|
+
/**
|
27283
|
+
* 移动光标到下一个数据元素上
|
27284
|
+
*/
|
27285
|
+
moveFocusToNextDataElement() {
|
27286
|
+
this.documentEvent.moveFocusToNextDataElement();
|
27255
27287
|
}
|
27256
27288
|
/**
|
27257
27289
|
* 设置当前光标所在的数据元的值
|