@use-kona/editor 0.1.24-dnd.1 → 0.1.24-dnd.3
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.
|
@@ -98,13 +98,13 @@ class DnDPlugin {
|
|
|
98
98
|
const hoverClientY = clientOffset.y - hoverBoundingRect.top;
|
|
99
99
|
hoverClientY < hoverMiddleY ? setDropPosition('top') : setDropPosition('bottom');
|
|
100
100
|
},
|
|
101
|
-
drop (item, monitor)
|
|
101
|
+
drop: (item, monitor)=>{
|
|
102
102
|
const itemType = monitor.getItemType();
|
|
103
103
|
const sourceTo = ReactEditor.findPath(editor, props.element);
|
|
104
104
|
if (!sourceTo) return;
|
|
105
105
|
const insertAt = getDropPath(editor, sourceTo, dropPosition || 'bottom');
|
|
106
106
|
if (!insertAt) return;
|
|
107
|
-
const customDropHandler = itemType && options.customDropHandlers?.[itemType];
|
|
107
|
+
const customDropHandler = itemType && this.options.customDropHandlers?.[itemType];
|
|
108
108
|
if (customDropHandler) {
|
|
109
109
|
console.log('customDropHandler.onDrop', itemType);
|
|
110
110
|
customDropHandler.onDrop({
|
|
@@ -115,6 +115,7 @@ class DnDPlugin {
|
|
|
115
115
|
return;
|
|
116
116
|
}
|
|
117
117
|
console.log('customDropHandler not found', itemType);
|
|
118
|
+
this.options.customDropHandlers && console.log('valid drop handlers are', Object.keys(this.options.customDropHandlers));
|
|
118
119
|
switch(itemType){
|
|
119
120
|
case NativeTypes.FILE:
|
|
120
121
|
options.onDropFiles(editor, item.files, insertAt);
|
package/package.json
CHANGED
|
@@ -151,7 +151,7 @@ export class DnDPlugin implements IPlugin {
|
|
|
151
151
|
setDropPosition('bottom');
|
|
152
152
|
}
|
|
153
153
|
},
|
|
154
|
-
drop(item, monitor) {
|
|
154
|
+
drop: (item, monitor) => {
|
|
155
155
|
const itemType = monitor.getItemType();
|
|
156
156
|
|
|
157
157
|
const sourceTo = ReactEditor.findPath(editor, props.element);
|
|
@@ -167,7 +167,7 @@ export class DnDPlugin implements IPlugin {
|
|
|
167
167
|
if (!insertAt) return;
|
|
168
168
|
|
|
169
169
|
const customDropHandler =
|
|
170
|
-
itemType && options.customDropHandlers?.[itemType];
|
|
170
|
+
itemType && this.options.customDropHandlers?.[itemType];
|
|
171
171
|
|
|
172
172
|
if (customDropHandler) {
|
|
173
173
|
console.log('customDropHandler.onDrop', itemType);
|
|
@@ -175,6 +175,11 @@ export class DnDPlugin implements IPlugin {
|
|
|
175
175
|
return;
|
|
176
176
|
} else {
|
|
177
177
|
console.log('customDropHandler not found', itemType);
|
|
178
|
+
this.options.customDropHandlers &&
|
|
179
|
+
console.log(
|
|
180
|
+
'valid drop handlers are',
|
|
181
|
+
Object.keys(this.options.customDropHandlers),
|
|
182
|
+
);
|
|
178
183
|
}
|
|
179
184
|
|
|
180
185
|
switch (itemType) {
|