@portabletext/editor 1.51.0 → 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-es/selector.is-selection-expanded.js +1 -1
- package/lib/behaviors/index.cjs.map +1 -1
- package/lib/behaviors/index.d.cts +26 -5
- package/lib/behaviors/index.d.ts +26 -5
- package/lib/behaviors/index.js.map +1 -1
- package/lib/index.cjs +434 -309
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +360 -31
- package/lib/index.d.ts +360 -31
- package/lib/index.js +455 -330
- package/lib/index.js.map +1 -1
- package/lib/plugins/index.d.cts +26 -5
- package/lib/plugins/index.d.ts +26 -5
- package/lib/selectors/index.d.cts +0 -14
- package/lib/selectors/index.d.ts +0 -14
- package/lib/utils/index.d.cts +0 -14
- package/lib/utils/index.d.ts +0 -14
- package/package.json +3 -3
- package/src/behaviors/behavior.abstract.delete.ts +0 -1
- 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 +4 -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 -8
- package/src/editor/editor-selector.ts +0 -1
- package/src/editor/editor-snapshot.ts +0 -13
- package/src/internal-utils/create-test-snapshot.ts +0 -1
- package/src/internal-utils/event-position.ts +41 -27
- package/src/internal-utils/selection-elements.ts +108 -0
- package/src/operations/behavior.operation.decorator.add.ts +0 -1
package/lib/index.d.cts
CHANGED
|
@@ -341,6 +341,7 @@ declare type BehaviorActionSet<TBehaviorEvent, TGuardResponse> = (
|
|
|
341
341
|
payload: {
|
|
342
342
|
snapshot: EditorSnapshot
|
|
343
343
|
event: TBehaviorEvent
|
|
344
|
+
dom: EditorDom
|
|
344
345
|
},
|
|
345
346
|
guardResponse: TGuardResponse,
|
|
346
347
|
) => Array<BehaviorAction>
|
|
@@ -369,6 +370,7 @@ declare type BehaviorEventTypeNamespace =
|
|
|
369
370
|
declare type BehaviorGuard<TBehaviorEvent, TGuardResponse> = (payload: {
|
|
370
371
|
snapshot: EditorSnapshot
|
|
371
372
|
event: TBehaviorEvent
|
|
373
|
+
dom: EditorDom
|
|
372
374
|
}) => TGuardResponse | false
|
|
373
375
|
|
|
374
376
|
/** @beta */
|
|
@@ -618,6 +620,8 @@ declare type DragBehaviorEvent =
|
|
|
618
620
|
| {
|
|
619
621
|
type: StrictExtract<NativeBehaviorEventType, 'drag.dragstart'>
|
|
620
622
|
originEvent: {
|
|
623
|
+
clientX: number
|
|
624
|
+
clientY: number
|
|
621
625
|
dataTransfer: DataTransfer
|
|
622
626
|
}
|
|
623
627
|
position: Pick<EventPosition, 'selection'>
|
|
@@ -646,6 +650,7 @@ declare type DragBehaviorEvent =
|
|
|
646
650
|
originEvent: {
|
|
647
651
|
dataTransfer: DataTransfer
|
|
648
652
|
}
|
|
653
|
+
dragOrigin?: Pick<EventPosition, 'selection'>
|
|
649
654
|
position: EventPosition
|
|
650
655
|
}
|
|
651
656
|
| {
|
|
@@ -653,6 +658,7 @@ declare type DragBehaviorEvent =
|
|
|
653
658
|
originEvent: {
|
|
654
659
|
dataTransfer: DataTransfer
|
|
655
660
|
}
|
|
661
|
+
dragOrigin?: Pick<EventPosition, 'selection'>
|
|
656
662
|
position: EventPosition
|
|
657
663
|
}
|
|
658
664
|
| {
|
|
@@ -830,6 +836,26 @@ export declare type EditorContext = {
|
|
|
830
836
|
value: Array<PortableTextBlock>
|
|
831
837
|
}
|
|
832
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
|
+
|
|
833
859
|
/**
|
|
834
860
|
* @public
|
|
835
861
|
*/
|
|
@@ -921,9 +947,9 @@ declare const editorMachine: StateMachine<
|
|
|
921
947
|
selection: EditorSelection
|
|
922
948
|
initialValue: Array<PortableTextBlock> | undefined
|
|
923
949
|
internalDrag?: {
|
|
924
|
-
ghost?: HTMLElement
|
|
925
950
|
origin: Pick<EventPosition, 'selection'>
|
|
926
951
|
}
|
|
952
|
+
dragGhost?: HTMLElement
|
|
927
953
|
slateEditor?: PortableTextSlateEditor
|
|
928
954
|
},
|
|
929
955
|
| InternalPatchEvent
|
|
@@ -977,10 +1003,14 @@ declare const editorMachine: StateMachine<
|
|
|
977
1003
|
preventDefault: () => void
|
|
978
1004
|
}
|
|
979
1005
|
}
|
|
1006
|
+
| {
|
|
1007
|
+
type: 'set drag ghost'
|
|
1008
|
+
ghost: HTMLElement
|
|
1009
|
+
}
|
|
980
1010
|
| {
|
|
981
1011
|
type: 'dragstart'
|
|
982
|
-
origin: Pick<EventPosition, 'selection'>
|
|
983
1012
|
ghost?: HTMLElement
|
|
1013
|
+
origin: Pick<EventPosition, 'selection'>
|
|
984
1014
|
}
|
|
985
1015
|
| {
|
|
986
1016
|
type: 'dragend'
|
|
@@ -1195,9 +1225,9 @@ declare const editorMachine: StateMachine<
|
|
|
1195
1225
|
selection: EditorSelection
|
|
1196
1226
|
initialValue: Array<PortableTextBlock> | undefined
|
|
1197
1227
|
internalDrag?: {
|
|
1198
|
-
ghost?: HTMLElement
|
|
1199
1228
|
origin: Pick<EventPosition, 'selection'>
|
|
1200
1229
|
}
|
|
1230
|
+
dragGhost?: HTMLElement
|
|
1201
1231
|
slateEditor?: PortableTextSlateEditor
|
|
1202
1232
|
},
|
|
1203
1233
|
| InternalPatchEvent
|
|
@@ -1251,10 +1281,14 @@ declare const editorMachine: StateMachine<
|
|
|
1251
1281
|
preventDefault: () => void
|
|
1252
1282
|
}
|
|
1253
1283
|
}
|
|
1284
|
+
| {
|
|
1285
|
+
type: 'set drag ghost'
|
|
1286
|
+
ghost: HTMLElement
|
|
1287
|
+
}
|
|
1254
1288
|
| {
|
|
1255
1289
|
type: 'dragstart'
|
|
1256
|
-
origin: Pick<EventPosition, 'selection'>
|
|
1257
1290
|
ghost?: HTMLElement
|
|
1291
|
+
origin: Pick<EventPosition, 'selection'>
|
|
1258
1292
|
}
|
|
1259
1293
|
| {
|
|
1260
1294
|
type: 'dragend'
|
|
@@ -1320,10 +1354,14 @@ declare const editorMachine: StateMachine<
|
|
|
1320
1354
|
preventDefault: () => void
|
|
1321
1355
|
}
|
|
1322
1356
|
}
|
|
1357
|
+
| {
|
|
1358
|
+
type: 'set drag ghost'
|
|
1359
|
+
ghost: HTMLElement
|
|
1360
|
+
}
|
|
1323
1361
|
| {
|
|
1324
1362
|
type: 'dragstart'
|
|
1325
|
-
origin: Pick<EventPosition, 'selection'>
|
|
1326
1363
|
ghost?: HTMLElement
|
|
1364
|
+
origin: Pick<EventPosition, 'selection'>
|
|
1327
1365
|
}
|
|
1328
1366
|
| {
|
|
1329
1367
|
type: 'dragend'
|
|
@@ -1368,9 +1406,9 @@ declare const editorMachine: StateMachine<
|
|
|
1368
1406
|
selection: EditorSelection
|
|
1369
1407
|
initialValue: Array<PortableTextBlock> | undefined
|
|
1370
1408
|
internalDrag?: {
|
|
1371
|
-
ghost?: HTMLElement
|
|
1372
1409
|
origin: Pick<EventPosition, 'selection'>
|
|
1373
1410
|
}
|
|
1411
|
+
dragGhost?: HTMLElement
|
|
1374
1412
|
slateEditor?: PortableTextSlateEditor
|
|
1375
1413
|
},
|
|
1376
1414
|
{
|
|
@@ -1428,10 +1466,14 @@ declare const editorMachine: StateMachine<
|
|
|
1428
1466
|
preventDefault: () => void
|
|
1429
1467
|
}
|
|
1430
1468
|
}
|
|
1469
|
+
| {
|
|
1470
|
+
type: 'set drag ghost'
|
|
1471
|
+
ghost: HTMLElement
|
|
1472
|
+
}
|
|
1431
1473
|
| {
|
|
1432
1474
|
type: 'dragstart'
|
|
1433
|
-
origin: Pick<EventPosition, 'selection'>
|
|
1434
1475
|
ghost?: HTMLElement
|
|
1476
|
+
origin: Pick<EventPosition, 'selection'>
|
|
1435
1477
|
}
|
|
1436
1478
|
| {
|
|
1437
1479
|
type: 'dragend'
|
|
@@ -1463,9 +1505,9 @@ declare const editorMachine: StateMachine<
|
|
|
1463
1505
|
selection: EditorSelection
|
|
1464
1506
|
initialValue: Array<PortableTextBlock> | undefined
|
|
1465
1507
|
internalDrag?: {
|
|
1466
|
-
ghost?: HTMLElement
|
|
1467
1508
|
origin: Pick<EventPosition, 'selection'>
|
|
1468
1509
|
}
|
|
1510
|
+
dragGhost?: HTMLElement
|
|
1469
1511
|
slateEditor?: PortableTextSlateEditor
|
|
1470
1512
|
},
|
|
1471
1513
|
{
|
|
@@ -1523,10 +1565,14 @@ declare const editorMachine: StateMachine<
|
|
|
1523
1565
|
preventDefault: () => void
|
|
1524
1566
|
}
|
|
1525
1567
|
}
|
|
1568
|
+
| {
|
|
1569
|
+
type: 'set drag ghost'
|
|
1570
|
+
ghost: HTMLElement
|
|
1571
|
+
}
|
|
1526
1572
|
| {
|
|
1527
1573
|
type: 'dragstart'
|
|
1528
|
-
origin: Pick<EventPosition, 'selection'>
|
|
1529
1574
|
ghost?: HTMLElement
|
|
1575
|
+
origin: Pick<EventPosition, 'selection'>
|
|
1530
1576
|
}
|
|
1531
1577
|
| {
|
|
1532
1578
|
type: 'dragend'
|
|
@@ -1555,9 +1601,9 @@ declare const editorMachine: StateMachine<
|
|
|
1555
1601
|
selection: EditorSelection
|
|
1556
1602
|
initialValue: Array<PortableTextBlock> | undefined
|
|
1557
1603
|
internalDrag?: {
|
|
1558
|
-
ghost?: HTMLElement
|
|
1559
1604
|
origin: Pick<EventPosition, 'selection'>
|
|
1560
1605
|
}
|
|
1606
|
+
dragGhost?: HTMLElement
|
|
1561
1607
|
slateEditor?: PortableTextSlateEditor
|
|
1562
1608
|
},
|
|
1563
1609
|
{
|
|
@@ -1615,10 +1661,14 @@ declare const editorMachine: StateMachine<
|
|
|
1615
1661
|
preventDefault: () => void
|
|
1616
1662
|
}
|
|
1617
1663
|
}
|
|
1664
|
+
| {
|
|
1665
|
+
type: 'set drag ghost'
|
|
1666
|
+
ghost: HTMLElement
|
|
1667
|
+
}
|
|
1618
1668
|
| {
|
|
1619
1669
|
type: 'dragstart'
|
|
1620
|
-
origin: Pick<EventPosition, 'selection'>
|
|
1621
1670
|
ghost?: HTMLElement
|
|
1671
|
+
origin: Pick<EventPosition, 'selection'>
|
|
1622
1672
|
}
|
|
1623
1673
|
| {
|
|
1624
1674
|
type: 'dragend'
|
|
@@ -1679,6 +1729,104 @@ declare const editorMachine: StateMachine<
|
|
|
1679
1729
|
>,
|
|
1680
1730
|
]
|
|
1681
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
|
+
}
|
|
1682
1830
|
}
|
|
1683
1831
|
readonly type: 'parallel'
|
|
1684
1832
|
readonly states: {
|
|
@@ -1706,9 +1854,9 @@ declare const editorMachine: StateMachine<
|
|
|
1706
1854
|
selection: EditorSelection
|
|
1707
1855
|
initialValue: Array<PortableTextBlock> | undefined
|
|
1708
1856
|
internalDrag?: {
|
|
1709
|
-
ghost?: HTMLElement
|
|
1710
1857
|
origin: Pick<EventPosition, 'selection'>
|
|
1711
1858
|
}
|
|
1859
|
+
dragGhost?: HTMLElement
|
|
1712
1860
|
slateEditor?: PortableTextSlateEditor
|
|
1713
1861
|
},
|
|
1714
1862
|
{
|
|
@@ -1748,9 +1896,9 @@ declare const editorMachine: StateMachine<
|
|
|
1748
1896
|
selection: EditorSelection
|
|
1749
1897
|
initialValue: Array<PortableTextBlock> | undefined
|
|
1750
1898
|
internalDrag?: {
|
|
1751
|
-
ghost?: HTMLElement
|
|
1752
1899
|
origin: Pick<EventPosition, 'selection'>
|
|
1753
1900
|
}
|
|
1901
|
+
dragGhost?: HTMLElement
|
|
1754
1902
|
slateEditor?: PortableTextSlateEditor
|
|
1755
1903
|
},
|
|
1756
1904
|
{
|
|
@@ -1785,9 +1933,9 @@ declare const editorMachine: StateMachine<
|
|
|
1785
1933
|
selection: EditorSelection
|
|
1786
1934
|
initialValue: Array<PortableTextBlock> | undefined
|
|
1787
1935
|
internalDrag?: {
|
|
1788
|
-
ghost?: HTMLElement
|
|
1789
1936
|
origin: Pick<EventPosition, 'selection'>
|
|
1790
1937
|
}
|
|
1938
|
+
dragGhost?: HTMLElement
|
|
1791
1939
|
slateEditor?: PortableTextSlateEditor
|
|
1792
1940
|
},
|
|
1793
1941
|
{
|
|
@@ -1821,9 +1969,9 @@ declare const editorMachine: StateMachine<
|
|
|
1821
1969
|
selection: EditorSelection
|
|
1822
1970
|
initialValue: Array<PortableTextBlock> | undefined
|
|
1823
1971
|
internalDrag?: {
|
|
1824
|
-
ghost?: HTMLElement
|
|
1825
1972
|
origin: Pick<EventPosition, 'selection'>
|
|
1826
1973
|
}
|
|
1974
|
+
dragGhost?: HTMLElement
|
|
1827
1975
|
slateEditor?: PortableTextSlateEditor
|
|
1828
1976
|
},
|
|
1829
1977
|
{
|
|
@@ -1857,9 +2005,9 @@ declare const editorMachine: StateMachine<
|
|
|
1857
2005
|
selection: EditorSelection
|
|
1858
2006
|
initialValue: Array<PortableTextBlock> | undefined
|
|
1859
2007
|
internalDrag?: {
|
|
1860
|
-
ghost?: HTMLElement
|
|
1861
2008
|
origin: Pick<EventPosition, 'selection'>
|
|
1862
2009
|
}
|
|
2010
|
+
dragGhost?: HTMLElement
|
|
1863
2011
|
slateEditor?: PortableTextSlateEditor
|
|
1864
2012
|
},
|
|
1865
2013
|
{
|
|
@@ -1917,10 +2065,14 @@ declare const editorMachine: StateMachine<
|
|
|
1917
2065
|
preventDefault: () => void
|
|
1918
2066
|
}
|
|
1919
2067
|
}
|
|
2068
|
+
| {
|
|
2069
|
+
type: 'set drag ghost'
|
|
2070
|
+
ghost: HTMLElement
|
|
2071
|
+
}
|
|
1920
2072
|
| {
|
|
1921
2073
|
type: 'dragstart'
|
|
1922
|
-
origin: Pick<EventPosition, 'selection'>
|
|
1923
2074
|
ghost?: HTMLElement
|
|
2075
|
+
origin: Pick<EventPosition, 'selection'>
|
|
1924
2076
|
}
|
|
1925
2077
|
| {
|
|
1926
2078
|
type: 'dragend'
|
|
@@ -1962,15 +2114,15 @@ declare const editorMachine: StateMachine<
|
|
|
1962
2114
|
selection: EditorSelection
|
|
1963
2115
|
initialValue: Array<PortableTextBlock> | undefined
|
|
1964
2116
|
internalDrag?: {
|
|
1965
|
-
ghost?: HTMLElement
|
|
1966
2117
|
origin: Pick<EventPosition, 'selection'>
|
|
1967
2118
|
}
|
|
2119
|
+
dragGhost?: HTMLElement
|
|
1968
2120
|
slateEditor?: PortableTextSlateEditor
|
|
1969
2121
|
},
|
|
1970
2122
|
{
|
|
1971
2123
|
type: 'dragstart'
|
|
1972
|
-
origin: Pick<EventPosition, 'selection'>
|
|
1973
2124
|
ghost?: HTMLElement
|
|
2125
|
+
origin: Pick<EventPosition, 'selection'>
|
|
1974
2126
|
},
|
|
1975
2127
|
| InternalPatchEvent
|
|
1976
2128
|
| MutationEvent
|
|
@@ -2023,10 +2175,14 @@ declare const editorMachine: StateMachine<
|
|
|
2023
2175
|
preventDefault: () => void
|
|
2024
2176
|
}
|
|
2025
2177
|
}
|
|
2178
|
+
| {
|
|
2179
|
+
type: 'set drag ghost'
|
|
2180
|
+
ghost: HTMLElement
|
|
2181
|
+
}
|
|
2026
2182
|
| {
|
|
2027
2183
|
type: 'dragstart'
|
|
2028
|
-
origin: Pick<EventPosition, 'selection'>
|
|
2029
2184
|
ghost?: HTMLElement
|
|
2185
|
+
origin: Pick<EventPosition, 'selection'>
|
|
2030
2186
|
}
|
|
2031
2187
|
| {
|
|
2032
2188
|
type: 'dragend'
|
|
@@ -2094,9 +2250,9 @@ declare const editorMachine: StateMachine<
|
|
|
2094
2250
|
selection: EditorSelection
|
|
2095
2251
|
initialValue: Array<PortableTextBlock> | undefined
|
|
2096
2252
|
internalDrag?: {
|
|
2097
|
-
ghost?: HTMLElement
|
|
2098
2253
|
origin: Pick<EventPosition, 'selection'>
|
|
2099
2254
|
}
|
|
2255
|
+
dragGhost?: HTMLElement
|
|
2100
2256
|
slateEditor?: PortableTextSlateEditor
|
|
2101
2257
|
},
|
|
2102
2258
|
| InternalPatchEvent
|
|
@@ -2150,10 +2306,14 @@ declare const editorMachine: StateMachine<
|
|
|
2150
2306
|
preventDefault: () => void
|
|
2151
2307
|
}
|
|
2152
2308
|
}
|
|
2309
|
+
| {
|
|
2310
|
+
type: 'set drag ghost'
|
|
2311
|
+
ghost: HTMLElement
|
|
2312
|
+
}
|
|
2153
2313
|
| {
|
|
2154
2314
|
type: 'dragstart'
|
|
2155
|
-
origin: Pick<EventPosition, 'selection'>
|
|
2156
2315
|
ghost?: HTMLElement
|
|
2316
|
+
origin: Pick<EventPosition, 'selection'>
|
|
2157
2317
|
}
|
|
2158
2318
|
| {
|
|
2159
2319
|
type: 'dragend'
|
|
@@ -2212,10 +2372,14 @@ declare const editorMachine: StateMachine<
|
|
|
2212
2372
|
preventDefault: () => void
|
|
2213
2373
|
}
|
|
2214
2374
|
}
|
|
2375
|
+
| {
|
|
2376
|
+
type: 'set drag ghost'
|
|
2377
|
+
ghost: HTMLElement
|
|
2378
|
+
}
|
|
2215
2379
|
| {
|
|
2216
2380
|
type: 'dragstart'
|
|
2217
|
-
origin: Pick<EventPosition, 'selection'>
|
|
2218
2381
|
ghost?: HTMLElement
|
|
2382
|
+
origin: Pick<EventPosition, 'selection'>
|
|
2219
2383
|
}
|
|
2220
2384
|
| {
|
|
2221
2385
|
type: 'dragend'
|
|
@@ -2238,9 +2402,9 @@ declare const editorMachine: StateMachine<
|
|
|
2238
2402
|
selection: EditorSelection
|
|
2239
2403
|
initialValue: Array<PortableTextBlock> | undefined
|
|
2240
2404
|
internalDrag?: {
|
|
2241
|
-
ghost?: HTMLElement
|
|
2242
2405
|
origin: Pick<EventPosition, 'selection'>
|
|
2243
2406
|
}
|
|
2407
|
+
dragGhost?: HTMLElement
|
|
2244
2408
|
slateEditor?: PortableTextSlateEditor
|
|
2245
2409
|
},
|
|
2246
2410
|
| InternalPatchEvent
|
|
@@ -2294,10 +2458,80 @@ declare const editorMachine: StateMachine<
|
|
|
2294
2458
|
preventDefault: () => void
|
|
2295
2459
|
}
|
|
2296
2460
|
}
|
|
2461
|
+
| {
|
|
2462
|
+
type: 'set drag ghost'
|
|
2463
|
+
ghost: HTMLElement
|
|
2464
|
+
}
|
|
2297
2465
|
| {
|
|
2298
2466
|
type: 'dragstart'
|
|
2467
|
+
ghost?: HTMLElement
|
|
2299
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'
|
|
2300
2533
|
ghost?: HTMLElement
|
|
2534
|
+
origin: Pick<EventPosition, 'selection'>
|
|
2301
2535
|
}
|
|
2302
2536
|
| {
|
|
2303
2537
|
type: 'dragend'
|
|
@@ -2305,6 +2539,32 @@ declare const editorMachine: StateMachine<
|
|
|
2305
2539
|
| {
|
|
2306
2540
|
type: 'drop'
|
|
2307
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
|
+
},
|
|
2308
2568
|
| InternalPatchEvent
|
|
2309
2569
|
| MutationEvent
|
|
2310
2570
|
| PatchesEvent
|
|
@@ -2356,10 +2616,80 @@ declare const editorMachine: StateMachine<
|
|
|
2356
2616
|
preventDefault: () => void
|
|
2357
2617
|
}
|
|
2358
2618
|
}
|
|
2619
|
+
| {
|
|
2620
|
+
type: 'set drag ghost'
|
|
2621
|
+
ghost: HTMLElement
|
|
2622
|
+
}
|
|
2359
2623
|
| {
|
|
2360
2624
|
type: 'dragstart'
|
|
2625
|
+
ghost?: HTMLElement
|
|
2361
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'
|
|
2362
2691
|
ghost?: HTMLElement
|
|
2692
|
+
origin: Pick<EventPosition, 'selection'>
|
|
2363
2693
|
}
|
|
2364
2694
|
| {
|
|
2365
2695
|
type: 'dragend'
|
|
@@ -2443,9 +2773,9 @@ declare const editorMachine: StateMachine<
|
|
|
2443
2773
|
selection: EditorSelection
|
|
2444
2774
|
initialValue: Array<PortableTextBlock> | undefined
|
|
2445
2775
|
internalDrag?: {
|
|
2446
|
-
ghost?: HTMLElement
|
|
2447
2776
|
origin: Pick<EventPosition, 'selection'>
|
|
2448
2777
|
}
|
|
2778
|
+
dragGhost?: HTMLElement
|
|
2449
2779
|
slateEditor?: PortableTextSlateEditor
|
|
2450
2780
|
},
|
|
2451
2781
|
PatchesEvent,
|
|
@@ -2500,10 +2830,14 @@ declare const editorMachine: StateMachine<
|
|
|
2500
2830
|
preventDefault: () => void
|
|
2501
2831
|
}
|
|
2502
2832
|
}
|
|
2833
|
+
| {
|
|
2834
|
+
type: 'set drag ghost'
|
|
2835
|
+
ghost: HTMLElement
|
|
2836
|
+
}
|
|
2503
2837
|
| {
|
|
2504
2838
|
type: 'dragstart'
|
|
2505
|
-
origin: Pick<EventPosition, 'selection'>
|
|
2506
2839
|
ghost?: HTMLElement
|
|
2840
|
+
origin: Pick<EventPosition, 'selection'>
|
|
2507
2841
|
}
|
|
2508
2842
|
| {
|
|
2509
2843
|
type: 'dragend'
|
|
@@ -2787,11 +3121,6 @@ export declare type EditorSnapshot = {
|
|
|
2787
3121
|
beta: {
|
|
2788
3122
|
activeAnnotations: Array<string>
|
|
2789
3123
|
activeDecorators: Array<string>
|
|
2790
|
-
internalDrag:
|
|
2791
|
-
| {
|
|
2792
|
-
origin: Pick<EventPosition, 'selection'>
|
|
2793
|
-
}
|
|
2794
|
-
| undefined
|
|
2795
3124
|
}
|
|
2796
3125
|
}
|
|
2797
3126
|
|