@portabletext/editor 1.50.8 → 1.52.0
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/{util.slice-blocks.cjs → selection-point.cjs} +26 -18
- package/lib/_chunks-cjs/selection-point.cjs.map +1 -0
- package/lib/_chunks-cjs/selector.get-text-before.cjs +13 -10
- package/lib/_chunks-cjs/selector.get-text-before.cjs.map +1 -1
- package/lib/_chunks-cjs/selector.is-selecting-entire-blocks.cjs +46 -46
- package/lib/_chunks-cjs/selector.is-selecting-entire-blocks.cjs.map +1 -1
- package/lib/_chunks-cjs/selector.is-selection-expanded.cjs +21 -17
- package/lib/_chunks-cjs/selector.is-selection-expanded.cjs.map +1 -1
- package/lib/_chunks-cjs/util.child-selection-point-to-block-offset.cjs +10 -10
- package/lib/_chunks-cjs/util.child-selection-point-to-block-offset.cjs.map +1 -1
- package/lib/_chunks-cjs/util.is-equal-selection-points.cjs +5 -5
- package/lib/_chunks-cjs/util.is-equal-selection-points.cjs.map +1 -1
- package/lib/_chunks-cjs/util.merge-text-blocks.cjs +3 -3
- package/lib/_chunks-cjs/util.merge-text-blocks.cjs.map +1 -1
- package/lib/_chunks-cjs/util.selection-point-to-block-offset.cjs +7 -14
- package/lib/_chunks-cjs/util.selection-point-to-block-offset.cjs.map +1 -1
- package/lib/_chunks-es/{util.slice-blocks.js → selection-point.js} +26 -18
- package/lib/_chunks-es/selection-point.js.map +1 -0
- package/lib/_chunks-es/selector.get-text-before.js +13 -10
- package/lib/_chunks-es/selector.get-text-before.js.map +1 -1
- package/lib/_chunks-es/selector.is-selecting-entire-blocks.js +21 -21
- package/lib/_chunks-es/selector.is-selecting-entire-blocks.js.map +1 -1
- package/lib/_chunks-es/selector.is-selection-expanded.js +14 -10
- package/lib/_chunks-es/selector.is-selection-expanded.js.map +1 -1
- package/lib/_chunks-es/util.child-selection-point-to-block-offset.js +2 -2
- package/lib/_chunks-es/util.child-selection-point-to-block-offset.js.map +1 -1
- package/lib/_chunks-es/util.is-equal-selection-points.js +1 -1
- package/lib/_chunks-es/util.merge-text-blocks.js +1 -1
- package/lib/_chunks-es/util.selection-point-to-block-offset.js +4 -11
- package/lib/_chunks-es/util.selection-point-to-block-offset.js.map +1 -1
- package/lib/behaviors/index.cjs.map +1 -1
- package/lib/behaviors/index.d.cts +25 -2010
- package/lib/behaviors/index.d.ts +25 -2010
- package/lib/behaviors/index.js.map +1 -1
- package/lib/index.cjs +515 -393
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +361 -34
- package/lib/index.d.ts +361 -34
- package/lib/index.js +471 -349
- package/lib/index.js.map +1 -1
- package/lib/plugins/index.cjs +11 -11
- package/lib/plugins/index.cjs.map +1 -1
- package/lib/plugins/index.d.cts +32 -1986
- package/lib/plugins/index.d.ts +32 -1986
- package/lib/plugins/index.js +1 -1
- package/lib/selectors/index.cjs +11 -7
- package/lib/selectors/index.cjs.map +1 -1
- package/lib/selectors/index.d.cts +2 -2648
- package/lib/selectors/index.d.ts +2 -2648
- package/lib/selectors/index.js +7 -3
- package/lib/selectors/index.js.map +1 -1
- package/lib/utils/index.cjs +25 -14
- package/lib/utils/index.cjs.map +1 -1
- package/lib/utils/index.d.cts +0 -2647
- package/lib/utils/index.d.ts +0 -2647
- package/lib/utils/index.js +14 -3
- package/lib/utils/index.js.map +1 -1
- package/package.json +14 -14
- package/src/behaviors/behavior.abstract.delete.ts +0 -2
- package/src/behaviors/behavior.abstract.insert.ts +8 -8
- package/src/behaviors/behavior.abstract.ts +0 -113
- package/src/behaviors/behavior.core.block-element.ts +9 -3
- package/src/behaviors/behavior.core.dnd.ts +328 -1
- package/src/behaviors/behavior.perform-event.ts +10 -0
- package/src/behaviors/behavior.types.action.ts +2 -0
- package/src/behaviors/behavior.types.event.ts +5 -0
- package/src/behaviors/behavior.types.guard.ts +2 -0
- package/src/converters/converter.portable-text.ts +2 -7
- package/src/converters/converter.text-html.ts +1 -3
- package/src/converters/converter.text-plain.ts +3 -5
- package/src/editor/Editable.tsx +6 -133
- package/src/editor/editor-machine.ts +15 -10
- package/src/editor/editor-selector.ts +0 -2
- package/src/editor/editor-snapshot.ts +0 -18
- package/src/internal-utils/create-test-snapshot.ts +0 -2
- package/src/internal-utils/event-position.ts +42 -30
- package/src/internal-utils/selection-block-keys.ts +7 -7
- package/src/internal-utils/selection-elements.ts +108 -0
- package/src/internal-utils/selection-focus-text.ts +13 -9
- package/src/internal-utils/selection-text.ts +9 -78
- package/src/internal-utils/terse-pt.test.ts +108 -26
- package/src/internal-utils/terse-pt.ts +132 -14
- package/src/operations/behavior.operation.decorator.add.ts +0 -2
- package/src/operations/behavior.operation.delete.ts +18 -13
- package/src/operations/behavior.operation.insert.block.ts +5 -1
- package/src/selection/selection-point.ts +22 -0
- package/src/selectors/selector.get-anchor-block.ts +6 -6
- package/src/selectors/selector.get-anchor-child.ts +6 -6
- package/src/selectors/selector.get-selected-spans.ts +16 -19
- package/src/selectors/selector.get-selected-text-blocks.ts +11 -19
- package/src/selectors/selector.get-selection-end-block.ts +30 -0
- package/src/selectors/selector.get-selection-start-block.ts +30 -0
- package/src/selectors/selector.get-text-before.ts +15 -16
- package/src/selectors/selector.get-trimmed-selection.ts +15 -21
- package/src/selectors/selector.is-point-after-selection.ts +11 -19
- package/src/selectors/selector.is-point-before-selection.ts +11 -19
- package/src/selectors/selectors.ts +23 -39
- package/src/utils/util.block-offset.ts +6 -7
- package/src/utils/util.child-selection-point-to-block-offset.ts +6 -7
- package/src/utils/util.selection-point-to-block-offset.ts +5 -6
- package/src/utils/util.slice-blocks.ts +11 -20
- package/lib/_chunks-cjs/util.slice-blocks.cjs.map +0 -1
- package/lib/_chunks-es/util.slice-blocks.js.map +0 -1
- package/src/internal-utils/inline-object-selection.ts +0 -115
package/lib/index.d.cts
CHANGED
|
@@ -171,6 +171,7 @@ declare type AbstractBehaviorEvent =
|
|
|
171
171
|
type: StrictExtract<SyntheticBehaviorEventType, 'insert.blocks'>
|
|
172
172
|
blocks: Array<BlockWithOptionalKey>
|
|
173
173
|
placement: InsertPlacement
|
|
174
|
+
select?: 'start' | 'end' | 'none'
|
|
174
175
|
}
|
|
175
176
|
| {
|
|
176
177
|
type: StrictExtract<SyntheticBehaviorEventType, 'insert.break'>
|
|
@@ -340,6 +341,7 @@ declare type BehaviorActionSet<TBehaviorEvent, TGuardResponse> = (
|
|
|
340
341
|
payload: {
|
|
341
342
|
snapshot: EditorSnapshot
|
|
342
343
|
event: TBehaviorEvent
|
|
344
|
+
dom: EditorDom
|
|
343
345
|
},
|
|
344
346
|
guardResponse: TGuardResponse,
|
|
345
347
|
) => Array<BehaviorAction>
|
|
@@ -368,6 +370,7 @@ declare type BehaviorEventTypeNamespace =
|
|
|
368
370
|
declare type BehaviorGuard<TBehaviorEvent, TGuardResponse> = (payload: {
|
|
369
371
|
snapshot: EditorSnapshot
|
|
370
372
|
event: TBehaviorEvent
|
|
373
|
+
dom: EditorDom
|
|
371
374
|
}) => TGuardResponse | false
|
|
372
375
|
|
|
373
376
|
/** @beta */
|
|
@@ -617,6 +620,8 @@ declare type DragBehaviorEvent =
|
|
|
617
620
|
| {
|
|
618
621
|
type: StrictExtract<NativeBehaviorEventType, 'drag.dragstart'>
|
|
619
622
|
originEvent: {
|
|
623
|
+
clientX: number
|
|
624
|
+
clientY: number
|
|
620
625
|
dataTransfer: DataTransfer
|
|
621
626
|
}
|
|
622
627
|
position: Pick<EventPosition, 'selection'>
|
|
@@ -645,6 +650,7 @@ declare type DragBehaviorEvent =
|
|
|
645
650
|
originEvent: {
|
|
646
651
|
dataTransfer: DataTransfer
|
|
647
652
|
}
|
|
653
|
+
dragOrigin?: Pick<EventPosition, 'selection'>
|
|
648
654
|
position: EventPosition
|
|
649
655
|
}
|
|
650
656
|
| {
|
|
@@ -652,6 +658,7 @@ declare type DragBehaviorEvent =
|
|
|
652
658
|
originEvent: {
|
|
653
659
|
dataTransfer: DataTransfer
|
|
654
660
|
}
|
|
661
|
+
dragOrigin?: Pick<EventPosition, 'selection'>
|
|
655
662
|
position: EventPosition
|
|
656
663
|
}
|
|
657
664
|
| {
|
|
@@ -829,6 +836,26 @@ export declare type EditorContext = {
|
|
|
829
836
|
value: Array<PortableTextBlock>
|
|
830
837
|
}
|
|
831
838
|
|
|
839
|
+
declare type EditorDom = {
|
|
840
|
+
getBlockNodes: (snapshot: EditorSnapshot) => Array<Node>
|
|
841
|
+
getChildNodes: (snapshot: EditorSnapshot) => Array<Node>
|
|
842
|
+
/**
|
|
843
|
+
* Let the Editor set the drag ghost. This is to be sure that it will get
|
|
844
|
+
* properly removed again when the drag ends.
|
|
845
|
+
*/
|
|
846
|
+
setDragGhost: ({
|
|
847
|
+
event,
|
|
848
|
+
ghost,
|
|
849
|
+
}: {
|
|
850
|
+
event: PickFromUnion<BehaviorEvent, 'type', 'drag.dragstart'>
|
|
851
|
+
ghost: {
|
|
852
|
+
element: HTMLElement
|
|
853
|
+
x: number
|
|
854
|
+
y: number
|
|
855
|
+
}
|
|
856
|
+
}) => void
|
|
857
|
+
}
|
|
858
|
+
|
|
832
859
|
/**
|
|
833
860
|
* @public
|
|
834
861
|
*/
|
|
@@ -920,9 +947,9 @@ declare const editorMachine: StateMachine<
|
|
|
920
947
|
selection: EditorSelection
|
|
921
948
|
initialValue: Array<PortableTextBlock> | undefined
|
|
922
949
|
internalDrag?: {
|
|
923
|
-
ghost?: HTMLElement
|
|
924
950
|
origin: Pick<EventPosition, 'selection'>
|
|
925
951
|
}
|
|
952
|
+
dragGhost?: HTMLElement
|
|
926
953
|
slateEditor?: PortableTextSlateEditor
|
|
927
954
|
},
|
|
928
955
|
| InternalPatchEvent
|
|
@@ -976,10 +1003,14 @@ declare const editorMachine: StateMachine<
|
|
|
976
1003
|
preventDefault: () => void
|
|
977
1004
|
}
|
|
978
1005
|
}
|
|
1006
|
+
| {
|
|
1007
|
+
type: 'set drag ghost'
|
|
1008
|
+
ghost: HTMLElement
|
|
1009
|
+
}
|
|
979
1010
|
| {
|
|
980
1011
|
type: 'dragstart'
|
|
981
|
-
origin: Pick<EventPosition, 'selection'>
|
|
982
1012
|
ghost?: HTMLElement
|
|
1013
|
+
origin: Pick<EventPosition, 'selection'>
|
|
983
1014
|
}
|
|
984
1015
|
| {
|
|
985
1016
|
type: 'dragend'
|
|
@@ -1194,9 +1225,9 @@ declare const editorMachine: StateMachine<
|
|
|
1194
1225
|
selection: EditorSelection
|
|
1195
1226
|
initialValue: Array<PortableTextBlock> | undefined
|
|
1196
1227
|
internalDrag?: {
|
|
1197
|
-
ghost?: HTMLElement
|
|
1198
1228
|
origin: Pick<EventPosition, 'selection'>
|
|
1199
1229
|
}
|
|
1230
|
+
dragGhost?: HTMLElement
|
|
1200
1231
|
slateEditor?: PortableTextSlateEditor
|
|
1201
1232
|
},
|
|
1202
1233
|
| InternalPatchEvent
|
|
@@ -1250,10 +1281,14 @@ declare const editorMachine: StateMachine<
|
|
|
1250
1281
|
preventDefault: () => void
|
|
1251
1282
|
}
|
|
1252
1283
|
}
|
|
1284
|
+
| {
|
|
1285
|
+
type: 'set drag ghost'
|
|
1286
|
+
ghost: HTMLElement
|
|
1287
|
+
}
|
|
1253
1288
|
| {
|
|
1254
1289
|
type: 'dragstart'
|
|
1255
|
-
origin: Pick<EventPosition, 'selection'>
|
|
1256
1290
|
ghost?: HTMLElement
|
|
1291
|
+
origin: Pick<EventPosition, 'selection'>
|
|
1257
1292
|
}
|
|
1258
1293
|
| {
|
|
1259
1294
|
type: 'dragend'
|
|
@@ -1319,10 +1354,14 @@ declare const editorMachine: StateMachine<
|
|
|
1319
1354
|
preventDefault: () => void
|
|
1320
1355
|
}
|
|
1321
1356
|
}
|
|
1357
|
+
| {
|
|
1358
|
+
type: 'set drag ghost'
|
|
1359
|
+
ghost: HTMLElement
|
|
1360
|
+
}
|
|
1322
1361
|
| {
|
|
1323
1362
|
type: 'dragstart'
|
|
1324
|
-
origin: Pick<EventPosition, 'selection'>
|
|
1325
1363
|
ghost?: HTMLElement
|
|
1364
|
+
origin: Pick<EventPosition, 'selection'>
|
|
1326
1365
|
}
|
|
1327
1366
|
| {
|
|
1328
1367
|
type: 'dragend'
|
|
@@ -1367,9 +1406,9 @@ declare const editorMachine: StateMachine<
|
|
|
1367
1406
|
selection: EditorSelection
|
|
1368
1407
|
initialValue: Array<PortableTextBlock> | undefined
|
|
1369
1408
|
internalDrag?: {
|
|
1370
|
-
ghost?: HTMLElement
|
|
1371
1409
|
origin: Pick<EventPosition, 'selection'>
|
|
1372
1410
|
}
|
|
1411
|
+
dragGhost?: HTMLElement
|
|
1373
1412
|
slateEditor?: PortableTextSlateEditor
|
|
1374
1413
|
},
|
|
1375
1414
|
{
|
|
@@ -1427,10 +1466,14 @@ declare const editorMachine: StateMachine<
|
|
|
1427
1466
|
preventDefault: () => void
|
|
1428
1467
|
}
|
|
1429
1468
|
}
|
|
1469
|
+
| {
|
|
1470
|
+
type: 'set drag ghost'
|
|
1471
|
+
ghost: HTMLElement
|
|
1472
|
+
}
|
|
1430
1473
|
| {
|
|
1431
1474
|
type: 'dragstart'
|
|
1432
|
-
origin: Pick<EventPosition, 'selection'>
|
|
1433
1475
|
ghost?: HTMLElement
|
|
1476
|
+
origin: Pick<EventPosition, 'selection'>
|
|
1434
1477
|
}
|
|
1435
1478
|
| {
|
|
1436
1479
|
type: 'dragend'
|
|
@@ -1462,9 +1505,9 @@ declare const editorMachine: StateMachine<
|
|
|
1462
1505
|
selection: EditorSelection
|
|
1463
1506
|
initialValue: Array<PortableTextBlock> | undefined
|
|
1464
1507
|
internalDrag?: {
|
|
1465
|
-
ghost?: HTMLElement
|
|
1466
1508
|
origin: Pick<EventPosition, 'selection'>
|
|
1467
1509
|
}
|
|
1510
|
+
dragGhost?: HTMLElement
|
|
1468
1511
|
slateEditor?: PortableTextSlateEditor
|
|
1469
1512
|
},
|
|
1470
1513
|
{
|
|
@@ -1522,10 +1565,14 @@ declare const editorMachine: StateMachine<
|
|
|
1522
1565
|
preventDefault: () => void
|
|
1523
1566
|
}
|
|
1524
1567
|
}
|
|
1568
|
+
| {
|
|
1569
|
+
type: 'set drag ghost'
|
|
1570
|
+
ghost: HTMLElement
|
|
1571
|
+
}
|
|
1525
1572
|
| {
|
|
1526
1573
|
type: 'dragstart'
|
|
1527
|
-
origin: Pick<EventPosition, 'selection'>
|
|
1528
1574
|
ghost?: HTMLElement
|
|
1575
|
+
origin: Pick<EventPosition, 'selection'>
|
|
1529
1576
|
}
|
|
1530
1577
|
| {
|
|
1531
1578
|
type: 'dragend'
|
|
@@ -1554,9 +1601,9 @@ declare const editorMachine: StateMachine<
|
|
|
1554
1601
|
selection: EditorSelection
|
|
1555
1602
|
initialValue: Array<PortableTextBlock> | undefined
|
|
1556
1603
|
internalDrag?: {
|
|
1557
|
-
ghost?: HTMLElement
|
|
1558
1604
|
origin: Pick<EventPosition, 'selection'>
|
|
1559
1605
|
}
|
|
1606
|
+
dragGhost?: HTMLElement
|
|
1560
1607
|
slateEditor?: PortableTextSlateEditor
|
|
1561
1608
|
},
|
|
1562
1609
|
{
|
|
@@ -1614,10 +1661,14 @@ declare const editorMachine: StateMachine<
|
|
|
1614
1661
|
preventDefault: () => void
|
|
1615
1662
|
}
|
|
1616
1663
|
}
|
|
1664
|
+
| {
|
|
1665
|
+
type: 'set drag ghost'
|
|
1666
|
+
ghost: HTMLElement
|
|
1667
|
+
}
|
|
1617
1668
|
| {
|
|
1618
1669
|
type: 'dragstart'
|
|
1619
|
-
origin: Pick<EventPosition, 'selection'>
|
|
1620
1670
|
ghost?: HTMLElement
|
|
1671
|
+
origin: Pick<EventPosition, 'selection'>
|
|
1621
1672
|
}
|
|
1622
1673
|
| {
|
|
1623
1674
|
type: 'dragend'
|
|
@@ -1678,6 +1729,104 @@ declare const editorMachine: StateMachine<
|
|
|
1678
1729
|
>,
|
|
1679
1730
|
]
|
|
1680
1731
|
}
|
|
1732
|
+
readonly 'set drag ghost': {
|
|
1733
|
+
readonly actions: ActionFunction<
|
|
1734
|
+
{
|
|
1735
|
+
behaviors: Set<BehaviorConfig>
|
|
1736
|
+
converters: Set<Converter>
|
|
1737
|
+
getLegacySchema: () => PortableTextMemberSchemaTypes
|
|
1738
|
+
keyGenerator: () => string
|
|
1739
|
+
pendingEvents: Array<InternalPatchEvent | MutationEvent>
|
|
1740
|
+
pendingIncomingPatchesEvents: Array<PatchesEvent>
|
|
1741
|
+
schema: EditorSchema
|
|
1742
|
+
initialReadOnly: boolean
|
|
1743
|
+
maxBlocks: number | undefined
|
|
1744
|
+
selection: EditorSelection
|
|
1745
|
+
initialValue: Array<PortableTextBlock> | undefined
|
|
1746
|
+
internalDrag?: {
|
|
1747
|
+
origin: Pick<EventPosition, 'selection'>
|
|
1748
|
+
}
|
|
1749
|
+
dragGhost?: HTMLElement
|
|
1750
|
+
slateEditor?: PortableTextSlateEditor
|
|
1751
|
+
},
|
|
1752
|
+
{
|
|
1753
|
+
type: 'set drag ghost'
|
|
1754
|
+
ghost: HTMLElement
|
|
1755
|
+
},
|
|
1756
|
+
| InternalPatchEvent
|
|
1757
|
+
| MutationEvent
|
|
1758
|
+
| PatchesEvent
|
|
1759
|
+
| {
|
|
1760
|
+
type: 'update readOnly'
|
|
1761
|
+
readOnly: boolean
|
|
1762
|
+
}
|
|
1763
|
+
| {
|
|
1764
|
+
type: 'update maxBlocks'
|
|
1765
|
+
maxBlocks: number | undefined
|
|
1766
|
+
}
|
|
1767
|
+
| {
|
|
1768
|
+
type: 'add behavior'
|
|
1769
|
+
behaviorConfig: BehaviorConfig
|
|
1770
|
+
}
|
|
1771
|
+
| {
|
|
1772
|
+
type: 'remove behavior'
|
|
1773
|
+
behaviorConfig: BehaviorConfig
|
|
1774
|
+
}
|
|
1775
|
+
| {
|
|
1776
|
+
type: 'blur'
|
|
1777
|
+
editor: PortableTextSlateEditor
|
|
1778
|
+
}
|
|
1779
|
+
| {
|
|
1780
|
+
type: 'focus'
|
|
1781
|
+
editor: PortableTextSlateEditor
|
|
1782
|
+
}
|
|
1783
|
+
| {
|
|
1784
|
+
type: 'normalizing'
|
|
1785
|
+
}
|
|
1786
|
+
| {
|
|
1787
|
+
type: 'update selection'
|
|
1788
|
+
selection: EditorSelection
|
|
1789
|
+
}
|
|
1790
|
+
| {
|
|
1791
|
+
type: 'done normalizing'
|
|
1792
|
+
}
|
|
1793
|
+
| {
|
|
1794
|
+
type: 'done syncing value'
|
|
1795
|
+
}
|
|
1796
|
+
| {
|
|
1797
|
+
type: 'syncing value'
|
|
1798
|
+
}
|
|
1799
|
+
| {
|
|
1800
|
+
type: 'behavior event'
|
|
1801
|
+
behaviorEvent: BehaviorEvent
|
|
1802
|
+
editor: PortableTextSlateEditor
|
|
1803
|
+
nativeEvent?: {
|
|
1804
|
+
preventDefault: () => void
|
|
1805
|
+
}
|
|
1806
|
+
}
|
|
1807
|
+
| {
|
|
1808
|
+
type: 'set drag ghost'
|
|
1809
|
+
ghost: HTMLElement
|
|
1810
|
+
}
|
|
1811
|
+
| {
|
|
1812
|
+
type: 'dragstart'
|
|
1813
|
+
ghost?: HTMLElement
|
|
1814
|
+
origin: Pick<EventPosition, 'selection'>
|
|
1815
|
+
}
|
|
1816
|
+
| {
|
|
1817
|
+
type: 'dragend'
|
|
1818
|
+
}
|
|
1819
|
+
| {
|
|
1820
|
+
type: 'drop'
|
|
1821
|
+
},
|
|
1822
|
+
undefined,
|
|
1823
|
+
never,
|
|
1824
|
+
never,
|
|
1825
|
+
never,
|
|
1826
|
+
never,
|
|
1827
|
+
never
|
|
1828
|
+
>
|
|
1829
|
+
}
|
|
1681
1830
|
}
|
|
1682
1831
|
readonly type: 'parallel'
|
|
1683
1832
|
readonly states: {
|
|
@@ -1705,9 +1854,9 @@ declare const editorMachine: StateMachine<
|
|
|
1705
1854
|
selection: EditorSelection
|
|
1706
1855
|
initialValue: Array<PortableTextBlock> | undefined
|
|
1707
1856
|
internalDrag?: {
|
|
1708
|
-
ghost?: HTMLElement
|
|
1709
1857
|
origin: Pick<EventPosition, 'selection'>
|
|
1710
1858
|
}
|
|
1859
|
+
dragGhost?: HTMLElement
|
|
1711
1860
|
slateEditor?: PortableTextSlateEditor
|
|
1712
1861
|
},
|
|
1713
1862
|
{
|
|
@@ -1747,9 +1896,9 @@ declare const editorMachine: StateMachine<
|
|
|
1747
1896
|
selection: EditorSelection
|
|
1748
1897
|
initialValue: Array<PortableTextBlock> | undefined
|
|
1749
1898
|
internalDrag?: {
|
|
1750
|
-
ghost?: HTMLElement
|
|
1751
1899
|
origin: Pick<EventPosition, 'selection'>
|
|
1752
1900
|
}
|
|
1901
|
+
dragGhost?: HTMLElement
|
|
1753
1902
|
slateEditor?: PortableTextSlateEditor
|
|
1754
1903
|
},
|
|
1755
1904
|
{
|
|
@@ -1784,9 +1933,9 @@ declare const editorMachine: StateMachine<
|
|
|
1784
1933
|
selection: EditorSelection
|
|
1785
1934
|
initialValue: Array<PortableTextBlock> | undefined
|
|
1786
1935
|
internalDrag?: {
|
|
1787
|
-
ghost?: HTMLElement
|
|
1788
1936
|
origin: Pick<EventPosition, 'selection'>
|
|
1789
1937
|
}
|
|
1938
|
+
dragGhost?: HTMLElement
|
|
1790
1939
|
slateEditor?: PortableTextSlateEditor
|
|
1791
1940
|
},
|
|
1792
1941
|
{
|
|
@@ -1820,9 +1969,9 @@ declare const editorMachine: StateMachine<
|
|
|
1820
1969
|
selection: EditorSelection
|
|
1821
1970
|
initialValue: Array<PortableTextBlock> | undefined
|
|
1822
1971
|
internalDrag?: {
|
|
1823
|
-
ghost?: HTMLElement
|
|
1824
1972
|
origin: Pick<EventPosition, 'selection'>
|
|
1825
1973
|
}
|
|
1974
|
+
dragGhost?: HTMLElement
|
|
1826
1975
|
slateEditor?: PortableTextSlateEditor
|
|
1827
1976
|
},
|
|
1828
1977
|
{
|
|
@@ -1856,9 +2005,9 @@ declare const editorMachine: StateMachine<
|
|
|
1856
2005
|
selection: EditorSelection
|
|
1857
2006
|
initialValue: Array<PortableTextBlock> | undefined
|
|
1858
2007
|
internalDrag?: {
|
|
1859
|
-
ghost?: HTMLElement
|
|
1860
2008
|
origin: Pick<EventPosition, 'selection'>
|
|
1861
2009
|
}
|
|
2010
|
+
dragGhost?: HTMLElement
|
|
1862
2011
|
slateEditor?: PortableTextSlateEditor
|
|
1863
2012
|
},
|
|
1864
2013
|
{
|
|
@@ -1916,10 +2065,14 @@ declare const editorMachine: StateMachine<
|
|
|
1916
2065
|
preventDefault: () => void
|
|
1917
2066
|
}
|
|
1918
2067
|
}
|
|
2068
|
+
| {
|
|
2069
|
+
type: 'set drag ghost'
|
|
2070
|
+
ghost: HTMLElement
|
|
2071
|
+
}
|
|
1919
2072
|
| {
|
|
1920
2073
|
type: 'dragstart'
|
|
1921
|
-
origin: Pick<EventPosition, 'selection'>
|
|
1922
2074
|
ghost?: HTMLElement
|
|
2075
|
+
origin: Pick<EventPosition, 'selection'>
|
|
1923
2076
|
}
|
|
1924
2077
|
| {
|
|
1925
2078
|
type: 'dragend'
|
|
@@ -1961,15 +2114,15 @@ declare const editorMachine: StateMachine<
|
|
|
1961
2114
|
selection: EditorSelection
|
|
1962
2115
|
initialValue: Array<PortableTextBlock> | undefined
|
|
1963
2116
|
internalDrag?: {
|
|
1964
|
-
ghost?: HTMLElement
|
|
1965
2117
|
origin: Pick<EventPosition, 'selection'>
|
|
1966
2118
|
}
|
|
2119
|
+
dragGhost?: HTMLElement
|
|
1967
2120
|
slateEditor?: PortableTextSlateEditor
|
|
1968
2121
|
},
|
|
1969
2122
|
{
|
|
1970
2123
|
type: 'dragstart'
|
|
1971
|
-
origin: Pick<EventPosition, 'selection'>
|
|
1972
2124
|
ghost?: HTMLElement
|
|
2125
|
+
origin: Pick<EventPosition, 'selection'>
|
|
1973
2126
|
},
|
|
1974
2127
|
| InternalPatchEvent
|
|
1975
2128
|
| MutationEvent
|
|
@@ -2022,10 +2175,14 @@ declare const editorMachine: StateMachine<
|
|
|
2022
2175
|
preventDefault: () => void
|
|
2023
2176
|
}
|
|
2024
2177
|
}
|
|
2178
|
+
| {
|
|
2179
|
+
type: 'set drag ghost'
|
|
2180
|
+
ghost: HTMLElement
|
|
2181
|
+
}
|
|
2025
2182
|
| {
|
|
2026
2183
|
type: 'dragstart'
|
|
2027
|
-
origin: Pick<EventPosition, 'selection'>
|
|
2028
2184
|
ghost?: HTMLElement
|
|
2185
|
+
origin: Pick<EventPosition, 'selection'>
|
|
2029
2186
|
}
|
|
2030
2187
|
| {
|
|
2031
2188
|
type: 'dragend'
|
|
@@ -2093,9 +2250,9 @@ declare const editorMachine: StateMachine<
|
|
|
2093
2250
|
selection: EditorSelection
|
|
2094
2251
|
initialValue: Array<PortableTextBlock> | undefined
|
|
2095
2252
|
internalDrag?: {
|
|
2096
|
-
ghost?: HTMLElement
|
|
2097
2253
|
origin: Pick<EventPosition, 'selection'>
|
|
2098
2254
|
}
|
|
2255
|
+
dragGhost?: HTMLElement
|
|
2099
2256
|
slateEditor?: PortableTextSlateEditor
|
|
2100
2257
|
},
|
|
2101
2258
|
| InternalPatchEvent
|
|
@@ -2149,10 +2306,14 @@ declare const editorMachine: StateMachine<
|
|
|
2149
2306
|
preventDefault: () => void
|
|
2150
2307
|
}
|
|
2151
2308
|
}
|
|
2309
|
+
| {
|
|
2310
|
+
type: 'set drag ghost'
|
|
2311
|
+
ghost: HTMLElement
|
|
2312
|
+
}
|
|
2152
2313
|
| {
|
|
2153
2314
|
type: 'dragstart'
|
|
2154
|
-
origin: Pick<EventPosition, 'selection'>
|
|
2155
2315
|
ghost?: HTMLElement
|
|
2316
|
+
origin: Pick<EventPosition, 'selection'>
|
|
2156
2317
|
}
|
|
2157
2318
|
| {
|
|
2158
2319
|
type: 'dragend'
|
|
@@ -2211,10 +2372,14 @@ declare const editorMachine: StateMachine<
|
|
|
2211
2372
|
preventDefault: () => void
|
|
2212
2373
|
}
|
|
2213
2374
|
}
|
|
2375
|
+
| {
|
|
2376
|
+
type: 'set drag ghost'
|
|
2377
|
+
ghost: HTMLElement
|
|
2378
|
+
}
|
|
2214
2379
|
| {
|
|
2215
2380
|
type: 'dragstart'
|
|
2216
|
-
origin: Pick<EventPosition, 'selection'>
|
|
2217
2381
|
ghost?: HTMLElement
|
|
2382
|
+
origin: Pick<EventPosition, 'selection'>
|
|
2218
2383
|
}
|
|
2219
2384
|
| {
|
|
2220
2385
|
type: 'dragend'
|
|
@@ -2237,9 +2402,9 @@ declare const editorMachine: StateMachine<
|
|
|
2237
2402
|
selection: EditorSelection
|
|
2238
2403
|
initialValue: Array<PortableTextBlock> | undefined
|
|
2239
2404
|
internalDrag?: {
|
|
2240
|
-
ghost?: HTMLElement
|
|
2241
2405
|
origin: Pick<EventPosition, 'selection'>
|
|
2242
2406
|
}
|
|
2407
|
+
dragGhost?: HTMLElement
|
|
2243
2408
|
slateEditor?: PortableTextSlateEditor
|
|
2244
2409
|
},
|
|
2245
2410
|
| InternalPatchEvent
|
|
@@ -2293,10 +2458,80 @@ declare const editorMachine: StateMachine<
|
|
|
2293
2458
|
preventDefault: () => void
|
|
2294
2459
|
}
|
|
2295
2460
|
}
|
|
2461
|
+
| {
|
|
2462
|
+
type: 'set drag ghost'
|
|
2463
|
+
ghost: HTMLElement
|
|
2464
|
+
}
|
|
2296
2465
|
| {
|
|
2297
2466
|
type: 'dragstart'
|
|
2467
|
+
ghost?: HTMLElement
|
|
2298
2468
|
origin: Pick<EventPosition, 'selection'>
|
|
2469
|
+
}
|
|
2470
|
+
| {
|
|
2471
|
+
type: 'dragend'
|
|
2472
|
+
}
|
|
2473
|
+
| {
|
|
2474
|
+
type: 'drop'
|
|
2475
|
+
},
|
|
2476
|
+
| InternalPatchEvent
|
|
2477
|
+
| MutationEvent
|
|
2478
|
+
| PatchesEvent
|
|
2479
|
+
| {
|
|
2480
|
+
type: 'update readOnly'
|
|
2481
|
+
readOnly: boolean
|
|
2482
|
+
}
|
|
2483
|
+
| {
|
|
2484
|
+
type: 'update maxBlocks'
|
|
2485
|
+
maxBlocks: number | undefined
|
|
2486
|
+
}
|
|
2487
|
+
| {
|
|
2488
|
+
type: 'add behavior'
|
|
2489
|
+
behaviorConfig: BehaviorConfig
|
|
2490
|
+
}
|
|
2491
|
+
| {
|
|
2492
|
+
type: 'remove behavior'
|
|
2493
|
+
behaviorConfig: BehaviorConfig
|
|
2494
|
+
}
|
|
2495
|
+
| {
|
|
2496
|
+
type: 'blur'
|
|
2497
|
+
editor: PortableTextSlateEditor
|
|
2498
|
+
}
|
|
2499
|
+
| {
|
|
2500
|
+
type: 'focus'
|
|
2501
|
+
editor: PortableTextSlateEditor
|
|
2502
|
+
}
|
|
2503
|
+
| {
|
|
2504
|
+
type: 'normalizing'
|
|
2505
|
+
}
|
|
2506
|
+
| {
|
|
2507
|
+
type: 'update selection'
|
|
2508
|
+
selection: EditorSelection
|
|
2509
|
+
}
|
|
2510
|
+
| {
|
|
2511
|
+
type: 'done normalizing'
|
|
2512
|
+
}
|
|
2513
|
+
| {
|
|
2514
|
+
type: 'done syncing value'
|
|
2515
|
+
}
|
|
2516
|
+
| {
|
|
2517
|
+
type: 'syncing value'
|
|
2518
|
+
}
|
|
2519
|
+
| {
|
|
2520
|
+
type: 'behavior event'
|
|
2521
|
+
behaviorEvent: BehaviorEvent
|
|
2522
|
+
editor: PortableTextSlateEditor
|
|
2523
|
+
nativeEvent?: {
|
|
2524
|
+
preventDefault: () => void
|
|
2525
|
+
}
|
|
2526
|
+
}
|
|
2527
|
+
| {
|
|
2528
|
+
type: 'set drag ghost'
|
|
2529
|
+
ghost: HTMLElement
|
|
2530
|
+
}
|
|
2531
|
+
| {
|
|
2532
|
+
type: 'dragstart'
|
|
2299
2533
|
ghost?: HTMLElement
|
|
2534
|
+
origin: Pick<EventPosition, 'selection'>
|
|
2300
2535
|
}
|
|
2301
2536
|
| {
|
|
2302
2537
|
type: 'dragend'
|
|
@@ -2304,6 +2539,32 @@ declare const editorMachine: StateMachine<
|
|
|
2304
2539
|
| {
|
|
2305
2540
|
type: 'drop'
|
|
2306
2541
|
},
|
|
2542
|
+
undefined,
|
|
2543
|
+
never,
|
|
2544
|
+
never,
|
|
2545
|
+
never,
|
|
2546
|
+
never,
|
|
2547
|
+
never
|
|
2548
|
+
>,
|
|
2549
|
+
ActionFunction<
|
|
2550
|
+
{
|
|
2551
|
+
behaviors: Set<BehaviorConfig>
|
|
2552
|
+
converters: Set<Converter>
|
|
2553
|
+
getLegacySchema: () => PortableTextMemberSchemaTypes
|
|
2554
|
+
keyGenerator: () => string
|
|
2555
|
+
pendingEvents: Array<InternalPatchEvent | MutationEvent>
|
|
2556
|
+
pendingIncomingPatchesEvents: Array<PatchesEvent>
|
|
2557
|
+
schema: EditorSchema
|
|
2558
|
+
initialReadOnly: boolean
|
|
2559
|
+
maxBlocks: number | undefined
|
|
2560
|
+
selection: EditorSelection
|
|
2561
|
+
initialValue: Array<PortableTextBlock> | undefined
|
|
2562
|
+
internalDrag?: {
|
|
2563
|
+
origin: Pick<EventPosition, 'selection'>
|
|
2564
|
+
}
|
|
2565
|
+
dragGhost?: HTMLElement
|
|
2566
|
+
slateEditor?: PortableTextSlateEditor
|
|
2567
|
+
},
|
|
2307
2568
|
| InternalPatchEvent
|
|
2308
2569
|
| MutationEvent
|
|
2309
2570
|
| PatchesEvent
|
|
@@ -2355,10 +2616,80 @@ declare const editorMachine: StateMachine<
|
|
|
2355
2616
|
preventDefault: () => void
|
|
2356
2617
|
}
|
|
2357
2618
|
}
|
|
2619
|
+
| {
|
|
2620
|
+
type: 'set drag ghost'
|
|
2621
|
+
ghost: HTMLElement
|
|
2622
|
+
}
|
|
2358
2623
|
| {
|
|
2359
2624
|
type: 'dragstart'
|
|
2625
|
+
ghost?: HTMLElement
|
|
2360
2626
|
origin: Pick<EventPosition, 'selection'>
|
|
2627
|
+
}
|
|
2628
|
+
| {
|
|
2629
|
+
type: 'dragend'
|
|
2630
|
+
}
|
|
2631
|
+
| {
|
|
2632
|
+
type: 'drop'
|
|
2633
|
+
},
|
|
2634
|
+
| InternalPatchEvent
|
|
2635
|
+
| MutationEvent
|
|
2636
|
+
| PatchesEvent
|
|
2637
|
+
| {
|
|
2638
|
+
type: 'update readOnly'
|
|
2639
|
+
readOnly: boolean
|
|
2640
|
+
}
|
|
2641
|
+
| {
|
|
2642
|
+
type: 'update maxBlocks'
|
|
2643
|
+
maxBlocks: number | undefined
|
|
2644
|
+
}
|
|
2645
|
+
| {
|
|
2646
|
+
type: 'add behavior'
|
|
2647
|
+
behaviorConfig: BehaviorConfig
|
|
2648
|
+
}
|
|
2649
|
+
| {
|
|
2650
|
+
type: 'remove behavior'
|
|
2651
|
+
behaviorConfig: BehaviorConfig
|
|
2652
|
+
}
|
|
2653
|
+
| {
|
|
2654
|
+
type: 'blur'
|
|
2655
|
+
editor: PortableTextSlateEditor
|
|
2656
|
+
}
|
|
2657
|
+
| {
|
|
2658
|
+
type: 'focus'
|
|
2659
|
+
editor: PortableTextSlateEditor
|
|
2660
|
+
}
|
|
2661
|
+
| {
|
|
2662
|
+
type: 'normalizing'
|
|
2663
|
+
}
|
|
2664
|
+
| {
|
|
2665
|
+
type: 'update selection'
|
|
2666
|
+
selection: EditorSelection
|
|
2667
|
+
}
|
|
2668
|
+
| {
|
|
2669
|
+
type: 'done normalizing'
|
|
2670
|
+
}
|
|
2671
|
+
| {
|
|
2672
|
+
type: 'done syncing value'
|
|
2673
|
+
}
|
|
2674
|
+
| {
|
|
2675
|
+
type: 'syncing value'
|
|
2676
|
+
}
|
|
2677
|
+
| {
|
|
2678
|
+
type: 'behavior event'
|
|
2679
|
+
behaviorEvent: BehaviorEvent
|
|
2680
|
+
editor: PortableTextSlateEditor
|
|
2681
|
+
nativeEvent?: {
|
|
2682
|
+
preventDefault: () => void
|
|
2683
|
+
}
|
|
2684
|
+
}
|
|
2685
|
+
| {
|
|
2686
|
+
type: 'set drag ghost'
|
|
2687
|
+
ghost: HTMLElement
|
|
2688
|
+
}
|
|
2689
|
+
| {
|
|
2690
|
+
type: 'dragstart'
|
|
2361
2691
|
ghost?: HTMLElement
|
|
2692
|
+
origin: Pick<EventPosition, 'selection'>
|
|
2362
2693
|
}
|
|
2363
2694
|
| {
|
|
2364
2695
|
type: 'dragend'
|
|
@@ -2442,9 +2773,9 @@ declare const editorMachine: StateMachine<
|
|
|
2442
2773
|
selection: EditorSelection
|
|
2443
2774
|
initialValue: Array<PortableTextBlock> | undefined
|
|
2444
2775
|
internalDrag?: {
|
|
2445
|
-
ghost?: HTMLElement
|
|
2446
2776
|
origin: Pick<EventPosition, 'selection'>
|
|
2447
2777
|
}
|
|
2778
|
+
dragGhost?: HTMLElement
|
|
2448
2779
|
slateEditor?: PortableTextSlateEditor
|
|
2449
2780
|
},
|
|
2450
2781
|
PatchesEvent,
|
|
@@ -2499,10 +2830,14 @@ declare const editorMachine: StateMachine<
|
|
|
2499
2830
|
preventDefault: () => void
|
|
2500
2831
|
}
|
|
2501
2832
|
}
|
|
2833
|
+
| {
|
|
2834
|
+
type: 'set drag ghost'
|
|
2835
|
+
ghost: HTMLElement
|
|
2836
|
+
}
|
|
2502
2837
|
| {
|
|
2503
2838
|
type: 'dragstart'
|
|
2504
|
-
origin: Pick<EventPosition, 'selection'>
|
|
2505
2839
|
ghost?: HTMLElement
|
|
2840
|
+
origin: Pick<EventPosition, 'selection'>
|
|
2506
2841
|
}
|
|
2507
2842
|
| {
|
|
2508
2843
|
type: 'dragend'
|
|
@@ -2786,12 +3121,6 @@ export declare type EditorSnapshot = {
|
|
|
2786
3121
|
beta: {
|
|
2787
3122
|
activeAnnotations: Array<string>
|
|
2788
3123
|
activeDecorators: Array<string>
|
|
2789
|
-
hasTag: HasTag
|
|
2790
|
-
internalDrag:
|
|
2791
|
-
| {
|
|
2792
|
-
origin: Pick<EventPosition, 'selection'>
|
|
2793
|
-
}
|
|
2794
|
-
| undefined
|
|
2795
3124
|
}
|
|
2796
3125
|
}
|
|
2797
3126
|
|
|
@@ -2887,8 +3216,6 @@ export declare type FocusChange = {
|
|
|
2887
3216
|
event: FocusEvent_2<HTMLDivElement, Element>
|
|
2888
3217
|
}
|
|
2889
3218
|
|
|
2890
|
-
declare type HasTag = ReturnType<EditorActor['getSnapshot']>['hasTag']
|
|
2891
|
-
|
|
2892
3219
|
declare interface History_2 {
|
|
2893
3220
|
redos: HistoryItem[]
|
|
2894
3221
|
undos: HistoryItem[]
|