@hailin-zheng/editor-core 2.0.30 → 2.0.31

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.js CHANGED
@@ -4912,6 +4912,9 @@ class DocumentSelection {
4912
4912
  * @private
4913
4913
  */
4914
4914
  updateSelectionState() {
4915
+ if (this.selectionState.startControl && !this.selectionState.startControl.parent) {
4916
+ this.selectionState.clear();
4917
+ }
4915
4918
  if (!this.selectionState.rangeDirty) {
4916
4919
  return false;
4917
4920
  }
@@ -5029,6 +5032,7 @@ class SelectionState {
5029
5032
  this.clear();
5030
5033
  }
5031
5034
  clear() {
5035
+ this.startHitInfo = null;
5032
5036
  this.rangeDirty = true;
5033
5037
  this.range = null;
5034
5038
  this.startOffset = -1;
@@ -8579,6 +8583,10 @@ class DataElementDate extends DataElementInlineGroup {
8579
8583
  return super.cloneSelf(data, DataElementDate);
8580
8584
  }
8581
8585
  setValue(val) {
8586
+ if (val === null) {
8587
+ this.clearInnerItems();
8588
+ return;
8589
+ }
8582
8590
  const format = this.props.format ?? 'YYYY-MM-DD';
8583
8591
  const date = moment(val, format);
8584
8592
  if (!date.isValid()) {
@@ -8941,6 +8949,10 @@ class DataElementList extends DataElementInlineGroup {
8941
8949
  return super.cloneSelf(data, DataElementList);
8942
8950
  }
8943
8951
  setValue(vals) {
8952
+ if (vals === null) {
8953
+ this.clearInnerItems();
8954
+ return;
8955
+ }
8944
8956
  if (!Array.isArray(vals)) {
8945
8957
  vals = [vals];
8946
8958
  }
@@ -27227,7 +27239,7 @@ class DocEditor {
27227
27239
  }
27228
27240
  getCursorRect() {
27229
27241
  try {
27230
- if (!this.documentEvent.startHitInfo) {
27242
+ if (!this.selectionState.startHitInfo) {
27231
27243
  return { x: 0, y: 0, width: 0, height: 0 };
27232
27244
  }
27233
27245
  const { startControl, startOffset } = this.selectionState;