@portabletext/editor 1.41.0 → 1.41.2
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/_chunks-cjs/behavior.core.cjs.map +1 -1
- package/lib/_chunks-cjs/editor-provider.cjs +19 -5
- package/lib/_chunks-cjs/editor-provider.cjs.map +1 -1
- package/lib/_chunks-es/behavior.core.js.map +1 -1
- package/lib/_chunks-es/editor-provider.js +19 -5
- package/lib/_chunks-es/editor-provider.js.map +1 -1
- package/lib/behaviors/index.d.cts +3093 -3071
- package/lib/behaviors/index.d.ts +3093 -3071
- package/lib/index.cjs +9 -71
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +2795 -2772
- package/lib/index.d.ts +2795 -2772
- package/lib/index.js +9 -71
- package/lib/index.js.map +1 -1
- package/lib/plugins/index.d.cts +2795 -2772
- package/lib/plugins/index.d.ts +2795 -2772
- package/lib/selectors/index.d.cts +2782 -2759
- package/lib/selectors/index.d.ts +2782 -2759
- package/lib/utils/index.d.cts +2782 -2759
- package/lib/utils/index.d.ts +2782 -2759
- package/package.json +3 -3
- package/src/behaviors/behavior.types.ts +151 -108
- package/src/editor/Editable.tsx +0 -41
- package/src/editor/create-editor.ts +2 -2
- package/src/editor/editor-machine.ts +16 -6
- package/src/internal-utils/slate-utils.ts +7 -3
package/lib/index.js
CHANGED
|
@@ -1239,28 +1239,11 @@ const debug = debugWithName("component:Editable"), PLACEHOLDER_STYLE = {
|
|
|
1239
1239
|
editor: slateEditor
|
|
1240
1240
|
});
|
|
1241
1241
|
}, [onDragStart, editorActor, slateEditor]), handleDrag = useCallback((event_9) => {
|
|
1242
|
-
|
|
1243
|
-
return;
|
|
1244
|
-
event_9.stopPropagation();
|
|
1245
|
-
const position_5 = getEventPosition({
|
|
1242
|
+
onDrag?.(event_9), !(event_9.isDefaultPrevented() || event_9.isPropagationStopped() || (event_9.stopPropagation(), !getEventPosition({
|
|
1246
1243
|
schema: editorActor.getSnapshot().context.schema,
|
|
1247
1244
|
slateEditor,
|
|
1248
1245
|
event: event_9.nativeEvent
|
|
1249
|
-
})
|
|
1250
|
-
if (!position_5)
|
|
1251
|
-
return;
|
|
1252
|
-
const snapshot_0 = getEditorSnapshot({
|
|
1253
|
-
editorActorSnapshot: editorActor.getSnapshot(),
|
|
1254
|
-
slateEditorInstance: slateEditor
|
|
1255
|
-
});
|
|
1256
|
-
if (draggingOnDragOrigin({
|
|
1257
|
-
snapshot: snapshot_0,
|
|
1258
|
-
position: position_5
|
|
1259
|
-
})) {
|
|
1260
|
-
event_9.preventDefault();
|
|
1261
|
-
return;
|
|
1262
|
-
}
|
|
1263
|
-
editorActor.send({
|
|
1246
|
+
}))) && editorActor.send({
|
|
1264
1247
|
type: "behavior event",
|
|
1265
1248
|
behaviorEvent: {
|
|
1266
1249
|
type: "drag.drag",
|
|
@@ -1290,20 +1273,7 @@ const debug = debugWithName("component:Editable"), PLACEHOLDER_STYLE = {
|
|
|
1290
1273
|
slateEditor,
|
|
1291
1274
|
event: event_11.nativeEvent
|
|
1292
1275
|
});
|
|
1293
|
-
|
|
1294
|
-
return;
|
|
1295
|
-
const snapshot_1 = getEditorSnapshot({
|
|
1296
|
-
editorActorSnapshot: editorActor.getSnapshot(),
|
|
1297
|
-
slateEditorInstance: slateEditor
|
|
1298
|
-
});
|
|
1299
|
-
if (draggingOnDragOrigin({
|
|
1300
|
-
snapshot: snapshot_1,
|
|
1301
|
-
position: position_6
|
|
1302
|
-
})) {
|
|
1303
|
-
event_11.preventDefault();
|
|
1304
|
-
return;
|
|
1305
|
-
}
|
|
1306
|
-
editorActor.send({
|
|
1276
|
+
position_6 && editorActor.send({
|
|
1307
1277
|
type: "behavior event",
|
|
1308
1278
|
behaviorEvent: {
|
|
1309
1279
|
type: "drag.dragenter",
|
|
@@ -1325,18 +1295,14 @@ const debug = debugWithName("component:Editable"), PLACEHOLDER_STYLE = {
|
|
|
1325
1295
|
});
|
|
1326
1296
|
if (!position_7)
|
|
1327
1297
|
return;
|
|
1328
|
-
const
|
|
1298
|
+
const snapshot_0 = getEditorSnapshot({
|
|
1329
1299
|
editorActorSnapshot: editorActor.getSnapshot(),
|
|
1330
1300
|
slateEditorInstance: slateEditor
|
|
1331
1301
|
});
|
|
1332
|
-
|
|
1333
|
-
snapshot:
|
|
1302
|
+
draggingOnDragOrigin({
|
|
1303
|
+
snapshot: snapshot_0,
|
|
1334
1304
|
position: position_7
|
|
1335
|
-
})) {
|
|
1336
|
-
event_12.preventDefault();
|
|
1337
|
-
return;
|
|
1338
|
-
}
|
|
1339
|
-
editorActor.send({
|
|
1305
|
+
}) && event_12.preventDefault(), editorActor.send({
|
|
1340
1306
|
type: "behavior event",
|
|
1341
1307
|
behaviorEvent: {
|
|
1342
1308
|
type: "drag.dragover",
|
|
@@ -1361,17 +1327,6 @@ const debug = debugWithName("component:Editable"), PLACEHOLDER_STYLE = {
|
|
|
1361
1327
|
console.warn("Could not find position for drop event");
|
|
1362
1328
|
return;
|
|
1363
1329
|
}
|
|
1364
|
-
const snapshot_3 = getEditorSnapshot({
|
|
1365
|
-
editorActorSnapshot: editorActor.getSnapshot(),
|
|
1366
|
-
slateEditorInstance: slateEditor
|
|
1367
|
-
});
|
|
1368
|
-
if (draggingOnDragOrigin({
|
|
1369
|
-
snapshot: snapshot_3,
|
|
1370
|
-
position: position_8
|
|
1371
|
-
})) {
|
|
1372
|
-
event_13.preventDefault();
|
|
1373
|
-
return;
|
|
1374
|
-
}
|
|
1375
1330
|
editorActor.send({
|
|
1376
1331
|
type: "behavior event",
|
|
1377
1332
|
behaviorEvent: {
|
|
@@ -1391,28 +1346,11 @@ const debug = debugWithName("component:Editable"), PLACEHOLDER_STYLE = {
|
|
|
1391
1346
|
editor: slateEditor
|
|
1392
1347
|
});
|
|
1393
1348
|
}, [onDrop, editorActor, slateEditor]), handleDragLeave = useCallback((event_14) => {
|
|
1394
|
-
|
|
1395
|
-
return;
|
|
1396
|
-
event_14.stopPropagation();
|
|
1397
|
-
const position_9 = getEventPosition({
|
|
1349
|
+
onDragLeave?.(event_14), !(event_14.isDefaultPrevented() || event_14.isPropagationStopped() || (event_14.stopPropagation(), !getEventPosition({
|
|
1398
1350
|
schema: editorActor.getSnapshot().context.schema,
|
|
1399
1351
|
slateEditor,
|
|
1400
1352
|
event: event_14.nativeEvent
|
|
1401
|
-
})
|
|
1402
|
-
if (!position_9)
|
|
1403
|
-
return;
|
|
1404
|
-
const snapshot_4 = getEditorSnapshot({
|
|
1405
|
-
editorActorSnapshot: editorActor.getSnapshot(),
|
|
1406
|
-
slateEditorInstance: slateEditor
|
|
1407
|
-
});
|
|
1408
|
-
if (draggingOnDragOrigin({
|
|
1409
|
-
snapshot: snapshot_4,
|
|
1410
|
-
position: position_9
|
|
1411
|
-
})) {
|
|
1412
|
-
event_14.preventDefault();
|
|
1413
|
-
return;
|
|
1414
|
-
}
|
|
1415
|
-
editorActor.send({
|
|
1353
|
+
}))) && editorActor.send({
|
|
1416
1354
|
type: "behavior event",
|
|
1417
1355
|
behaviorEvent: {
|
|
1418
1356
|
type: "drag.dragleave",
|