@easy-editor/core 0.0.9 → 0.0.11

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.
@@ -74,8 +74,9 @@ export declare class Dragon {
74
74
  * boost your dragObject for dragging(flying)
75
75
  * @param dragObject drag object
76
76
  * @param boostEvent drag start event
77
+ * @param shell shell element(which trigger the boost)
77
78
  */
78
- boost(dragObject: DragObject, boostEvent: MouseEvent | DragEvent): void;
79
+ boost(dragObject: DragObject, boostEvent: MouseEvent | DragEvent, shell?: HTMLElement): void;
79
80
  /**
80
81
  * get master sensors(opened documents)
81
82
  */
@@ -92,7 +93,13 @@ export declare class Dragon {
92
93
  * 移除投放感应
93
94
  */
94
95
  removeSensor(sensor: Sensor): void;
95
- onDragstart(func: (e: LocateEvent) => void): () => void;
96
+ onDragstart(func: (e: LocateEvent & {
97
+ /**
98
+ * 触发拖拽的元素
99
+ * @description 目前用于 Snippet
100
+ */
101
+ shell?: HTMLElement;
102
+ }) => void): () => void;
96
103
  onDrag(func: (e: LocateEvent) => void): () => void;
97
104
  onDragend(func: (e: {
98
105
  dragObject: DragObject;
@@ -114,6 +114,7 @@ export declare class Node<Schema extends NodeSchema = NodeSchema> {
114
114
  setPropValue(path: string, value: PropValue): void;
115
115
  getExtraPropValue(key: string): unknown;
116
116
  setExtraPropValue(key: string, value: PropValue): void;
117
+ clearExtraPropValue(key: string): void;
117
118
  clearPropValue(path: string): void;
118
119
  mergeProps(props: PropsMap): void;
119
120
  setProps(props?: PropsMap | Props | null): void;
@@ -6907,9 +6907,6 @@ class NodeChildren {
6907
6907
  if (i === index) {
6908
6908
  return;
6909
6909
  }
6910
- if (index === i) {
6911
- return;
6912
- }
6913
6910
  children.splice(index, 1);
6914
6911
  children.splice(i, 0, node);
6915
6912
  }
@@ -7328,6 +7325,9 @@ let Node$1 = class Node {
7328
7325
  setExtraPropValue(key, value) {
7329
7326
  this.setPropValue(getConvertedExtraKey(key), value);
7330
7327
  }
7328
+ clearExtraPropValue(key) {
7329
+ this.getProp(getConvertedExtraKey(key), false)?.unset();
7330
+ }
7331
7331
  clearPropValue(path) {
7332
7332
  this.getProp(path, false)?.unset();
7333
7333
  }
@@ -7382,7 +7382,7 @@ let Node$1 = class Node {
7382
7382
  return false;
7383
7383
  }
7384
7384
  insert(node, ref, useMutator = true) {
7385
- if (ref && typeof ref === 'number') {
7385
+ if (ref !== undefined && typeof ref === 'number') {
7386
7386
  const nodeInstance = ensureNode(node, this.document);
7387
7387
  this.children?.internalInsert(nodeInstance, ref, useMutator);
7388
7388
  } else {
@@ -9023,7 +9023,7 @@ class Dragon {
9023
9023
  if (!dragObject) {
9024
9024
  return;
9025
9025
  }
9026
- this.boost(dragObject, e);
9026
+ this.boost(dragObject, e, shell);
9027
9027
  };
9028
9028
  if (eventType === 'drag') {
9029
9029
  shell.draggable = true;
@@ -9039,7 +9039,7 @@ class Dragon {
9039
9039
  };
9040
9040
  }
9041
9041
  }
9042
- boost(dragObject, boostEvent) {
9042
+ boost(dragObject, boostEvent, shell) {
9043
9043
  const {
9044
9044
  designer
9045
9045
  } = this;
@@ -9087,7 +9087,10 @@ class Dragon {
9087
9087
  doc.addEventListener('keydown', checkEsc, false);
9088
9088
  });
9089
9089
  }
9090
- this.emitter.emit(DRAGON_EVENT.DRAGSTART, locateEvent);
9090
+ this.emitter.emit(DRAGON_EVENT.DRAGSTART, {
9091
+ ...locateEvent,
9092
+ shell
9093
+ });
9091
9094
  };
9092
9095
  const move = e => {
9093
9096
  if (isBoostFromDragAPI) {