@portabletext/editor 1.41.0 → 1.41.1
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/lib/index.cjs +9 -71
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +9 -71
- package/lib/index.js.map +1 -1
- package/package.json +3 -3
- package/src/editor/Editable.tsx +0 -41
package/lib/index.cjs
CHANGED
|
@@ -1227,28 +1227,11 @@ const debug = editorProvider.debugWithName("component:Editable"), PLACEHOLDER_ST
|
|
|
1227
1227
|
editor: slateEditor
|
|
1228
1228
|
});
|
|
1229
1229
|
}, [onDragStart, editorActor, slateEditor]), handleDrag = React.useCallback((event_9) => {
|
|
1230
|
-
|
|
1231
|
-
return;
|
|
1232
|
-
event_9.stopPropagation();
|
|
1233
|
-
const position_5 = getEventPosition({
|
|
1230
|
+
onDrag?.(event_9), !(event_9.isDefaultPrevented() || event_9.isPropagationStopped() || (event_9.stopPropagation(), !getEventPosition({
|
|
1234
1231
|
schema: editorActor.getSnapshot().context.schema,
|
|
1235
1232
|
slateEditor,
|
|
1236
1233
|
event: event_9.nativeEvent
|
|
1237
|
-
})
|
|
1238
|
-
if (!position_5)
|
|
1239
|
-
return;
|
|
1240
|
-
const snapshot_0 = editorProvider.getEditorSnapshot({
|
|
1241
|
-
editorActorSnapshot: editorActor.getSnapshot(),
|
|
1242
|
-
slateEditorInstance: slateEditor
|
|
1243
|
-
});
|
|
1244
|
-
if (draggingOnDragOrigin({
|
|
1245
|
-
snapshot: snapshot_0,
|
|
1246
|
-
position: position_5
|
|
1247
|
-
})) {
|
|
1248
|
-
event_9.preventDefault();
|
|
1249
|
-
return;
|
|
1250
|
-
}
|
|
1251
|
-
editorActor.send({
|
|
1234
|
+
}))) && editorActor.send({
|
|
1252
1235
|
type: "behavior event",
|
|
1253
1236
|
behaviorEvent: {
|
|
1254
1237
|
type: "drag.drag",
|
|
@@ -1278,20 +1261,7 @@ const debug = editorProvider.debugWithName("component:Editable"), PLACEHOLDER_ST
|
|
|
1278
1261
|
slateEditor,
|
|
1279
1262
|
event: event_11.nativeEvent
|
|
1280
1263
|
});
|
|
1281
|
-
|
|
1282
|
-
return;
|
|
1283
|
-
const snapshot_1 = editorProvider.getEditorSnapshot({
|
|
1284
|
-
editorActorSnapshot: editorActor.getSnapshot(),
|
|
1285
|
-
slateEditorInstance: slateEditor
|
|
1286
|
-
});
|
|
1287
|
-
if (draggingOnDragOrigin({
|
|
1288
|
-
snapshot: snapshot_1,
|
|
1289
|
-
position: position_6
|
|
1290
|
-
})) {
|
|
1291
|
-
event_11.preventDefault();
|
|
1292
|
-
return;
|
|
1293
|
-
}
|
|
1294
|
-
editorActor.send({
|
|
1264
|
+
position_6 && editorActor.send({
|
|
1295
1265
|
type: "behavior event",
|
|
1296
1266
|
behaviorEvent: {
|
|
1297
1267
|
type: "drag.dragenter",
|
|
@@ -1313,18 +1283,14 @@ const debug = editorProvider.debugWithName("component:Editable"), PLACEHOLDER_ST
|
|
|
1313
1283
|
});
|
|
1314
1284
|
if (!position_7)
|
|
1315
1285
|
return;
|
|
1316
|
-
const
|
|
1286
|
+
const snapshot_0 = editorProvider.getEditorSnapshot({
|
|
1317
1287
|
editorActorSnapshot: editorActor.getSnapshot(),
|
|
1318
1288
|
slateEditorInstance: slateEditor
|
|
1319
1289
|
});
|
|
1320
|
-
|
|
1321
|
-
snapshot:
|
|
1290
|
+
draggingOnDragOrigin({
|
|
1291
|
+
snapshot: snapshot_0,
|
|
1322
1292
|
position: position_7
|
|
1323
|
-
})) {
|
|
1324
|
-
event_12.preventDefault();
|
|
1325
|
-
return;
|
|
1326
|
-
}
|
|
1327
|
-
editorActor.send({
|
|
1293
|
+
}) && event_12.preventDefault(), editorActor.send({
|
|
1328
1294
|
type: "behavior event",
|
|
1329
1295
|
behaviorEvent: {
|
|
1330
1296
|
type: "drag.dragover",
|
|
@@ -1349,17 +1315,6 @@ const debug = editorProvider.debugWithName("component:Editable"), PLACEHOLDER_ST
|
|
|
1349
1315
|
console.warn("Could not find position for drop event");
|
|
1350
1316
|
return;
|
|
1351
1317
|
}
|
|
1352
|
-
const snapshot_3 = editorProvider.getEditorSnapshot({
|
|
1353
|
-
editorActorSnapshot: editorActor.getSnapshot(),
|
|
1354
|
-
slateEditorInstance: slateEditor
|
|
1355
|
-
});
|
|
1356
|
-
if (draggingOnDragOrigin({
|
|
1357
|
-
snapshot: snapshot_3,
|
|
1358
|
-
position: position_8
|
|
1359
|
-
})) {
|
|
1360
|
-
event_13.preventDefault();
|
|
1361
|
-
return;
|
|
1362
|
-
}
|
|
1363
1318
|
editorActor.send({
|
|
1364
1319
|
type: "behavior event",
|
|
1365
1320
|
behaviorEvent: {
|
|
@@ -1379,28 +1334,11 @@ const debug = editorProvider.debugWithName("component:Editable"), PLACEHOLDER_ST
|
|
|
1379
1334
|
editor: slateEditor
|
|
1380
1335
|
});
|
|
1381
1336
|
}, [onDrop, editorActor, slateEditor]), handleDragLeave = React.useCallback((event_14) => {
|
|
1382
|
-
|
|
1383
|
-
return;
|
|
1384
|
-
event_14.stopPropagation();
|
|
1385
|
-
const position_9 = getEventPosition({
|
|
1337
|
+
onDragLeave?.(event_14), !(event_14.isDefaultPrevented() || event_14.isPropagationStopped() || (event_14.stopPropagation(), !getEventPosition({
|
|
1386
1338
|
schema: editorActor.getSnapshot().context.schema,
|
|
1387
1339
|
slateEditor,
|
|
1388
1340
|
event: event_14.nativeEvent
|
|
1389
|
-
})
|
|
1390
|
-
if (!position_9)
|
|
1391
|
-
return;
|
|
1392
|
-
const snapshot_4 = editorProvider.getEditorSnapshot({
|
|
1393
|
-
editorActorSnapshot: editorActor.getSnapshot(),
|
|
1394
|
-
slateEditorInstance: slateEditor
|
|
1395
|
-
});
|
|
1396
|
-
if (draggingOnDragOrigin({
|
|
1397
|
-
snapshot: snapshot_4,
|
|
1398
|
-
position: position_9
|
|
1399
|
-
})) {
|
|
1400
|
-
event_14.preventDefault();
|
|
1401
|
-
return;
|
|
1402
|
-
}
|
|
1403
|
-
editorActor.send({
|
|
1341
|
+
}))) && editorActor.send({
|
|
1404
1342
|
type: "behavior event",
|
|
1405
1343
|
behaviorEvent: {
|
|
1406
1344
|
type: "drag.dragleave",
|