@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-cjs.js CHANGED
@@ -4942,6 +4942,9 @@ class DocumentSelection {
4942
4942
  * @private
4943
4943
  */
4944
4944
  updateSelectionState() {
4945
+ if (this.selectionState.startControl && !this.selectionState.startControl.parent) {
4946
+ this.selectionState.clear();
4947
+ }
4945
4948
  if (!this.selectionState.rangeDirty) {
4946
4949
  return false;
4947
4950
  }
@@ -5059,6 +5062,7 @@ class SelectionState {
5059
5062
  this.clear();
5060
5063
  }
5061
5064
  clear() {
5065
+ this.startHitInfo = null;
5062
5066
  this.rangeDirty = true;
5063
5067
  this.range = null;
5064
5068
  this.startOffset = -1;
@@ -8609,6 +8613,10 @@ class DataElementDate extends DataElementInlineGroup {
8609
8613
  return super.cloneSelf(data, DataElementDate);
8610
8614
  }
8611
8615
  setValue(val) {
8616
+ if (val === null) {
8617
+ this.clearInnerItems();
8618
+ return;
8619
+ }
8612
8620
  const format = this.props.format ?? 'YYYY-MM-DD';
8613
8621
  const date = moment__default["default"](val, format);
8614
8622
  if (!date.isValid()) {
@@ -8971,6 +8979,10 @@ class DataElementList extends DataElementInlineGroup {
8971
8979
  return super.cloneSelf(data, DataElementList);
8972
8980
  }
8973
8981
  setValue(vals) {
8982
+ if (vals === null) {
8983
+ this.clearInnerItems();
8984
+ return;
8985
+ }
8974
8986
  if (!Array.isArray(vals)) {
8975
8987
  vals = [vals];
8976
8988
  }
@@ -27257,7 +27269,7 @@ class DocEditor {
27257
27269
  }
27258
27270
  getCursorRect() {
27259
27271
  try {
27260
- if (!this.documentEvent.startHitInfo) {
27272
+ if (!this.selectionState.startHitInfo) {
27261
27273
  return { x: 0, y: 0, width: 0, height: 0 };
27262
27274
  }
27263
27275
  const { startControl, startOffset } = this.selectionState;