@portabletext/editor 7.3.4 → 7.5.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-dts/behavior.types.action.d.ts +141 -57
- package/lib/_chunks-dts/behavior.types.action.d.ts.map +1 -1
- package/lib/_chunks-es/get-parent.js +10 -12
- package/lib/_chunks-es/get-parent.js.map +1 -1
- package/lib/_chunks-es/get-path-sub-schema.js +19 -41
- package/lib/_chunks-es/get-path-sub-schema.js.map +1 -1
- package/lib/_chunks-es/selector.is-at-the-start-of-block.js +2 -0
- package/lib/_chunks-es/selector.is-at-the-start-of-block.js.map +1 -1
- package/lib/behaviors/index.d.ts +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.js +383 -89
- package/lib/index.js.map +1 -1
- package/lib/plugins/index.d.ts +1 -1
- package/lib/selectors/index.d.ts +1 -1
- package/lib/traversal/index.d.ts +4 -4
- package/lib/traversal/index.d.ts.map +1 -1
- package/lib/utils/index.d.ts +1 -1
- package/package.json +2 -2
|
@@ -78,12 +78,12 @@ type IndexTuple = [number | '', number | ''];
|
|
|
78
78
|
* - An IndexTuple (range selection)
|
|
79
79
|
* @public
|
|
80
80
|
*/
|
|
81
|
-
type PathSegment
|
|
81
|
+
type PathSegment = string | number | KeyedSegment | IndexTuple;
|
|
82
82
|
/**
|
|
83
83
|
* A path is an array of path segments that describes a location in a document.
|
|
84
84
|
* @public
|
|
85
85
|
*/
|
|
86
|
-
type Path = PathSegment
|
|
86
|
+
type Path = PathSegment[];
|
|
87
87
|
/**
|
|
88
88
|
* A path to a block in the value.
|
|
89
89
|
*
|
|
@@ -102,22 +102,6 @@ type AnnotationPath = Path;
|
|
|
102
102
|
* @public
|
|
103
103
|
*/
|
|
104
104
|
type ChildPath = Path;
|
|
105
|
-
/**
|
|
106
|
-
* A path segment identifies a position in the document tree.
|
|
107
|
-
*
|
|
108
|
-
* - `KeyedSegment` (`{_key: string}`) identifies a node by its key
|
|
109
|
-
* - `string` identifies a child field name (e.g. 'children', 'rows', 'cells')
|
|
110
|
-
* - `number` identifies a position in an array (used for empty container inserts
|
|
111
|
-
* and rendering indexed paths)
|
|
112
|
-
* - `IndexTuple` (`[number | '', number | '']`) represents a range selection
|
|
113
|
-
*/
|
|
114
|
-
type PathSegment = KeyedSegment | string | number | IndexTuple;
|
|
115
|
-
/**
|
|
116
|
-
* A `Path` is a list of segments that describe a node's exact position in
|
|
117
|
-
* the document tree. Segments alternate between keyed node references and
|
|
118
|
-
* field names: `[{_key: 'b1'}, 'children', {_key: 's1'}]`.
|
|
119
|
-
*/
|
|
120
|
-
type Path$1 = PathSegment[];
|
|
121
105
|
/**
|
|
122
106
|
* @alpha
|
|
123
107
|
*
|
|
@@ -142,7 +126,7 @@ type ContainerRenderProps = {
|
|
|
142
126
|
children: ReactElement;
|
|
143
127
|
focused: boolean;
|
|
144
128
|
node: PortableTextObject;
|
|
145
|
-
path: Path
|
|
129
|
+
path: Path;
|
|
146
130
|
readOnly: boolean;
|
|
147
131
|
selected: boolean;
|
|
148
132
|
/**
|
|
@@ -176,7 +160,7 @@ type SpanRenderProps = {
|
|
|
176
160
|
children: ReactElement;
|
|
177
161
|
focused: boolean;
|
|
178
162
|
node: PortableTextSpan;
|
|
179
|
-
path: Path
|
|
163
|
+
path: Path;
|
|
180
164
|
readOnly: boolean;
|
|
181
165
|
selected: boolean;
|
|
182
166
|
/**
|
|
@@ -203,7 +187,7 @@ type BlockObjectRenderProps = {
|
|
|
203
187
|
children: ReactElement;
|
|
204
188
|
focused: boolean;
|
|
205
189
|
node: PortableTextObject;
|
|
206
|
-
path: Path
|
|
190
|
+
path: Path;
|
|
207
191
|
readOnly: boolean;
|
|
208
192
|
selected: boolean;
|
|
209
193
|
/**
|
|
@@ -230,7 +214,7 @@ type InlineObjectRenderProps = {
|
|
|
230
214
|
children: ReactElement;
|
|
231
215
|
focused: boolean;
|
|
232
216
|
node: PortableTextObject;
|
|
233
|
-
path: Path
|
|
217
|
+
path: Path;
|
|
234
218
|
readOnly: boolean;
|
|
235
219
|
selected: boolean;
|
|
236
220
|
/**
|
|
@@ -324,7 +308,7 @@ type TextBlockRenderProps = {
|
|
|
324
308
|
children: ReactElement;
|
|
325
309
|
focused: boolean;
|
|
326
310
|
node: PortableTextTextBlock;
|
|
327
|
-
path: Path
|
|
311
|
+
path: Path;
|
|
328
312
|
readOnly: boolean;
|
|
329
313
|
selected: boolean;
|
|
330
314
|
/**
|
|
@@ -437,7 +421,7 @@ declare function defineContainer<const TType$1 extends string>(config: {
|
|
|
437
421
|
children: ReactElement;
|
|
438
422
|
focused: boolean;
|
|
439
423
|
node: ContainerNodeForType<TType$1>;
|
|
440
|
-
path: Path
|
|
424
|
+
path: Path;
|
|
441
425
|
readOnly: boolean;
|
|
442
426
|
selected: boolean;
|
|
443
427
|
renderDefault: (props: ContainerRenderProps) => ReactElement;
|
|
@@ -727,7 +711,7 @@ type TraversalSnapshot = {
|
|
|
727
711
|
containers: Containers;
|
|
728
712
|
value: Array<Node$1>;
|
|
729
713
|
};
|
|
730
|
-
blockIndexMap:
|
|
714
|
+
blockIndexMap: ReadonlyMap<string, number>;
|
|
731
715
|
};
|
|
732
716
|
/**
|
|
733
717
|
* Walk the editor value following `path` and return the
|
|
@@ -756,7 +740,7 @@ type TraversalSnapshot = {
|
|
|
756
740
|
*
|
|
757
741
|
* @alpha
|
|
758
742
|
*/
|
|
759
|
-
declare function resolveContainerAt(containers: Containers, value: ReadonlyArray<Node$1>, path: Path
|
|
743
|
+
declare function resolveContainerAt(containers: Containers, value: ReadonlyArray<Node$1>, path: Path): RegisteredContainer | RegisteredPositional | undefined;
|
|
760
744
|
/**
|
|
761
745
|
* @public
|
|
762
746
|
* @deprecated Use `useEditor()` instead
|
|
@@ -1456,7 +1440,7 @@ type TextDirection = 'forward' | 'backward';
|
|
|
1456
1440
|
* only refer to `Text` nodes.
|
|
1457
1441
|
*/
|
|
1458
1442
|
interface Point {
|
|
1459
|
-
path: Path
|
|
1443
|
+
path: Path;
|
|
1460
1444
|
offset: number;
|
|
1461
1445
|
}
|
|
1462
1446
|
/**
|
|
@@ -1468,48 +1452,69 @@ interface Range {
|
|
|
1468
1452
|
anchor: Point;
|
|
1469
1453
|
focus: Point;
|
|
1470
1454
|
}
|
|
1455
|
+
/**
|
|
1456
|
+
* Insert a node before or after the sibling at `path`.
|
|
1457
|
+
*
|
|
1458
|
+
* @beta
|
|
1459
|
+
*/
|
|
1471
1460
|
type InsertOperation = {
|
|
1472
1461
|
type: 'insert';
|
|
1473
|
-
path: Path
|
|
1462
|
+
path: Path;
|
|
1474
1463
|
node: Node$1;
|
|
1475
1464
|
position: 'before' | 'after';
|
|
1476
1465
|
inverse?: UnsetOperationData;
|
|
1477
1466
|
};
|
|
1467
|
+
/**
|
|
1468
|
+
* Insert `text` into the span at `path`, at `offset`.
|
|
1469
|
+
*
|
|
1470
|
+
* @beta
|
|
1471
|
+
*/
|
|
1478
1472
|
type InsertTextOperation = {
|
|
1479
1473
|
type: 'insert.text';
|
|
1480
|
-
path: Path
|
|
1474
|
+
path: Path;
|
|
1481
1475
|
offset: number;
|
|
1482
1476
|
text: string;
|
|
1483
1477
|
};
|
|
1478
|
+
/**
|
|
1479
|
+
* Remove `text` from the span at `path`, starting at `offset`.
|
|
1480
|
+
*
|
|
1481
|
+
* @beta
|
|
1482
|
+
*/
|
|
1484
1483
|
type RemoveTextOperation = {
|
|
1485
1484
|
type: 'remove.text';
|
|
1486
|
-
path: Path
|
|
1485
|
+
path: Path;
|
|
1487
1486
|
offset: number;
|
|
1488
1487
|
text: string;
|
|
1489
1488
|
};
|
|
1490
1489
|
/**
|
|
1491
1490
|
* Data for a `set` inverse (no nested inverse field).
|
|
1491
|
+
*
|
|
1492
|
+
* @beta
|
|
1492
1493
|
*/
|
|
1493
1494
|
type SetOperationData = {
|
|
1494
1495
|
type: 'set';
|
|
1495
|
-
path: Path
|
|
1496
|
+
path: Path;
|
|
1496
1497
|
value: unknown;
|
|
1497
1498
|
};
|
|
1498
1499
|
/**
|
|
1499
1500
|
* Data for an `insert` inverse (no nested inverse field).
|
|
1501
|
+
*
|
|
1502
|
+
* @beta
|
|
1500
1503
|
*/
|
|
1501
1504
|
type InsertOperationData = {
|
|
1502
1505
|
type: 'insert';
|
|
1503
|
-
path: Path
|
|
1506
|
+
path: Path;
|
|
1504
1507
|
node: Node$1;
|
|
1505
1508
|
position: 'before' | 'after';
|
|
1506
1509
|
};
|
|
1507
1510
|
/**
|
|
1508
1511
|
* Data for an `unset` inverse (no nested inverse field).
|
|
1512
|
+
*
|
|
1513
|
+
* @beta
|
|
1509
1514
|
*/
|
|
1510
1515
|
type UnsetOperationData = {
|
|
1511
1516
|
type: 'unset';
|
|
1512
|
-
path: Path
|
|
1517
|
+
path: Path;
|
|
1513
1518
|
};
|
|
1514
1519
|
/**
|
|
1515
1520
|
* Set a property on a node. The path is `[...nodePath, propertyName]`.
|
|
@@ -1517,10 +1522,12 @@ type UnsetOperationData = {
|
|
|
1517
1522
|
* When `inverse` is provided, the operation can be undone. Remote operations
|
|
1518
1523
|
* (applied via `withRemoteChanges`) skip the history plugin and do not need
|
|
1519
1524
|
* inverse data.
|
|
1525
|
+
*
|
|
1526
|
+
* @beta
|
|
1520
1527
|
*/
|
|
1521
1528
|
type SetOperation = {
|
|
1522
1529
|
type: 'set';
|
|
1523
|
-
path: Path
|
|
1530
|
+
path: Path;
|
|
1524
1531
|
value: unknown;
|
|
1525
1532
|
inverse?: SetOperationData | UnsetOperationData;
|
|
1526
1533
|
};
|
|
@@ -1530,10 +1537,15 @@ type SetOperation = {
|
|
|
1530
1537
|
* Property removal: path is `[...nodePath, propertyName]` (last segment is a string).
|
|
1531
1538
|
* Node removal: path is `[...parentPath, arrayFieldName, {_key: nodeKey}]`
|
|
1532
1539
|
* (last segment is a keyed segment pointing to the node to remove).
|
|
1540
|
+
*
|
|
1541
|
+
* The `inverse` of a node removal carries the removed node; the operation
|
|
1542
|
+
* itself only carries its path.
|
|
1543
|
+
*
|
|
1544
|
+
* @beta
|
|
1533
1545
|
*/
|
|
1534
1546
|
type UnsetOperation = {
|
|
1535
1547
|
type: 'unset';
|
|
1536
|
-
path: Path
|
|
1548
|
+
path: Path;
|
|
1537
1549
|
inverse?: SetOperationData | InsertOperationData;
|
|
1538
1550
|
};
|
|
1539
1551
|
type SetSelectionOperation = {
|
|
@@ -1549,12 +1561,26 @@ type SetSelectionOperation = {
|
|
|
1549
1561
|
properties: Range;
|
|
1550
1562
|
newProperties: null;
|
|
1551
1563
|
};
|
|
1552
|
-
|
|
1564
|
+
/**
|
|
1565
|
+
* A low-level operation applied by the editor engine. Every change to the
|
|
1566
|
+
* editor (local edits, remote patches, value sync, normalization fixes,
|
|
1567
|
+
* undo/redo) is expressed as a sequence of these operations.
|
|
1568
|
+
*
|
|
1569
|
+
* The vocabulary is closed: the dot-named operations (`insert.text`,
|
|
1570
|
+
* `remove.text`) are not namespaces that grow members.
|
|
1571
|
+
*
|
|
1572
|
+
* `inverse` is present when the engine needs the operation to be
|
|
1573
|
+
* reversible (local structural operations) and carries what is needed to
|
|
1574
|
+
* reverse it. Operations applied from remote patches do not carry it.
|
|
1575
|
+
*
|
|
1576
|
+
* @beta
|
|
1577
|
+
*/
|
|
1578
|
+
type EngineOperation = InsertOperation | SetOperation | UnsetOperation | SetSelectionOperation | InsertTextOperation | RemoveTextOperation;
|
|
1553
1579
|
type DecoratedRange = Range & {
|
|
1554
1580
|
rangeDecoration: RangeDecoration;
|
|
1555
1581
|
};
|
|
1556
1582
|
/**
|
|
1557
|
-
* The operation channel is the single place to observe every `
|
|
1583
|
+
* The operation channel is the single place to observe every `EngineOperation` the
|
|
1558
1584
|
* engine applies.
|
|
1559
1585
|
*
|
|
1560
1586
|
* Guarantees:
|
|
@@ -1575,7 +1601,7 @@ type OperationEvent = {
|
|
|
1575
1601
|
* populated and inserted nodes may be re-keyed — so `after` listeners
|
|
1576
1602
|
* observe the final operation.
|
|
1577
1603
|
*/
|
|
1578
|
-
operation:
|
|
1604
|
+
operation: EngineOperation;
|
|
1579
1605
|
/**
|
|
1580
1606
|
* `editor.snapshot.context.value` captured at apply entry. Operations
|
|
1581
1607
|
* replace the value array instead of mutating it, so this reference keeps
|
|
@@ -1613,19 +1639,19 @@ type OperationListener = (event: OperationEvent) => void;
|
|
|
1613
1639
|
* `Point` or `Range`. This eliminates the need for developers to manage
|
|
1614
1640
|
* converting between the different interfaces in their own code base.
|
|
1615
1641
|
*/
|
|
1616
|
-
type Location = Path
|
|
1642
|
+
type Location = Path | Point | Range;
|
|
1617
1643
|
/**
|
|
1618
1644
|
* `PathRef` objects keep a specific path in a document synced over time as new
|
|
1619
1645
|
* operations are applied to the editor. You can access their `current` property
|
|
1620
1646
|
* at any time for the up-to-date path value.
|
|
1621
1647
|
*/
|
|
1622
1648
|
interface PathRef {
|
|
1623
|
-
current: Path
|
|
1649
|
+
current: Path | null;
|
|
1624
1650
|
affinity: 'forward' | 'backward' | null;
|
|
1625
|
-
unref(): Path
|
|
1651
|
+
unref(): Path | null;
|
|
1626
1652
|
}
|
|
1627
1653
|
interface PathRefInterface {
|
|
1628
|
-
transform: (ref: PathRef, op:
|
|
1654
|
+
transform: (ref: PathRef, op: EngineOperation) => void;
|
|
1629
1655
|
}
|
|
1630
1656
|
declare const PathRef: PathRefInterface;
|
|
1631
1657
|
/**
|
|
@@ -1639,7 +1665,7 @@ interface PointRef {
|
|
|
1639
1665
|
unref(): Point | null;
|
|
1640
1666
|
}
|
|
1641
1667
|
interface PointRefInterface {
|
|
1642
|
-
transform: (ref: PointRef, op:
|
|
1668
|
+
transform: (ref: PointRef, op: EngineOperation) => void;
|
|
1643
1669
|
}
|
|
1644
1670
|
declare const PointRef: PointRefInterface;
|
|
1645
1671
|
/**
|
|
@@ -1657,24 +1683,24 @@ interface RangeRef {
|
|
|
1657
1683
|
* by plugins that wish to add their own helpers and implement new behaviors.
|
|
1658
1684
|
*/
|
|
1659
1685
|
interface BaseEditor {
|
|
1660
|
-
operations:
|
|
1686
|
+
operations: EngineOperation[];
|
|
1661
1687
|
operationListeners: {
|
|
1662
1688
|
before: Array<OperationListener>;
|
|
1663
1689
|
after: Array<OperationListener>;
|
|
1664
1690
|
};
|
|
1665
|
-
dirtyPaths: Path
|
|
1691
|
+
dirtyPaths: Path[];
|
|
1666
1692
|
dirtyPathKeys: Set<string>;
|
|
1667
1693
|
flushing: boolean;
|
|
1668
1694
|
normalizing: boolean;
|
|
1669
1695
|
pathRefs: Set<PathRef>;
|
|
1670
1696
|
pointRefs: Set<PointRef>;
|
|
1671
1697
|
rangeRefs: Set<RangeRef>;
|
|
1672
|
-
apply: (operation:
|
|
1673
|
-
normalizeNode: (entry: [Editor$1 | Node$1, Path
|
|
1674
|
-
operation?:
|
|
1698
|
+
apply: (operation: EngineOperation) => void;
|
|
1699
|
+
normalizeNode: (entry: [Editor$1 | Node$1, Path], options?: {
|
|
1700
|
+
operation?: EngineOperation;
|
|
1675
1701
|
}) => void;
|
|
1676
1702
|
onChange: (options?: {
|
|
1677
|
-
operation?:
|
|
1703
|
+
operation?: EngineOperation;
|
|
1678
1704
|
}) => void;
|
|
1679
1705
|
shouldNormalize: ({
|
|
1680
1706
|
iteration,
|
|
@@ -1683,8 +1709,8 @@ interface BaseEditor {
|
|
|
1683
1709
|
}: {
|
|
1684
1710
|
iteration: number;
|
|
1685
1711
|
initialDirtyPathsLength: number;
|
|
1686
|
-
dirtyPaths: Path
|
|
1687
|
-
operation?:
|
|
1712
|
+
dirtyPaths: Path[];
|
|
1713
|
+
operation?: EngineOperation;
|
|
1688
1714
|
}) => boolean;
|
|
1689
1715
|
select: (target: Location) => void;
|
|
1690
1716
|
setSelection: (props: Partial<Range>) => void;
|
|
@@ -1697,7 +1723,7 @@ type StringDiff = {
|
|
|
1697
1723
|
};
|
|
1698
1724
|
type TextDiff = {
|
|
1699
1725
|
id: number;
|
|
1700
|
-
path: Path
|
|
1726
|
+
path: Path;
|
|
1701
1727
|
diff: StringDiff;
|
|
1702
1728
|
};
|
|
1703
1729
|
/**
|
|
@@ -1736,7 +1762,7 @@ interface DOMEditor extends BaseEditor {
|
|
|
1736
1762
|
composing: boolean;
|
|
1737
1763
|
userSelection: RangeRef | null;
|
|
1738
1764
|
onContextChange: ((options?: {
|
|
1739
|
-
operation?:
|
|
1765
|
+
operation?: EngineOperation;
|
|
1740
1766
|
}) => void) | null;
|
|
1741
1767
|
scheduleFlush: (() => void) | null;
|
|
1742
1768
|
pendingDiffs: TextDiff[];
|
|
@@ -1824,7 +1850,7 @@ interface DOMEditorInterface {
|
|
|
1824
1850
|
}
|
|
1825
1851
|
declare const DOMEditor: DOMEditorInterface;
|
|
1826
1852
|
type HistoryItem = {
|
|
1827
|
-
operations:
|
|
1853
|
+
operations: EngineOperation[];
|
|
1828
1854
|
timestamp: Date;
|
|
1829
1855
|
};
|
|
1830
1856
|
interface History {
|
|
@@ -1905,7 +1931,7 @@ type EditorContext = {
|
|
|
1905
1931
|
*/
|
|
1906
1932
|
type EditorSnapshot = {
|
|
1907
1933
|
context: EditorContext;
|
|
1908
|
-
blockIndexMap:
|
|
1934
|
+
blockIndexMap: ReadonlyMap<string, number>;
|
|
1909
1935
|
/**
|
|
1910
1936
|
* @beta
|
|
1911
1937
|
* Subject to change
|
|
@@ -1955,6 +1981,39 @@ type Behavior<TBehaviorEventType extends '*' | `${BehaviorEventTypeNamespace}.*`
|
|
|
1955
1981
|
*
|
|
1956
1982
|
*/
|
|
1957
1983
|
declare function defineBehavior<TPayload extends Record<string, unknown>, TBehaviorEventType extends '*' | `${BehaviorEventTypeNamespace}.*` | BehaviorEvent['type'] = CustomBehaviorEvent['type'], TGuardResponse = true>(behavior: Behavior<TBehaviorEventType, TGuardResponse, ResolveBehaviorEvent<TBehaviorEventType, TPayload>>): Behavior;
|
|
1984
|
+
/**
|
|
1985
|
+
* The document-changing operations emitted through
|
|
1986
|
+
* `editor.on('operation', ...)`. Every change to the editor (local edits,
|
|
1987
|
+
* remote patches, value sync, normalization fixes, undo/redo) is expressed
|
|
1988
|
+
* as a sequence of these five operations.
|
|
1989
|
+
*
|
|
1990
|
+
* The vocabulary is closed: there are exactly five, listed explicitly so
|
|
1991
|
+
* that a new engine operation never becomes public surface by default, and
|
|
1992
|
+
* the dot-named ones (`insert.text`, `remove.text`) are not namespaces that
|
|
1993
|
+
* grow members.
|
|
1994
|
+
*
|
|
1995
|
+
* Selection movements are not emitted on this stream; subscribe to the
|
|
1996
|
+
* `selection` event instead.
|
|
1997
|
+
*
|
|
1998
|
+
* Operation objects are the engine's own, passed by reference: treat them
|
|
1999
|
+
* as read-only and copy anything you retain beyond the listener call.
|
|
2000
|
+
*
|
|
2001
|
+
* Delivery order: normalization fix operations are delivered adjacent to
|
|
2002
|
+
* the operation that triggered them, but whether a fix arrives before or
|
|
2003
|
+
* after its trigger depends on how the trigger was applied (a fix
|
|
2004
|
+
* re-enters the engine's apply, so an unbatched trigger delivers the fix
|
|
2005
|
+
* first; batched applies deliver fixes after the batch). Do not assume
|
|
2006
|
+
* delivery order equals application order under normalization: seed
|
|
2007
|
+
* derived state from `editor.getSnapshot()` and recompute on change
|
|
2008
|
+
* rather than replaying deltas blindly.
|
|
2009
|
+
*
|
|
2010
|
+
* `inverse`, when present, reflects what the engine itself needs to make
|
|
2011
|
+
* the operation reversible. Its presence follows the engine's history
|
|
2012
|
+
* policy and is not a stable per-operation contract.
|
|
2013
|
+
*
|
|
2014
|
+
* @beta
|
|
2015
|
+
*/
|
|
2016
|
+
type Operation = InsertOperation | InsertTextOperation | RemoveTextOperation | SetOperation | UnsetOperation;
|
|
1958
2017
|
/**
|
|
1959
2018
|
* @public
|
|
1960
2019
|
*/
|
|
@@ -1980,7 +2039,29 @@ type EditorEmittedEvent = {
|
|
|
1980
2039
|
* @deprecated Will be removed in the next major version
|
|
1981
2040
|
*/
|
|
1982
2041
|
type: 'loading';
|
|
1983
|
-
} | MutationEvent |
|
|
2042
|
+
} | MutationEvent | {
|
|
2043
|
+
/**
|
|
2044
|
+
* @beta
|
|
2045
|
+
* Emitted synchronously for every document-changing operation the
|
|
2046
|
+
* engine applies (`set.selection` is excluded; the `selection` event
|
|
2047
|
+
* serves selection observers), including operations from initial
|
|
2048
|
+
* value sync and normalization, unlike `patch` and `mutation`
|
|
2049
|
+
* events, which are held back until the editor is dirty. Do not
|
|
2050
|
+
* dispatch editor events from a listener; read current state via
|
|
2051
|
+
* `editor.getSnapshot()`.
|
|
2052
|
+
*
|
|
2053
|
+
* The `operation` object is the engine's own, passed by reference:
|
|
2054
|
+
* treat it as read-only and copy anything you retain. Normalization
|
|
2055
|
+
* fix operations are delivered adjacent to the operation that
|
|
2056
|
+
* triggered them, but not in a guaranteed order; see the
|
|
2057
|
+
* {@link Operation} docs for the delivery-order contract. Subscribers
|
|
2058
|
+
* attached after setup receive only subsequent operations: seed
|
|
2059
|
+
* derived state from `editor.getSnapshot()` when subscribing, then
|
|
2060
|
+
* apply deltas.
|
|
2061
|
+
*/
|
|
2062
|
+
type: 'operation';
|
|
2063
|
+
operation: Operation;
|
|
2064
|
+
} | PatchEvent | {
|
|
1984
2065
|
type: 'read only';
|
|
1985
2066
|
} | {
|
|
1986
2067
|
type: 'ready';
|
|
@@ -2389,6 +2470,9 @@ declare const editorMachine: xstate31.StateMachine<{
|
|
|
2389
2470
|
value: Array<PortableTextBlock> | undefined;
|
|
2390
2471
|
} | {
|
|
2391
2472
|
type: "loading";
|
|
2473
|
+
} | {
|
|
2474
|
+
type: "operation";
|
|
2475
|
+
operation: Operation;
|
|
2392
2476
|
} | {
|
|
2393
2477
|
type: "read only";
|
|
2394
2478
|
} | {
|
|
@@ -3183,5 +3267,5 @@ type BehaviorActionSet<TBehaviorEvent, TGuardResponse> = (payload: {
|
|
|
3183
3267
|
event: TBehaviorEvent;
|
|
3184
3268
|
dom: EditorDom;
|
|
3185
3269
|
}, guardResponse: TGuardResponse) => Array<BehaviorAction>;
|
|
3186
|
-
export {
|
|
3270
|
+
export { EditorContext as $, SpanRender as $t, PortableTextTextBlock$1 as A, HotkeyOptions as At, EditorSelector as B, RegisteredPositional as Bt, ListDefinition as C, RenderEditableFunction as Ct, PortableTextChild$1 as D, ScrollSelectionIntoViewFunction as Dt, PortableTextBlock$1 as E, RenderStyleFunction as Et, BlockOffset as F, EditorSchema as Ft, EditorConfig as G, Container as Gt, EditorProvider as H, BlockObject as Ht, useEditor as I, Containers as It, MutationEvent as J, InlineObject as Jt, EditorEvent as K, ContainerRender as Kt, defaultKeyGenerator as L, RegisteredBlockObject as Lt, StyleDefinition as M, resolveContainerAt as Mt, StyleSchemaType$1 as N, TraversalSnapshot as Nt, PortableTextObject$1 as O, PortableTextEditable as Ot, defineSchema as P, Node$1 as Pt, BehaviorGuard as Q, Span as Qt, usePortableTextEditorSelection as R, RegisteredContainer as Rt, InlineObjectSchemaType$1 as S, RenderDecoratorFunction as St, Patch$1 as T, RenderPlaceholderFunction as Tt, EditorProviderProps as U, BlockObjectRender as Ut, useEditorSelector as V, RegisteredSpan as Vt, Editor as W, BlockObjectRenderProps as Wt, Behavior as X, InlineObjectRenderProps as Xt, Operation as Y, InlineObjectRender as Yt, defineBehavior as Z, RegistrableNode as Zt, BlockObjectSchemaType$1 as _, RangeDecoration as _t, forward as a, defineContainer as an, BlockListItemRenderProps as at, FieldDefinition$1 as b, RenderBlockFunction as bt, CustomBehaviorEvent as c, defineTextBlock as cn, EditableAPIDeleteOptions as ct, SyntheticBehaviorEvent as d, ChildPath as dn, InvalidValueResolution as dt, SpanRenderProps as en, EditorSnapshot as et, PatchesEvent as f, KeyedSegment as fn, OnCopyFn as ft, BlockObjectDefinition as g, PasteData as gt, BaseDefinition as h, OnPasteResultOrPromise as ht, execute as i, defineBlockObject as in, BlockDecoratorRenderProps as it, SchemaDefinition$1 as j, PortableTextEditor as jt, PortableTextSpan$1 as k, PortableTextEditableProps as kt, InsertPlacement as l, AnnotationPath as ln, EditorSelection as lt, AnnotationSchemaType$1 as m, OnPasteResult as mt, BehaviorActionSet as n, TextBlockRender as nn, BlockAnnotationRenderProps as nt, raise as o, defineInlineObject as on, BlockRenderProps as ot, AnnotationDefinition as p, Path as pn, OnPasteFn as pt, EditorEmittedEvent as q, ContainerRenderProps as qt, effect as r, TextBlockRenderProps as rn, BlockChildRenderProps as rt, BehaviorEvent as s, defineSpan as sn, BlockStyleRenderProps as st, BehaviorAction as t, TextBlock as tn, AddedAnnotationPaths as tt, NativeBehaviorEvent as u, BlockPath as un, EditorSelectionPoint as ut, DecoratorDefinition as v, RangeDecorationOnMovedDetails as vt, ListSchemaType$1 as w, RenderListItemFunction as wt, InlineObjectDefinition as x, RenderChildFunction as xt, DecoratorSchemaType$1 as y, RenderAnnotationFunction as yt, usePortableTextEditor as z, RegisteredInlineObject as zt };
|
|
3187
3271
|
//# sourceMappingURL=behavior.types.action.d.ts.map
|