@use-kona/editor 0.1.24-dnd.5 → 0.1.24-dnd.6

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.
@@ -55,12 +55,14 @@ class DnDPlugin {
55
55
  const nodes = selected.length > 0 && selected.includes(currentElement.nodeId) ? getNodesByNodeIds(editor, selected) : [
56
56
  structuredClone(props.element)
57
57
  ];
58
+ const item = this.options.customTypes?.[currentElement.type].getData?.(currentElement);
58
59
  const items = nodes.map((node)=>{
59
60
  if (this.options.customTypes?.[node.type]) return this.options.customTypes[node.type].getData?.(node);
60
61
  return null;
61
62
  }).filter(Boolean);
62
63
  const dragItem = {
63
64
  nodes,
65
+ item,
64
66
  items,
65
67
  source: {
66
68
  editorId: this.getEditorId(editor),
@@ -44,6 +44,7 @@ type DropResult = 'handled' | 'ignored';
44
44
  */
45
45
  export type EditorDragItem = {
46
46
  nodes: NodeWithId[];
47
+ item?: unknown;
47
48
  items?: unknown[];
48
49
  source: {
49
50
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@use-kona/editor",
3
- "version": "0.1.24-dnd.5",
3
+ "version": "0.1.24-dnd.6",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./src/index.ts"
@@ -90,6 +90,11 @@ export class DnDPlugin implements IPlugin {
90
90
  ? getNodesByNodeIds(editor, selected)
91
91
  : [structuredClone(props.element as NodeWithId)];
92
92
 
93
+ const item =
94
+ this.options.customTypes?.[currentElement.type].getData?.(
95
+ currentElement,
96
+ );
97
+
93
98
  const items = nodes
94
99
  .map((node) => {
95
100
  if (this.options.customTypes?.[node.type]) {
@@ -101,6 +106,7 @@ export class DnDPlugin implements IPlugin {
101
106
 
102
107
  const dragItem: EditorDragItem = {
103
108
  nodes,
109
+ item,
104
110
  items,
105
111
  source: {
106
112
  editorId: this.getEditorId(editor),
@@ -59,6 +59,7 @@ type DropResult = 'handled' | 'ignored';
59
59
  */
60
60
  export type EditorDragItem = {
61
61
  nodes: NodeWithId[];
62
+ item?: unknown;
62
63
  items?: unknown[];
63
64
  source: {
64
65
  /**