@portabletext/editor 1.38.1 → 1.39.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/_chunks-cjs/behavior.core.cjs +28 -17
- package/lib/_chunks-cjs/behavior.core.cjs.map +1 -1
- package/lib/_chunks-cjs/behavior.markdown.cjs +2 -2
- package/lib/_chunks-cjs/behavior.markdown.cjs.map +1 -1
- package/lib/_chunks-cjs/editor-provider.cjs +51 -71
- package/lib/_chunks-cjs/editor-provider.cjs.map +1 -1
- package/lib/_chunks-cjs/selector.get-text-before.cjs +0 -1
- package/lib/_chunks-cjs/selector.get-text-before.cjs.map +1 -1
- package/lib/_chunks-cjs/selector.is-at-the-start-of-block.cjs +0 -3
- package/lib/_chunks-cjs/selector.is-at-the-start-of-block.cjs.map +1 -1
- package/lib/_chunks-cjs/selector.is-overlapping-selection.cjs +0 -4
- package/lib/_chunks-cjs/selector.is-overlapping-selection.cjs.map +1 -1
- package/lib/_chunks-es/behavior.core.js +29 -18
- package/lib/_chunks-es/behavior.core.js.map +1 -1
- package/lib/_chunks-es/behavior.markdown.js +2 -2
- package/lib/_chunks-es/behavior.markdown.js.map +1 -1
- package/lib/_chunks-es/editor-provider.js +55 -75
- package/lib/_chunks-es/editor-provider.js.map +1 -1
- package/lib/_chunks-es/selector.get-text-before.js +1 -2
- package/lib/_chunks-es/selector.get-text-before.js.map +1 -1
- package/lib/_chunks-es/selector.is-at-the-start-of-block.js +1 -4
- package/lib/_chunks-es/selector.is-at-the-start-of-block.js.map +1 -1
- package/lib/_chunks-es/selector.is-overlapping-selection.js +1 -5
- package/lib/_chunks-es/selector.is-overlapping-selection.js.map +1 -1
- package/lib/behaviors/index.cjs +12 -12
- package/lib/behaviors/index.cjs.map +1 -1
- package/lib/behaviors/index.d.cts +2028 -2508
- package/lib/behaviors/index.d.ts +2028 -2508
- package/lib/behaviors/index.js +12 -12
- package/lib/behaviors/index.js.map +1 -1
- package/lib/index.cjs +41 -25
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +1489 -2141
- package/lib/index.d.ts +1489 -2141
- package/lib/index.js +41 -25
- package/lib/index.js.map +1 -1
- package/lib/plugins/index.cjs +0 -1
- package/lib/plugins/index.cjs.map +1 -1
- package/lib/plugins/index.d.cts +1489 -2141
- package/lib/plugins/index.d.ts +1489 -2141
- package/lib/plugins/index.js +1 -2
- package/lib/plugins/index.js.map +1 -1
- package/lib/selectors/index.d.cts +1488 -2140
- package/lib/selectors/index.d.ts +1488 -2140
- package/lib/utils/index.d.cts +1488 -2140
- package/lib/utils/index.d.ts +1488 -2140
- package/package.json +5 -5
- package/src/behavior-actions/behavior.action.serialization.success.ts +4 -1
- package/src/behaviors/behavior.code-editor.ts +4 -4
- package/src/behaviors/behavior.core.block-objects.ts +4 -4
- package/src/behaviors/behavior.core.decorators.ts +8 -8
- package/src/behaviors/behavior.core.lists.ts +4 -4
- package/src/behaviors/behavior.default.raise-soft-break.ts +3 -3
- package/src/behaviors/behavior.default.ts +33 -20
- package/src/behaviors/behavior.emoji-picker.ts +6 -6
- package/src/behaviors/behavior.links.ts +4 -4
- package/src/behaviors/behavior.markdown.ts +2 -2
- package/src/behaviors/behavior.types.ts +163 -80
- package/src/converters/converter.text-html.serialize.test.ts +4 -4
- package/src/converters/converter.text-plain.test.ts +6 -6
- package/src/converters/converter.types.ts +3 -3
- package/src/editor/Editable.tsx +41 -19
- package/src/editor/editor-machine.ts +33 -7
- package/src/editor/plugins/create-with-event-listeners.ts +18 -3
|
@@ -193,7 +193,7 @@ function toSlateRange(selection, editor) {
|
|
|
193
193
|
path: toSlatePath(selection.focus.path, editor),
|
|
194
194
|
offset: selection.focus.offset
|
|
195
195
|
};
|
|
196
|
-
return focus.path.length === 0 || anchor.path.length === 0 ? null : focus ? {
|
|
196
|
+
return focus.path.length === 0 || anchor.path.length === 0 ? null : anchor && focus ? {
|
|
197
197
|
anchor,
|
|
198
198
|
focus
|
|
199
199
|
} : null;
|
|
@@ -2922,14 +2922,12 @@ const insertBreakActionImplementation = ({
|
|
|
2922
2922
|
}) ? removeListItemActionImplementation({
|
|
2923
2923
|
context,
|
|
2924
2924
|
action: {
|
|
2925
|
-
...action
|
|
2926
|
-
type: "list item.remove"
|
|
2925
|
+
...action
|
|
2927
2926
|
}
|
|
2928
2927
|
}) : addListItemActionImplementation({
|
|
2929
2928
|
context,
|
|
2930
2929
|
action: {
|
|
2931
|
-
...action
|
|
2932
|
-
type: "list item.add"
|
|
2930
|
+
...action
|
|
2933
2931
|
}
|
|
2934
2932
|
});
|
|
2935
2933
|
}, removeListItemActionImplementation = ({
|
|
@@ -2986,14 +2984,12 @@ const toggleStyleActionImplementation = ({
|
|
|
2986
2984
|
}) ? removeStyleActionImplementation({
|
|
2987
2985
|
context,
|
|
2988
2986
|
action: {
|
|
2989
|
-
...action
|
|
2990
|
-
type: "style.remove"
|
|
2987
|
+
...action
|
|
2991
2988
|
}
|
|
2992
2989
|
}) : addStyleActionImplementation({
|
|
2993
2990
|
context,
|
|
2994
2991
|
action: {
|
|
2995
|
-
...action
|
|
2996
|
-
type: "style.add"
|
|
2992
|
+
...action
|
|
2997
2993
|
}
|
|
2998
2994
|
});
|
|
2999
2995
|
}, removeStyleActionImplementation = ({
|
|
@@ -3098,10 +3094,6 @@ const decoratorAddActionImplementation = ({
|
|
|
3098
3094
|
},
|
|
3099
3095
|
backward: editorSelection?.backward
|
|
3100
3096
|
}), trimmedSelection = selector_isOverlappingSelection.getTrimmedSelection({
|
|
3101
|
-
beta: {
|
|
3102
|
-
hasTag: () => !1,
|
|
3103
|
-
internalDrag: void 0
|
|
3104
|
-
},
|
|
3105
3097
|
context: {
|
|
3106
3098
|
activeDecorators: [],
|
|
3107
3099
|
converters: [],
|
|
@@ -3626,16 +3618,13 @@ const toggleDecoratorActionImplementation = ({
|
|
|
3626
3618
|
editor: action.editor,
|
|
3627
3619
|
decorator: action.decorator
|
|
3628
3620
|
}) ? removeDecoratorActionImplementation({
|
|
3629
|
-
context,
|
|
3630
3621
|
action: {
|
|
3631
|
-
type: "decorator.remove",
|
|
3632
3622
|
editor: action.editor,
|
|
3633
3623
|
decorator: action.decorator
|
|
3634
3624
|
}
|
|
3635
3625
|
}) : decoratorAddActionImplementation({
|
|
3636
3626
|
context,
|
|
3637
3627
|
action: {
|
|
3638
|
-
type: "decorator.add",
|
|
3639
3628
|
editor: action.editor,
|
|
3640
3629
|
decorator: action.decorator
|
|
3641
3630
|
}
|
|
@@ -3896,7 +3885,6 @@ function createEditableAPI(editor, editorActor) {
|
|
|
3896
3885
|
schema: types2
|
|
3897
3886
|
},
|
|
3898
3887
|
action: {
|
|
3899
|
-
type: "annotation.add",
|
|
3900
3888
|
annotation: {
|
|
3901
3889
|
name: type.name,
|
|
3902
3890
|
value: value ?? {}
|
|
@@ -4123,9 +4111,7 @@ const addAnnotationActionImplementation = ({
|
|
|
4123
4111
|
}
|
|
4124
4112
|
}))
|
|
4125
4113
|
removeAnnotationActionImplementation({
|
|
4126
|
-
context,
|
|
4127
4114
|
action: {
|
|
4128
|
-
type: "annotation.remove",
|
|
4129
4115
|
annotation: action.annotation,
|
|
4130
4116
|
editor: action.editor
|
|
4131
4117
|
}
|
|
@@ -4134,7 +4120,6 @@ const addAnnotationActionImplementation = ({
|
|
|
4134
4120
|
return addAnnotationActionImplementation({
|
|
4135
4121
|
context,
|
|
4136
4122
|
action: {
|
|
4137
|
-
type: "annotation.add",
|
|
4138
4123
|
annotation: action.annotation,
|
|
4139
4124
|
editor: action.editor
|
|
4140
4125
|
}
|
|
@@ -4308,10 +4293,6 @@ const addAnnotationActionImplementation = ({
|
|
|
4308
4293
|
if (!selection)
|
|
4309
4294
|
throw new Error("Unable to find selection from block offsets");
|
|
4310
4295
|
const trimmedSelection = selector_isOverlappingSelection.getTrimmedSelection({
|
|
4311
|
-
beta: {
|
|
4312
|
-
hasTag: () => !1,
|
|
4313
|
-
internalDrag: void 0
|
|
4314
|
-
},
|
|
4315
4296
|
context: {
|
|
4316
4297
|
converters: [],
|
|
4317
4298
|
schema: context.schema,
|
|
@@ -4530,9 +4511,7 @@ const selectActionImplementation = ({
|
|
|
4530
4511
|
return;
|
|
4531
4512
|
}
|
|
4532
4513
|
selectActionImplementation({
|
|
4533
|
-
context,
|
|
4534
4514
|
action: {
|
|
4535
|
-
type: "select",
|
|
4536
4515
|
selection: newSelection,
|
|
4537
4516
|
editor: action.editor
|
|
4538
4517
|
}
|
|
@@ -4559,9 +4538,7 @@ const selectActionImplementation = ({
|
|
|
4559
4538
|
return;
|
|
4560
4539
|
}
|
|
4561
4540
|
selectActionImplementation({
|
|
4562
|
-
context,
|
|
4563
4541
|
action: {
|
|
4564
|
-
type: "select",
|
|
4565
4542
|
selection: newSelection,
|
|
4566
4543
|
editor: action.editor
|
|
4567
4544
|
}
|
|
@@ -4622,13 +4599,11 @@ const selectActionImplementation = ({
|
|
|
4622
4599
|
index === 0 ? (insertBreakActionImplementation({
|
|
4623
4600
|
context,
|
|
4624
4601
|
action: {
|
|
4625
|
-
type: "insert.break",
|
|
4626
4602
|
editor: action.editor
|
|
4627
4603
|
}
|
|
4628
4604
|
}), selectPreviousBlockActionImplementation({
|
|
4629
4605
|
context,
|
|
4630
4606
|
action: {
|
|
4631
|
-
type: "select.previous block",
|
|
4632
4607
|
editor: action.editor,
|
|
4633
4608
|
select: "end"
|
|
4634
4609
|
}
|
|
@@ -4641,7 +4616,6 @@ const selectActionImplementation = ({
|
|
|
4641
4616
|
})) : index === fragment.length - 1 ? (selectNextBlockActionImplementation({
|
|
4642
4617
|
context,
|
|
4643
4618
|
action: {
|
|
4644
|
-
type: "select.next block",
|
|
4645
4619
|
editor: action.editor,
|
|
4646
4620
|
select: "start"
|
|
4647
4621
|
}
|
|
@@ -4674,7 +4648,6 @@ const selectActionImplementation = ({
|
|
|
4674
4648
|
insertBlocksActionImplementation({
|
|
4675
4649
|
context,
|
|
4676
4650
|
action: {
|
|
4677
|
-
type: "insert.blocks",
|
|
4678
4651
|
blocks: action.data,
|
|
4679
4652
|
editor: action.editor,
|
|
4680
4653
|
placement: "auto"
|
|
@@ -4760,7 +4733,6 @@ const selectActionImplementation = ({
|
|
|
4760
4733
|
insertBlockActionImplementation({
|
|
4761
4734
|
context,
|
|
4762
4735
|
action: {
|
|
4763
|
-
type: "insert.block",
|
|
4764
4736
|
block: {
|
|
4765
4737
|
_key: context.keyGenerator(),
|
|
4766
4738
|
_type: action.blockObject.name,
|
|
@@ -4781,7 +4753,6 @@ const selectActionImplementation = ({
|
|
|
4781
4753
|
insertBlockActionImplementation({
|
|
4782
4754
|
context,
|
|
4783
4755
|
action: {
|
|
4784
|
-
type: "insert.block",
|
|
4785
4756
|
block: {
|
|
4786
4757
|
_key: context.keyGenerator(),
|
|
4787
4758
|
_type: context.schema.block.name,
|
|
@@ -4830,9 +4801,7 @@ const selectActionImplementation = ({
|
|
|
4830
4801
|
return;
|
|
4831
4802
|
}
|
|
4832
4803
|
moveBlockActionImplementation({
|
|
4833
|
-
context,
|
|
4834
4804
|
action: {
|
|
4835
|
-
type: "move.block",
|
|
4836
4805
|
at: action.at,
|
|
4837
4806
|
to: [{
|
|
4838
4807
|
_key: destinationBlockKey
|
|
@@ -4862,9 +4831,7 @@ const selectActionImplementation = ({
|
|
|
4862
4831
|
return;
|
|
4863
4832
|
}
|
|
4864
4833
|
moveBlockActionImplementation({
|
|
4865
|
-
context,
|
|
4866
4834
|
action: {
|
|
4867
|
-
type: "move.block",
|
|
4868
4835
|
at: action.at,
|
|
4869
4836
|
to: [{
|
|
4870
4837
|
_key: destinationBlockKey
|
|
@@ -4882,10 +4849,10 @@ const selectActionImplementation = ({
|
|
|
4882
4849
|
action
|
|
4883
4850
|
}) => {
|
|
4884
4851
|
dataTransferSetActionImplementation({
|
|
4885
|
-
context,
|
|
4886
4852
|
action: {
|
|
4887
|
-
|
|
4888
|
-
|
|
4853
|
+
data: action.data,
|
|
4854
|
+
dataTransfer: action.originEvent.originEvent.dataTransfer,
|
|
4855
|
+
mimeType: action.mimeType
|
|
4889
4856
|
}
|
|
4890
4857
|
});
|
|
4891
4858
|
}, behaviorActionImplementations = {
|
|
@@ -5342,8 +5309,22 @@ function createWithEventListeners(editorActor, subscriptions) {
|
|
|
5342
5309
|
},
|
|
5343
5310
|
editor
|
|
5344
5311
|
});
|
|
5345
|
-
}, editor.insertData = () => {
|
|
5346
|
-
|
|
5312
|
+
}, editor.insertData = (dataTransfer) => {
|
|
5313
|
+
if (isApplyingBehaviorActions(editor))
|
|
5314
|
+
throw new Error("Unexpected call to .insertData(...)");
|
|
5315
|
+
editorActor.send({
|
|
5316
|
+
type: "behavior event",
|
|
5317
|
+
behaviorEvent: {
|
|
5318
|
+
type: "deserialize",
|
|
5319
|
+
originEvent: {
|
|
5320
|
+
type: "input.*",
|
|
5321
|
+
originEvent: {
|
|
5322
|
+
dataTransfer
|
|
5323
|
+
}
|
|
5324
|
+
}
|
|
5325
|
+
},
|
|
5326
|
+
editor
|
|
5327
|
+
});
|
|
5347
5328
|
}, editor.insertSoftBreak = () => {
|
|
5348
5329
|
if (isApplyingBehaviorActions(editor)) {
|
|
5349
5330
|
insertSoftBreakActionImplementation({
|
|
@@ -5352,7 +5333,6 @@ function createWithEventListeners(editorActor, subscriptions) {
|
|
|
5352
5333
|
schema: editorActor.getSnapshot().context.schema
|
|
5353
5334
|
},
|
|
5354
5335
|
action: {
|
|
5355
|
-
type: "insert.soft break",
|
|
5356
5336
|
editor
|
|
5357
5337
|
}
|
|
5358
5338
|
});
|
|
@@ -6123,10 +6103,10 @@ function createSlateEditor(config) {
|
|
|
6123
6103
|
const keyIs = {
|
|
6124
6104
|
lineBreak: (event) => event.key === "Enter" && event.shiftKey
|
|
6125
6105
|
}, raiseInsertSoftBreak = behavior_core.defineBehavior({
|
|
6126
|
-
on: "
|
|
6106
|
+
on: "keyboard.keydown",
|
|
6127
6107
|
guard: ({
|
|
6128
6108
|
event
|
|
6129
|
-
}) => keyIs.lineBreak(event.
|
|
6109
|
+
}) => keyIs.lineBreak(event.originEvent),
|
|
6130
6110
|
actions: [() => [behavior_core.raise({
|
|
6131
6111
|
type: "insert.soft break"
|
|
6132
6112
|
})]]
|
|
@@ -6233,7 +6213,7 @@ const keyIs = {
|
|
|
6233
6213
|
event
|
|
6234
6214
|
}) => {
|
|
6235
6215
|
const deserializeEvents = snapshot.context.converters.flatMap((converter) => {
|
|
6236
|
-
const data = event.dataTransfer.getData(converter.mimeType);
|
|
6216
|
+
const data = event.originEvent.originEvent.dataTransfer.getData(converter.mimeType);
|
|
6237
6217
|
return data ? [converter.deserialize({
|
|
6238
6218
|
snapshot,
|
|
6239
6219
|
event: {
|
|
@@ -6252,7 +6232,6 @@ const keyIs = {
|
|
|
6252
6232
|
event
|
|
6253
6233
|
}, deserializeEvent) => [behavior_core.raise({
|
|
6254
6234
|
...deserializeEvent,
|
|
6255
|
-
dataTransfer: event.dataTransfer,
|
|
6256
6235
|
originEvent: event.originEvent
|
|
6257
6236
|
})]]
|
|
6258
6237
|
}), raiseSerializationSuccessOrFailure = behavior_core.defineBehavior({
|
|
@@ -6276,11 +6255,10 @@ const keyIs = {
|
|
|
6276
6255
|
event
|
|
6277
6256
|
}, serializeEvents) => serializeEvents.map((serializeEvent) => behavior_core.raise({
|
|
6278
6257
|
...serializeEvent,
|
|
6279
|
-
originEvent: event.originEvent
|
|
6280
|
-
dataTransfer: event.dataTransfer
|
|
6258
|
+
originEvent: event.originEvent
|
|
6281
6259
|
}))]
|
|
6282
6260
|
}), defaultBehaviors = [behavior_core.defineBehavior({
|
|
6283
|
-
on: "copy",
|
|
6261
|
+
on: "clipboard.copy",
|
|
6284
6262
|
guard: ({
|
|
6285
6263
|
snapshot
|
|
6286
6264
|
}) => {
|
|
@@ -6291,16 +6269,15 @@ const keyIs = {
|
|
|
6291
6269
|
type: "noop"
|
|
6292
6270
|
}]]
|
|
6293
6271
|
}), behavior_core.defineBehavior({
|
|
6294
|
-
on: "copy",
|
|
6272
|
+
on: "clipboard.copy",
|
|
6295
6273
|
actions: [({
|
|
6296
6274
|
event
|
|
6297
6275
|
}) => [behavior_core.raise({
|
|
6298
6276
|
type: "serialize",
|
|
6299
|
-
dataTransfer: event.data,
|
|
6300
6277
|
originEvent: event
|
|
6301
6278
|
})]]
|
|
6302
6279
|
}), behavior_core.defineBehavior({
|
|
6303
|
-
on: "cut",
|
|
6280
|
+
on: "clipboard.cut",
|
|
6304
6281
|
guard: ({
|
|
6305
6282
|
snapshot
|
|
6306
6283
|
}) => {
|
|
@@ -6311,7 +6288,7 @@ const keyIs = {
|
|
|
6311
6288
|
type: "noop"
|
|
6312
6289
|
}]]
|
|
6313
6290
|
}), behavior_core.defineBehavior({
|
|
6314
|
-
on: "cut",
|
|
6291
|
+
on: "clipboard.cut",
|
|
6315
6292
|
guard: ({
|
|
6316
6293
|
snapshot
|
|
6317
6294
|
}) => snapshot.context.selection ? {
|
|
@@ -6323,7 +6300,6 @@ const keyIs = {
|
|
|
6323
6300
|
selection
|
|
6324
6301
|
}) => [behavior_core.raise({
|
|
6325
6302
|
type: "serialize",
|
|
6326
|
-
dataTransfer: event.dataTransfer,
|
|
6327
6303
|
originEvent: event
|
|
6328
6304
|
}), behavior_core.raise({
|
|
6329
6305
|
type: "delete",
|
|
@@ -6335,7 +6311,6 @@ const keyIs = {
|
|
|
6335
6311
|
event
|
|
6336
6312
|
}) => [behavior_core.raise({
|
|
6337
6313
|
type: "serialize",
|
|
6338
|
-
dataTransfer: event.dataTransfer,
|
|
6339
6314
|
originEvent: event
|
|
6340
6315
|
})]]
|
|
6341
6316
|
}), behavior_core.defineBehavior({
|
|
@@ -6345,7 +6320,7 @@ const keyIs = {
|
|
|
6345
6320
|
}) => [behavior_core.raise({
|
|
6346
6321
|
type: "data transfer.set",
|
|
6347
6322
|
data: event.data,
|
|
6348
|
-
dataTransfer: event.dataTransfer,
|
|
6323
|
+
dataTransfer: event.originEvent.originEvent.dataTransfer,
|
|
6349
6324
|
mimeType: event.mimeType
|
|
6350
6325
|
})]]
|
|
6351
6326
|
}), behavior_core.defineBehavior({
|
|
@@ -6372,7 +6347,6 @@ const keyIs = {
|
|
|
6372
6347
|
event
|
|
6373
6348
|
}) => [behavior_core.raise({
|
|
6374
6349
|
type: "deserialize",
|
|
6375
|
-
dataTransfer: event.dataTransfer,
|
|
6376
6350
|
originEvent: event
|
|
6377
6351
|
})]]
|
|
6378
6352
|
}), behavior_core.defineBehavior({
|
|
@@ -6390,13 +6364,11 @@ const keyIs = {
|
|
|
6390
6364
|
selection: dragOrigin.selection
|
|
6391
6365
|
}
|
|
6392
6366
|
}) : !1, draggingEntireBlocks = selector_isOverlappingSelection.isSelectingEntireBlocks({
|
|
6393
|
-
...snapshot,
|
|
6394
6367
|
context: {
|
|
6395
6368
|
...snapshot.context,
|
|
6396
6369
|
selection: dragOrigin.selection
|
|
6397
6370
|
}
|
|
6398
6371
|
}), draggedBlocks = selector_isAtTheStartOfBlock.getSelectedBlocks({
|
|
6399
|
-
...snapshot,
|
|
6400
6372
|
context: {
|
|
6401
6373
|
...snapshot.context,
|
|
6402
6374
|
selection: dragOrigin.selection
|
|
@@ -6405,7 +6377,8 @@ const keyIs = {
|
|
|
6405
6377
|
return droppingOnDragOrigin ? !1 : {
|
|
6406
6378
|
draggingEntireBlocks,
|
|
6407
6379
|
draggedBlocks,
|
|
6408
|
-
dragOrigin
|
|
6380
|
+
dragOrigin,
|
|
6381
|
+
originEvent: event.originEvent
|
|
6409
6382
|
};
|
|
6410
6383
|
},
|
|
6411
6384
|
actions: [({
|
|
@@ -6413,11 +6386,12 @@ const keyIs = {
|
|
|
6413
6386
|
}, {
|
|
6414
6387
|
draggingEntireBlocks,
|
|
6415
6388
|
draggedBlocks,
|
|
6416
|
-
dragOrigin
|
|
6389
|
+
dragOrigin,
|
|
6390
|
+
originEvent
|
|
6417
6391
|
}) => [behavior_core.raise({
|
|
6418
6392
|
type: "insert.blocks",
|
|
6419
6393
|
blocks: event.data,
|
|
6420
|
-
placement: draggingEntireBlocks ?
|
|
6394
|
+
placement: draggingEntireBlocks ? originEvent.position.block === "start" ? "before" : originEvent.position.block === "end" ? "after" : "auto" : "auto"
|
|
6421
6395
|
}), ...draggingEntireBlocks ? draggedBlocks.map((block) => behavior_core.raise({
|
|
6422
6396
|
type: "delete.block",
|
|
6423
6397
|
blockPath: block.path
|
|
@@ -6435,7 +6409,7 @@ const keyIs = {
|
|
|
6435
6409
|
placement: "auto"
|
|
6436
6410
|
})]]
|
|
6437
6411
|
}), behavior_core.defineBehavior({
|
|
6438
|
-
on: "paste",
|
|
6412
|
+
on: "clipboard.paste",
|
|
6439
6413
|
guard: ({
|
|
6440
6414
|
snapshot
|
|
6441
6415
|
}) => snapshot.context.selection && selector_isAtTheStartOfBlock.isSelectionExpanded(snapshot) ? {
|
|
@@ -6450,16 +6424,22 @@ const keyIs = {
|
|
|
6450
6424
|
selection
|
|
6451
6425
|
}), behavior_core.raise({
|
|
6452
6426
|
type: "deserialize",
|
|
6453
|
-
dataTransfer: event.data,
|
|
6454
6427
|
originEvent: event
|
|
6455
6428
|
})]]
|
|
6456
6429
|
}), behavior_core.defineBehavior({
|
|
6457
|
-
on: "paste",
|
|
6430
|
+
on: "clipboard.paste",
|
|
6431
|
+
actions: [({
|
|
6432
|
+
event
|
|
6433
|
+
}) => [behavior_core.raise({
|
|
6434
|
+
type: "deserialize",
|
|
6435
|
+
originEvent: event
|
|
6436
|
+
})]]
|
|
6437
|
+
}), behavior_core.defineBehavior({
|
|
6438
|
+
on: "input.*",
|
|
6458
6439
|
actions: [({
|
|
6459
6440
|
event
|
|
6460
6441
|
}) => [behavior_core.raise({
|
|
6461
6442
|
type: "deserialize",
|
|
6462
|
-
dataTransfer: event.data,
|
|
6463
6443
|
originEvent: event
|
|
6464
6444
|
})]]
|
|
6465
6445
|
}), toggleAnnotationOff, toggleAnnotationOn, toggleDecoratorOff, toggleDecoratorOn, toggleListItemOff, toggleListItemOn, toggleStyleOff, toggleStyleOn, raiseDeserializationSuccessOrFailure, raiseSerializationSuccessOrFailure, raiseInsertSoftBreak];
|
|
@@ -6570,10 +6550,10 @@ const editorMachine = xstate.setup({
|
|
|
6570
6550
|
self
|
|
6571
6551
|
}) => {
|
|
6572
6552
|
xstate.assertEvent(event, ["behavior event", "custom behavior event"]);
|
|
6573
|
-
const defaultAction = event.type === "custom behavior event" || behavior_core.
|
|
6553
|
+
const defaultAction = event.type === "custom behavior event" || behavior_core.isClipboardBehaviorEvent(event.behaviorEvent) || behavior_core.isDragBehaviorEvent(event.behaviorEvent) || behavior_core.isInputBehaviorEvent(event.behaviorEvent) || behavior_core.isKeyboardBehaviorEvent(event.behaviorEvent) || behavior_core.isMouseBehaviorEvent(event.behaviorEvent) || event.behaviorEvent.type === "deserialize" || event.behaviorEvent.type === "serialize" ? void 0 : {
|
|
6574
6554
|
...event.behaviorEvent,
|
|
6575
6555
|
editor: event.editor
|
|
6576
|
-
}, defaultActionCallback = event.type === "behavior event" ? event.defaultActionCallback : void 0, eventBehaviors = [...context.behaviors.values(), ...defaultBehaviors].filter((behavior) => behavior.on === "*" ? !0 : behavior_core.isDragBehaviorEvent(event.behaviorEvent)
|
|
6556
|
+
}, defaultActionCallback = event.type === "behavior event" ? event.defaultActionCallback : void 0, eventBehaviors = [...context.behaviors.values(), ...defaultBehaviors].filter((behavior) => behavior.on === "*" ? !0 : behavior_core.isClipboardBehaviorEvent(event.behaviorEvent) ? behavior.on === "clipboard.*" || behavior.on === event.behaviorEvent.type : behavior_core.isDragBehaviorEvent(event.behaviorEvent) ? behavior.on === "drag.*" || behavior.on === event.behaviorEvent.type : behavior_core.isInputBehaviorEvent(event.behaviorEvent) ? behavior.on === "input.*" : behavior_core.isKeyboardBehaviorEvent(event.behaviorEvent) ? behavior.on === "keyboard.*" || behavior.on === event.behaviorEvent.type : behavior_core.isMouseBehaviorEvent(event.behaviorEvent) && behavior.on === "mouse.*" || behavior.on === event.behaviorEvent.type);
|
|
6577
6557
|
if (eventBehaviors.length === 0) {
|
|
6578
6558
|
if (defaultActionCallback) {
|
|
6579
6559
|
withApplyingBehaviorActions(event.editor, () => {
|
|
@@ -6831,7 +6811,7 @@ const editorMachine = xstate.setup({
|
|
|
6831
6811
|
actions: "handle behavior event",
|
|
6832
6812
|
guard: ({
|
|
6833
6813
|
event
|
|
6834
|
-
}) => event.behaviorEvent.type === "copy" || event.behaviorEvent.type === "data transfer.set" || event.behaviorEvent.type === "serialize" || event.behaviorEvent.type === "serialization.failure" || event.behaviorEvent.type === "serialization.success" || event.behaviorEvent.type === "select"
|
|
6814
|
+
}) => event.behaviorEvent.type === "clipboard.copy" || event.behaviorEvent.type === "data transfer.set" || event.behaviorEvent.type === "serialize" || event.behaviorEvent.type === "serialization.failure" || event.behaviorEvent.type === "serialization.success" || event.behaviorEvent.type === "select"
|
|
6835
6815
|
}
|
|
6836
6816
|
},
|
|
6837
6817
|
states: {
|