@portabletext/editor 2.12.2 → 2.13.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/selector.is-selecting-entire-blocks.cjs +64 -5
- package/lib/_chunks-cjs/selector.is-selecting-entire-blocks.cjs.map +1 -1
- package/lib/_chunks-cjs/util.slice-blocks.cjs +1 -0
- package/lib/_chunks-cjs/util.slice-blocks.cjs.map +1 -1
- package/lib/_chunks-dts/behavior.types.action.d.cts +64 -72
- package/lib/_chunks-dts/behavior.types.action.d.ts +9 -17
- package/lib/_chunks-es/selector.is-selecting-entire-blocks.js +65 -6
- package/lib/_chunks-es/selector.is-selecting-entire-blocks.js.map +1 -1
- package/lib/_chunks-es/util.slice-blocks.js +1 -0
- package/lib/_chunks-es/util.slice-blocks.js.map +1 -1
- package/lib/index.cjs +69 -60
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +69 -60
- package/lib/index.js.map +1 -1
- package/lib/plugins/index.cjs +1 -1
- package/lib/plugins/index.d.ts +3 -3
- package/lib/plugins/index.js +1 -1
- package/lib/selectors/index.cjs +1 -0
- package/lib/selectors/index.cjs.map +1 -1
- package/lib/selectors/index.d.cts +15 -1
- package/lib/selectors/index.d.ts +15 -1
- package/lib/selectors/index.js +2 -1
- package/package.json +16 -16
- package/src/behaviors/behavior.abstract.delete.ts +1 -0
- package/src/behaviors/behavior.abstract.keyboard.ts +27 -0
- package/src/editor/Editable.tsx +1 -90
- package/src/internal-utils/asserters.ts +1 -1
- package/src/keyboard-shortcuts/default-keyboard-shortcuts.ts +22 -0
- package/src/operations/behavior.operation.delete.ts +6 -24
- package/src/selectors/index.ts +1 -0
- package/src/selectors/selector.get-mark-state.ts +75 -6
- package/src/test/vitest/step-definitions.tsx +1 -8
- package/src/types/paths.ts +18 -0
|
@@ -3,12 +3,12 @@ import * as _sanity_types5 from "@sanity/types";
|
|
|
3
3
|
import { ArrayDefinition, ArraySchemaType, BlockDecoratorDefinition, BlockListDefinition, BlockStyleDefinition, ObjectSchemaType, Path, PortableTextBlock, PortableTextBlock as PortableTextBlock$1, PortableTextChild, PortableTextChild as PortableTextChild$1, PortableTextListBlock, PortableTextObject, PortableTextObject as PortableTextObject$2, PortableTextSpan, PortableTextSpan as PortableTextSpan$2, PortableTextTextBlock, PortableTextTextBlock as PortableTextTextBlock$2, TypedObject } from "@sanity/types";
|
|
4
4
|
import * as _portabletext_schema5 from "@portabletext/schema";
|
|
5
5
|
import { AnnotationDefinition, AnnotationSchemaType, BaseDefinition, BlockObjectDefinition, BlockObjectSchemaType, DecoratorDefinition, DecoratorSchemaType, FieldDefinition, InlineObjectDefinition, InlineObjectSchemaType, ListDefinition, ListSchemaType, PortableTextObject as PortableTextObject$1, PortableTextSpan as PortableTextSpan$1, PortableTextTextBlock as PortableTextTextBlock$1, Schema, SchemaDefinition, SchemaDefinition as SchemaDefinition$1, StyleDefinition, StyleSchemaType, defineSchema } from "@portabletext/schema";
|
|
6
|
-
import * as
|
|
6
|
+
import * as xstate241 from "xstate";
|
|
7
7
|
import { ActorRef, ActorRefFrom, EventObject, Snapshot } from "xstate";
|
|
8
8
|
import { BaseRange, Descendant, Operation } from "slate";
|
|
9
9
|
import * as react20 from "react";
|
|
10
10
|
import React$1, { BaseSyntheticEvent, ClipboardEvent, Component, FocusEvent, JSX, KeyboardEvent as KeyboardEvent$1, MutableRefObject, PropsWithChildren, ReactElement, RefObject, TextareaHTMLAttributes } from "react";
|
|
11
|
-
import * as
|
|
11
|
+
import * as xstate_guards14 from "xstate/guards";
|
|
12
12
|
import { Observable, Subject } from "rxjs";
|
|
13
13
|
import { DOMNode } from "slate-dom";
|
|
14
14
|
import { ReactEditor } from "slate-react";
|
|
@@ -16,10 +16,6 @@ import { ReactEditor } from "slate-react";
|
|
|
16
16
|
* @internal
|
|
17
17
|
*/
|
|
18
18
|
type PickFromUnion<TUnion, TTagKey extends keyof TUnion, TPickedTags extends TUnion[TTagKey]> = TUnion extends Record<TTagKey, TPickedTags> ? TUnion : never;
|
|
19
|
-
/**
|
|
20
|
-
* @internal
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
19
|
type NamespaceEvent<TEvent, TNamespace extends string> = TEvent extends {
|
|
24
20
|
type: infer TEventType;
|
|
25
21
|
} ? { [K in keyof TEvent]: K extends 'type' ? `${TNamespace}.${TEventType & string}` : TEvent[K] } : never;
|
|
@@ -1172,11 +1168,7 @@ type EditorActor = ActorRefFrom<typeof editorMachine>;
|
|
|
1172
1168
|
/**
|
|
1173
1169
|
* @internal
|
|
1174
1170
|
*/
|
|
1175
|
-
|
|
1176
|
-
/**
|
|
1177
|
-
* @internal
|
|
1178
|
-
*/
|
|
1179
|
-
declare const editorMachine: xstate227.StateMachine<{
|
|
1171
|
+
declare const editorMachine: xstate241.StateMachine<{
|
|
1180
1172
|
behaviors: Set<BehaviorConfig>;
|
|
1181
1173
|
behaviorsSorted: boolean;
|
|
1182
1174
|
converters: Set<Converter>;
|
|
@@ -1194,7 +1186,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
1194
1186
|
};
|
|
1195
1187
|
dragGhost?: HTMLElement;
|
|
1196
1188
|
slateEditor?: PortableTextSlateEditor;
|
|
1197
|
-
},
|
|
1189
|
+
}, MutationEvent | InternalPatchEvent | PatchesEvent | {
|
|
1198
1190
|
type: "update readOnly";
|
|
1199
1191
|
readOnly: boolean;
|
|
1200
1192
|
} | {
|
|
@@ -1241,58 +1233,58 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
1241
1233
|
type: "dragend";
|
|
1242
1234
|
} | {
|
|
1243
1235
|
type: "drop";
|
|
1244
|
-
}, {}, never,
|
|
1236
|
+
}, {}, never, xstate241.Values<{
|
|
1245
1237
|
"add behavior to context": {
|
|
1246
1238
|
type: "add behavior to context";
|
|
1247
|
-
params:
|
|
1239
|
+
params: xstate241.NonReducibleUnknown;
|
|
1248
1240
|
};
|
|
1249
1241
|
"remove behavior from context": {
|
|
1250
1242
|
type: "remove behavior from context";
|
|
1251
|
-
params:
|
|
1243
|
+
params: xstate241.NonReducibleUnknown;
|
|
1252
1244
|
};
|
|
1253
1245
|
"emit patch event": {
|
|
1254
1246
|
type: "emit patch event";
|
|
1255
|
-
params:
|
|
1247
|
+
params: xstate241.NonReducibleUnknown;
|
|
1256
1248
|
};
|
|
1257
1249
|
"emit mutation event": {
|
|
1258
1250
|
type: "emit mutation event";
|
|
1259
|
-
params:
|
|
1251
|
+
params: xstate241.NonReducibleUnknown;
|
|
1260
1252
|
};
|
|
1261
1253
|
"emit read only": {
|
|
1262
1254
|
type: "emit read only";
|
|
1263
|
-
params:
|
|
1255
|
+
params: xstate241.NonReducibleUnknown;
|
|
1264
1256
|
};
|
|
1265
1257
|
"emit editable": {
|
|
1266
1258
|
type: "emit editable";
|
|
1267
|
-
params:
|
|
1259
|
+
params: xstate241.NonReducibleUnknown;
|
|
1268
1260
|
};
|
|
1269
1261
|
"defer event": {
|
|
1270
1262
|
type: "defer event";
|
|
1271
|
-
params:
|
|
1263
|
+
params: xstate241.NonReducibleUnknown;
|
|
1272
1264
|
};
|
|
1273
1265
|
"emit pending events": {
|
|
1274
1266
|
type: "emit pending events";
|
|
1275
|
-
params:
|
|
1267
|
+
params: xstate241.NonReducibleUnknown;
|
|
1276
1268
|
};
|
|
1277
1269
|
"emit ready": {
|
|
1278
1270
|
type: "emit ready";
|
|
1279
|
-
params:
|
|
1271
|
+
params: xstate241.NonReducibleUnknown;
|
|
1280
1272
|
};
|
|
1281
1273
|
"clear pending events": {
|
|
1282
1274
|
type: "clear pending events";
|
|
1283
|
-
params:
|
|
1275
|
+
params: xstate241.NonReducibleUnknown;
|
|
1284
1276
|
};
|
|
1285
1277
|
"defer incoming patches": {
|
|
1286
1278
|
type: "defer incoming patches";
|
|
1287
|
-
params:
|
|
1279
|
+
params: xstate241.NonReducibleUnknown;
|
|
1288
1280
|
};
|
|
1289
1281
|
"emit pending incoming patches": {
|
|
1290
1282
|
type: "emit pending incoming patches";
|
|
1291
|
-
params:
|
|
1283
|
+
params: xstate241.NonReducibleUnknown;
|
|
1292
1284
|
};
|
|
1293
1285
|
"clear pending incoming patches": {
|
|
1294
1286
|
type: "clear pending incoming patches";
|
|
1295
|
-
params:
|
|
1287
|
+
params: xstate241.NonReducibleUnknown;
|
|
1296
1288
|
};
|
|
1297
1289
|
"handle blur": {
|
|
1298
1290
|
type: "handle blur";
|
|
@@ -1308,7 +1300,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
1308
1300
|
};
|
|
1309
1301
|
"sort behaviors": {
|
|
1310
1302
|
type: "sort behaviors";
|
|
1311
|
-
params:
|
|
1303
|
+
params: xstate241.NonReducibleUnknown;
|
|
1312
1304
|
};
|
|
1313
1305
|
}>, {
|
|
1314
1306
|
type: "slate is busy";
|
|
@@ -1337,7 +1329,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
1337
1329
|
readOnly?: boolean;
|
|
1338
1330
|
schema: EditorSchema;
|
|
1339
1331
|
initialValue?: Array<PortableTextBlock>;
|
|
1340
|
-
},
|
|
1332
|
+
}, xstate241.NonReducibleUnknown, {
|
|
1341
1333
|
type: "blurred";
|
|
1342
1334
|
event: react20.FocusEvent<HTMLDivElement, Element>;
|
|
1343
1335
|
} | {
|
|
@@ -1358,7 +1350,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
1358
1350
|
value: Array<PortableTextBlock> | undefined;
|
|
1359
1351
|
} | {
|
|
1360
1352
|
type: "loading";
|
|
1361
|
-
} | {
|
|
1353
|
+
} | MutationEvent | {
|
|
1362
1354
|
type: "read only";
|
|
1363
1355
|
} | {
|
|
1364
1356
|
type: "ready";
|
|
@@ -1368,19 +1360,19 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
1368
1360
|
} | {
|
|
1369
1361
|
type: "value changed";
|
|
1370
1362
|
value: Array<PortableTextBlock> | undefined;
|
|
1371
|
-
},
|
|
1363
|
+
} | InternalPatchEvent | PatchesEvent, xstate241.MetaObject, {
|
|
1372
1364
|
readonly id: "editor";
|
|
1373
1365
|
readonly context: ({
|
|
1374
1366
|
input
|
|
1375
1367
|
}: {
|
|
1376
1368
|
spawn: {
|
|
1377
|
-
<TSrc extends never>(logic: TSrc, ...[options]: never):
|
|
1378
|
-
<TLogic extends
|
|
1369
|
+
<TSrc extends never>(logic: TSrc, ...[options]: never): xstate241.ActorRefFromLogic<never>;
|
|
1370
|
+
<TLogic extends xstate241.AnyActorLogic>(src: TLogic, ...[options]: xstate241.ConditionalRequired<[options?: ({
|
|
1379
1371
|
id?: never;
|
|
1380
1372
|
systemId?: string;
|
|
1381
|
-
input?:
|
|
1373
|
+
input?: xstate241.InputFrom<TLogic> | undefined;
|
|
1382
1374
|
syncSnapshot?: boolean;
|
|
1383
|
-
} & { [K in
|
|
1375
|
+
} & { [K in xstate241.RequiredLogicInput<TLogic>]: unknown }) | undefined], xstate241.IsNotNever<xstate241.RequiredLogicInput<TLogic>>>): xstate241.ActorRefFromLogic<TLogic>;
|
|
1384
1376
|
};
|
|
1385
1377
|
input: {
|
|
1386
1378
|
converters?: Array<Converter>;
|
|
@@ -1391,7 +1383,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
1391
1383
|
schema: EditorSchema;
|
|
1392
1384
|
initialValue?: Array<PortableTextBlock>;
|
|
1393
1385
|
};
|
|
1394
|
-
self:
|
|
1386
|
+
self: xstate241.ActorRef<xstate241.MachineSnapshot<{
|
|
1395
1387
|
behaviors: Set<BehaviorConfig>;
|
|
1396
1388
|
behaviorsSorted: boolean;
|
|
1397
1389
|
converters: Set<Converter>;
|
|
@@ -1409,7 +1401,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
1409
1401
|
};
|
|
1410
1402
|
dragGhost?: HTMLElement;
|
|
1411
1403
|
slateEditor?: PortableTextSlateEditor;
|
|
1412
|
-
},
|
|
1404
|
+
}, MutationEvent | InternalPatchEvent | PatchesEvent | {
|
|
1413
1405
|
type: "update readOnly";
|
|
1414
1406
|
readOnly: boolean;
|
|
1415
1407
|
} | {
|
|
@@ -1456,7 +1448,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
1456
1448
|
type: "dragend";
|
|
1457
1449
|
} | {
|
|
1458
1450
|
type: "drop";
|
|
1459
|
-
}, Record<string,
|
|
1451
|
+
}, Record<string, xstate241.AnyActorRef | undefined>, xstate241.StateValue, string, unknown, any, any>, MutationEvent | InternalPatchEvent | PatchesEvent | {
|
|
1460
1452
|
type: "update readOnly";
|
|
1461
1453
|
readOnly: boolean;
|
|
1462
1454
|
} | {
|
|
@@ -1503,10 +1495,10 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
1503
1495
|
type: "dragend";
|
|
1504
1496
|
} | {
|
|
1505
1497
|
type: "drop";
|
|
1506
|
-
},
|
|
1498
|
+
}, xstate241.AnyEventObject>;
|
|
1507
1499
|
}) => {
|
|
1508
1500
|
behaviors: Set<{
|
|
1509
|
-
behavior: Behavior<"*" | "split" | `custom.${string}` | "annotation.add" | "annotation.remove" | "block.set" | "block.unset" | "child.set" | "child.unset" | "decorator.add" | "decorator.remove" | "delete" | "history.redo" | "history.undo" | "insert.block" | "insert.child" | "insert.text" | "move.backward" | "move.block" | "move.forward" | "select" | "annotation.set" | "annotation.toggle" | "decorator.toggle" | "delete.backward" | "delete.block" | "delete.child" | "delete.forward" | "delete.text" | "deserialize" | "deserialize.data" | "deserialization.success" | "deserialization.failure" | "insert.blocks" | "insert.break" | "insert.inline object" | "insert.soft break" | "insert.span" | "list item.add" | "list item.remove" | "list item.toggle" | "move.block down" | "move.block up" | "select.block" | "select.previous block" | "select.next block" | "serialize" | "serialize.data" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle" | "clipboard.copy" | "clipboard.cut" | "clipboard.paste" | "drag.dragstart" | "drag.drag" | "drag.dragend" | "drag.dragenter" | "drag.dragover" | "drag.dragleave" | "drag.drop" | "input.*" | "keyboard.keydown" | "keyboard.keyup" | "mouse.click" | "
|
|
1501
|
+
behavior: Behavior<"*" | "split" | `custom.${string}` | "annotation.add" | "annotation.remove" | "block.set" | "block.unset" | "child.set" | "child.unset" | "decorator.add" | "decorator.remove" | "delete" | "history.redo" | "history.undo" | "insert.block" | "insert.child" | "insert.text" | "move.backward" | "move.block" | "move.forward" | "select" | "annotation.set" | "annotation.toggle" | "decorator.toggle" | "delete.backward" | "delete.block" | "delete.child" | "delete.forward" | "delete.text" | "deserialize" | "deserialize.data" | "deserialization.success" | "deserialization.failure" | "insert.blocks" | "insert.break" | "insert.inline object" | "insert.soft break" | "insert.span" | "list item.add" | "list item.remove" | "list item.toggle" | "move.block down" | "move.block up" | "select.block" | "select.previous block" | "select.next block" | "serialize" | "serialize.data" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle" | "clipboard.copy" | "clipboard.cut" | "clipboard.paste" | "drag.dragstart" | "drag.drag" | "drag.dragend" | "drag.dragenter" | "drag.dragover" | "drag.dragleave" | "drag.drop" | "input.*" | "keyboard.keydown" | "keyboard.keyup" | "mouse.click" | "history.*" | "split.*" | "style.*" | "delete.*" | "select.*" | "deserialize.*" | "serialize.*" | "annotation.*" | "block.*" | "child.*" | "decorator.*" | "insert.*" | "move.*" | "deserialization.*" | "list item.*" | "serialization.*" | "clipboard.*" | "drag.*" | "keyboard.*" | "mouse.*", true, {
|
|
1510
1502
|
type: StrictExtract<"split" | "annotation.add" | "annotation.remove" | "block.set" | "block.unset" | "child.set" | "child.unset" | "decorator.add" | "decorator.remove" | "delete" | "history.redo" | "history.undo" | "insert.block" | "insert.child" | "insert.text" | "move.backward" | "move.block" | "move.forward" | "select" | "annotation.set" | "annotation.toggle" | "decorator.toggle" | "delete.backward" | "delete.block" | "delete.child" | "delete.forward" | "delete.text" | "deserialize" | "deserialize.data" | "deserialization.success" | "deserialization.failure" | "insert.blocks" | "insert.break" | "insert.inline object" | "insert.soft break" | "insert.span" | "list item.add" | "list item.remove" | "list item.toggle" | "move.block down" | "move.block up" | "select.block" | "select.previous block" | "select.next block" | "serialize" | "serialize.data" | "serialization.success" | "serialization.failure" | "style.add" | "style.remove" | "style.toggle", "annotation.add">;
|
|
1511
1503
|
annotation: {
|
|
1512
1504
|
name: string;
|
|
@@ -1805,7 +1797,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
1805
1797
|
readonly actions: "remove behavior from context";
|
|
1806
1798
|
};
|
|
1807
1799
|
readonly 'update maxBlocks': {
|
|
1808
|
-
readonly actions:
|
|
1800
|
+
readonly actions: xstate241.ActionFunction<{
|
|
1809
1801
|
behaviors: Set<BehaviorConfig>;
|
|
1810
1802
|
behaviorsSorted: boolean;
|
|
1811
1803
|
converters: Set<Converter>;
|
|
@@ -1826,7 +1818,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
1826
1818
|
}, {
|
|
1827
1819
|
type: "update maxBlocks";
|
|
1828
1820
|
maxBlocks: number | undefined;
|
|
1829
|
-
},
|
|
1821
|
+
}, MutationEvent | InternalPatchEvent | PatchesEvent | {
|
|
1830
1822
|
type: "update readOnly";
|
|
1831
1823
|
readOnly: boolean;
|
|
1832
1824
|
} | {
|
|
@@ -1876,7 +1868,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
1876
1868
|
}, undefined, never, never, never, never, never>;
|
|
1877
1869
|
};
|
|
1878
1870
|
readonly 'update selection': {
|
|
1879
|
-
readonly actions: readonly [
|
|
1871
|
+
readonly actions: readonly [xstate241.ActionFunction<{
|
|
1880
1872
|
behaviors: Set<BehaviorConfig>;
|
|
1881
1873
|
behaviorsSorted: boolean;
|
|
1882
1874
|
converters: Set<Converter>;
|
|
@@ -1897,7 +1889,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
1897
1889
|
}, {
|
|
1898
1890
|
type: "update selection";
|
|
1899
1891
|
selection: EditorSelection;
|
|
1900
|
-
},
|
|
1892
|
+
}, MutationEvent | InternalPatchEvent | PatchesEvent | {
|
|
1901
1893
|
type: "update readOnly";
|
|
1902
1894
|
readOnly: boolean;
|
|
1903
1895
|
} | {
|
|
@@ -1944,7 +1936,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
1944
1936
|
type: "dragend";
|
|
1945
1937
|
} | {
|
|
1946
1938
|
type: "drop";
|
|
1947
|
-
}, undefined, never, never, never, never, never>,
|
|
1939
|
+
}, undefined, never, never, never, never, never>, xstate241.ActionFunction<{
|
|
1948
1940
|
behaviors: Set<BehaviorConfig>;
|
|
1949
1941
|
behaviorsSorted: boolean;
|
|
1950
1942
|
converters: Set<Converter>;
|
|
@@ -1965,7 +1957,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
1965
1957
|
}, {
|
|
1966
1958
|
type: "update selection";
|
|
1967
1959
|
selection: EditorSelection;
|
|
1968
|
-
},
|
|
1960
|
+
}, MutationEvent | InternalPatchEvent | PatchesEvent | {
|
|
1969
1961
|
type: "update readOnly";
|
|
1970
1962
|
readOnly: boolean;
|
|
1971
1963
|
} | {
|
|
@@ -2012,7 +2004,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
2012
2004
|
type: "dragend";
|
|
2013
2005
|
} | {
|
|
2014
2006
|
type: "drop";
|
|
2015
|
-
}, undefined, never, never, never, never,
|
|
2007
|
+
}, undefined, never, never, never, never, {
|
|
2016
2008
|
type: "blurred";
|
|
2017
2009
|
event: react20.FocusEvent<HTMLDivElement, Element>;
|
|
2018
2010
|
} | {
|
|
@@ -2033,7 +2025,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
2033
2025
|
value: Array<PortableTextBlock> | undefined;
|
|
2034
2026
|
} | {
|
|
2035
2027
|
type: "loading";
|
|
2036
|
-
} | {
|
|
2028
|
+
} | MutationEvent | {
|
|
2037
2029
|
type: "read only";
|
|
2038
2030
|
} | {
|
|
2039
2031
|
type: "ready";
|
|
@@ -2043,10 +2035,10 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
2043
2035
|
} | {
|
|
2044
2036
|
type: "value changed";
|
|
2045
2037
|
value: Array<PortableTextBlock> | undefined;
|
|
2046
|
-
}>];
|
|
2038
|
+
} | InternalPatchEvent | PatchesEvent>];
|
|
2047
2039
|
};
|
|
2048
2040
|
readonly 'set drag ghost': {
|
|
2049
|
-
readonly actions:
|
|
2041
|
+
readonly actions: xstate241.ActionFunction<{
|
|
2050
2042
|
behaviors: Set<BehaviorConfig>;
|
|
2051
2043
|
behaviorsSorted: boolean;
|
|
2052
2044
|
converters: Set<Converter>;
|
|
@@ -2067,7 +2059,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
2067
2059
|
}, {
|
|
2068
2060
|
type: "set drag ghost";
|
|
2069
2061
|
ghost: HTMLElement;
|
|
2070
|
-
},
|
|
2062
|
+
}, MutationEvent | InternalPatchEvent | PatchesEvent | {
|
|
2071
2063
|
type: "update readOnly";
|
|
2072
2064
|
readOnly: boolean;
|
|
2073
2065
|
} | {
|
|
@@ -2129,7 +2121,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
2129
2121
|
readonly actions: readonly ["sort behaviors", "handle behavior event"];
|
|
2130
2122
|
readonly guard: ({
|
|
2131
2123
|
event
|
|
2132
|
-
}:
|
|
2124
|
+
}: xstate_guards14.GuardArgs<{
|
|
2133
2125
|
behaviors: Set<BehaviorConfig>;
|
|
2134
2126
|
behaviorsSorted: boolean;
|
|
2135
2127
|
converters: Set<Converter>;
|
|
@@ -2166,7 +2158,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
2166
2158
|
readonly target: "#editor.edit mode.read only.read only";
|
|
2167
2159
|
readonly guard: ({
|
|
2168
2160
|
context
|
|
2169
|
-
}:
|
|
2161
|
+
}: xstate_guards14.GuardArgs<{
|
|
2170
2162
|
behaviors: Set<BehaviorConfig>;
|
|
2171
2163
|
behaviorsSorted: boolean;
|
|
2172
2164
|
converters: Set<Converter>;
|
|
@@ -2199,7 +2191,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
2199
2191
|
readonly 'update readOnly': {
|
|
2200
2192
|
readonly guard: ({
|
|
2201
2193
|
event
|
|
2202
|
-
}:
|
|
2194
|
+
}: xstate_guards14.GuardArgs<{
|
|
2203
2195
|
behaviors: Set<BehaviorConfig>;
|
|
2204
2196
|
behaviorsSorted: boolean;
|
|
2205
2197
|
converters: Set<Converter>;
|
|
@@ -2233,7 +2225,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
2233
2225
|
readonly 'update readOnly': {
|
|
2234
2226
|
readonly guard: ({
|
|
2235
2227
|
event
|
|
2236
|
-
}:
|
|
2228
|
+
}: xstate_guards14.GuardArgs<{
|
|
2237
2229
|
behaviors: Set<BehaviorConfig>;
|
|
2238
2230
|
behaviorsSorted: boolean;
|
|
2239
2231
|
converters: Set<Converter>;
|
|
@@ -2266,7 +2258,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
2266
2258
|
};
|
|
2267
2259
|
readonly focus: {
|
|
2268
2260
|
readonly target: ".focusing";
|
|
2269
|
-
readonly actions: readonly [
|
|
2261
|
+
readonly actions: readonly [xstate241.ActionFunction<{
|
|
2270
2262
|
behaviors: Set<BehaviorConfig>;
|
|
2271
2263
|
behaviorsSorted: boolean;
|
|
2272
2264
|
converters: Set<Converter>;
|
|
@@ -2287,7 +2279,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
2287
2279
|
}, {
|
|
2288
2280
|
type: "focus";
|
|
2289
2281
|
editor: PortableTextSlateEditor;
|
|
2290
|
-
},
|
|
2282
|
+
}, MutationEvent | InternalPatchEvent | PatchesEvent | {
|
|
2291
2283
|
type: "update readOnly";
|
|
2292
2284
|
readOnly: boolean;
|
|
2293
2285
|
} | {
|
|
@@ -2344,7 +2336,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
2344
2336
|
readonly exit: readonly [() => void];
|
|
2345
2337
|
readonly on: {
|
|
2346
2338
|
readonly dragstart: {
|
|
2347
|
-
readonly actions: readonly [
|
|
2339
|
+
readonly actions: readonly [xstate241.ActionFunction<{
|
|
2348
2340
|
behaviors: Set<BehaviorConfig>;
|
|
2349
2341
|
behaviorsSorted: boolean;
|
|
2350
2342
|
converters: Set<Converter>;
|
|
@@ -2366,7 +2358,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
2366
2358
|
type: "dragstart";
|
|
2367
2359
|
ghost?: HTMLElement;
|
|
2368
2360
|
origin: Pick<EventPosition, "selection">;
|
|
2369
|
-
},
|
|
2361
|
+
}, MutationEvent | InternalPatchEvent | PatchesEvent | {
|
|
2370
2362
|
type: "update readOnly";
|
|
2371
2363
|
readOnly: boolean;
|
|
2372
2364
|
} | {
|
|
@@ -2447,7 +2439,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
2447
2439
|
readonly entry: readonly [() => void];
|
|
2448
2440
|
readonly exit: readonly [() => void, ({
|
|
2449
2441
|
context
|
|
2450
|
-
}:
|
|
2442
|
+
}: xstate241.ActionArgs<{
|
|
2451
2443
|
behaviors: Set<BehaviorConfig>;
|
|
2452
2444
|
behaviorsSorted: boolean;
|
|
2453
2445
|
converters: Set<Converter>;
|
|
@@ -2465,7 +2457,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
2465
2457
|
};
|
|
2466
2458
|
dragGhost?: HTMLElement;
|
|
2467
2459
|
slateEditor?: PortableTextSlateEditor;
|
|
2468
|
-
},
|
|
2460
|
+
}, MutationEvent | InternalPatchEvent | PatchesEvent | {
|
|
2469
2461
|
type: "update readOnly";
|
|
2470
2462
|
readOnly: boolean;
|
|
2471
2463
|
} | {
|
|
@@ -2512,7 +2504,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
2512
2504
|
type: "dragend";
|
|
2513
2505
|
} | {
|
|
2514
2506
|
type: "drop";
|
|
2515
|
-
},
|
|
2507
|
+
}, MutationEvent | InternalPatchEvent | PatchesEvent | {
|
|
2516
2508
|
type: "update readOnly";
|
|
2517
2509
|
readOnly: boolean;
|
|
2518
2510
|
} | {
|
|
@@ -2559,7 +2551,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
2559
2551
|
type: "dragend";
|
|
2560
2552
|
} | {
|
|
2561
2553
|
type: "drop";
|
|
2562
|
-
}>) => void,
|
|
2554
|
+
}>) => void, xstate241.ActionFunction<{
|
|
2563
2555
|
behaviors: Set<BehaviorConfig>;
|
|
2564
2556
|
behaviorsSorted: boolean;
|
|
2565
2557
|
converters: Set<Converter>;
|
|
@@ -2577,7 +2569,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
2577
2569
|
};
|
|
2578
2570
|
dragGhost?: HTMLElement;
|
|
2579
2571
|
slateEditor?: PortableTextSlateEditor;
|
|
2580
|
-
},
|
|
2572
|
+
}, MutationEvent | InternalPatchEvent | PatchesEvent | {
|
|
2581
2573
|
type: "update readOnly";
|
|
2582
2574
|
readOnly: boolean;
|
|
2583
2575
|
} | {
|
|
@@ -2624,7 +2616,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
2624
2616
|
type: "dragend";
|
|
2625
2617
|
} | {
|
|
2626
2618
|
type: "drop";
|
|
2627
|
-
},
|
|
2619
|
+
}, MutationEvent | InternalPatchEvent | PatchesEvent | {
|
|
2628
2620
|
type: "update readOnly";
|
|
2629
2621
|
readOnly: boolean;
|
|
2630
2622
|
} | {
|
|
@@ -2671,7 +2663,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
2671
2663
|
type: "dragend";
|
|
2672
2664
|
} | {
|
|
2673
2665
|
type: "drop";
|
|
2674
|
-
}, undefined, never, never, never, never, never>,
|
|
2666
|
+
}, undefined, never, never, never, never, never>, xstate241.ActionFunction<{
|
|
2675
2667
|
behaviors: Set<BehaviorConfig>;
|
|
2676
2668
|
behaviorsSorted: boolean;
|
|
2677
2669
|
converters: Set<Converter>;
|
|
@@ -2689,7 +2681,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
2689
2681
|
};
|
|
2690
2682
|
dragGhost?: HTMLElement;
|
|
2691
2683
|
slateEditor?: PortableTextSlateEditor;
|
|
2692
|
-
},
|
|
2684
|
+
}, MutationEvent | InternalPatchEvent | PatchesEvent | {
|
|
2693
2685
|
type: "update readOnly";
|
|
2694
2686
|
readOnly: boolean;
|
|
2695
2687
|
} | {
|
|
@@ -2736,7 +2728,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
2736
2728
|
type: "dragend";
|
|
2737
2729
|
} | {
|
|
2738
2730
|
type: "drop";
|
|
2739
|
-
},
|
|
2731
|
+
}, MutationEvent | InternalPatchEvent | PatchesEvent | {
|
|
2740
2732
|
type: "update readOnly";
|
|
2741
2733
|
readOnly: boolean;
|
|
2742
2734
|
} | {
|
|
@@ -2830,7 +2822,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
2830
2822
|
readonly exit: readonly [() => void];
|
|
2831
2823
|
readonly on: {
|
|
2832
2824
|
readonly patches: {
|
|
2833
|
-
readonly actions: readonly [
|
|
2825
|
+
readonly actions: readonly [xstate241.ActionFunction<{
|
|
2834
2826
|
behaviors: Set<BehaviorConfig>;
|
|
2835
2827
|
behaviorsSorted: boolean;
|
|
2836
2828
|
converters: Set<Converter>;
|
|
@@ -2848,7 +2840,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
2848
2840
|
};
|
|
2849
2841
|
dragGhost?: HTMLElement;
|
|
2850
2842
|
slateEditor?: PortableTextSlateEditor;
|
|
2851
|
-
}, PatchesEvent,
|
|
2843
|
+
}, PatchesEvent, MutationEvent | InternalPatchEvent | PatchesEvent | {
|
|
2852
2844
|
type: "update readOnly";
|
|
2853
2845
|
readOnly: boolean;
|
|
2854
2846
|
} | {
|
|
@@ -2895,7 +2887,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
2895
2887
|
type: "dragend";
|
|
2896
2888
|
} | {
|
|
2897
2889
|
type: "drop";
|
|
2898
|
-
}, undefined, never, never, never, never,
|
|
2890
|
+
}, undefined, never, never, never, never, {
|
|
2899
2891
|
type: "blurred";
|
|
2900
2892
|
event: react20.FocusEvent<HTMLDivElement, Element>;
|
|
2901
2893
|
} | {
|
|
@@ -2916,7 +2908,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
2916
2908
|
value: Array<PortableTextBlock> | undefined;
|
|
2917
2909
|
} | {
|
|
2918
2910
|
type: "loading";
|
|
2919
|
-
} | {
|
|
2911
|
+
} | MutationEvent | {
|
|
2920
2912
|
type: "read only";
|
|
2921
2913
|
} | {
|
|
2922
2914
|
type: "ready";
|
|
@@ -2926,7 +2918,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
2926
2918
|
} | {
|
|
2927
2919
|
type: "value changed";
|
|
2928
2920
|
value: Array<PortableTextBlock> | undefined;
|
|
2929
|
-
}>];
|
|
2921
|
+
} | InternalPatchEvent | PatchesEvent>];
|
|
2930
2922
|
};
|
|
2931
2923
|
readonly 'syncing value': {
|
|
2932
2924
|
readonly target: "syncing value";
|
|
@@ -6,7 +6,7 @@ import { AnnotationDefinition, AnnotationSchemaType, BaseDefinition, BlockObject
|
|
|
6
6
|
import * as xstate227 from "xstate";
|
|
7
7
|
import { ActorRef, ActorRefFrom, EventObject, Snapshot } from "xstate";
|
|
8
8
|
import { BaseRange, Descendant, Operation } from "slate";
|
|
9
|
-
import * as
|
|
9
|
+
import * as react20 from "react";
|
|
10
10
|
import React$1, { BaseSyntheticEvent, ClipboardEvent, Component, FocusEvent, JSX, KeyboardEvent as KeyboardEvent$1, MutableRefObject, PropsWithChildren, ReactElement, RefObject, TextareaHTMLAttributes } from "react";
|
|
11
11
|
import * as xstate_guards12 from "xstate/guards";
|
|
12
12
|
import { Observable, Subject } from "rxjs";
|
|
@@ -16,10 +16,6 @@ import { ReactEditor } from "slate-react";
|
|
|
16
16
|
* @internal
|
|
17
17
|
*/
|
|
18
18
|
type PickFromUnion<TUnion, TTagKey extends keyof TUnion, TPickedTags extends TUnion[TTagKey]> = TUnion extends Record<TTagKey, TPickedTags> ? TUnion : never;
|
|
19
|
-
/**
|
|
20
|
-
* @internal
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
19
|
type NamespaceEvent<TEvent, TNamespace extends string> = TEvent extends {
|
|
24
20
|
type: infer TEventType;
|
|
25
21
|
} ? { [K in keyof TEvent]: K extends 'type' ? `${TNamespace}.${TEventType & string}` : TEvent[K] } : never;
|
|
@@ -202,7 +198,7 @@ declare class PortableTextEditor extends Component<PortableTextEditorProps<Inter
|
|
|
202
198
|
componentDidUpdate(prevProps: PortableTextEditorProps): void;
|
|
203
199
|
componentWillUnmount(): void;
|
|
204
200
|
setEditable: (editable: EditableAPI) => void;
|
|
205
|
-
render():
|
|
201
|
+
render(): react20.JSX.Element;
|
|
206
202
|
/**
|
|
207
203
|
* @deprecated
|
|
208
204
|
* Use built-in selectors or write your own: https://www.portabletext.org/reference/selectors/
|
|
@@ -597,7 +593,7 @@ type PortableTextEditableProps = Omit<TextareaHTMLAttributes<HTMLDivElement>, 'o
|
|
|
597
593
|
* ```
|
|
598
594
|
* @group Components
|
|
599
595
|
*/
|
|
600
|
-
declare const PortableTextEditable:
|
|
596
|
+
declare const PortableTextEditable: react20.ForwardRefExoticComponent<Omit<PortableTextEditableProps, "ref"> & react20.RefAttributes<Omit<HTMLDivElement, "as" | "onPaste" | "onBeforeInput">>>;
|
|
601
597
|
type DecoratedRange = BaseRange & {
|
|
602
598
|
rangeDecoration: RangeDecoration;
|
|
603
599
|
};
|
|
@@ -1169,10 +1165,6 @@ type InternalPatchEvent = NamespaceEvent<PatchEvent, 'internal'> & {
|
|
|
1169
1165
|
* @internal
|
|
1170
1166
|
*/
|
|
1171
1167
|
type EditorActor = ActorRefFrom<typeof editorMachine>;
|
|
1172
|
-
/**
|
|
1173
|
-
* @internal
|
|
1174
|
-
*/
|
|
1175
|
-
|
|
1176
1168
|
/**
|
|
1177
1169
|
* @internal
|
|
1178
1170
|
*/
|
|
@@ -1339,7 +1331,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
1339
1331
|
initialValue?: Array<PortableTextBlock>;
|
|
1340
1332
|
}, xstate227.NonReducibleUnknown, InternalPatchEvent | MutationEvent | PatchesEvent | {
|
|
1341
1333
|
type: "blurred";
|
|
1342
|
-
event:
|
|
1334
|
+
event: react20.FocusEvent<HTMLDivElement, Element>;
|
|
1343
1335
|
} | {
|
|
1344
1336
|
type: "done loading";
|
|
1345
1337
|
} | {
|
|
@@ -1351,7 +1343,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
1351
1343
|
data: unknown;
|
|
1352
1344
|
} | {
|
|
1353
1345
|
type: "focused";
|
|
1354
|
-
event:
|
|
1346
|
+
event: react20.FocusEvent<HTMLDivElement, Element>;
|
|
1355
1347
|
} | {
|
|
1356
1348
|
type: "invalid value";
|
|
1357
1349
|
resolution: InvalidValueResolution | null;
|
|
@@ -2014,7 +2006,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
2014
2006
|
type: "drop";
|
|
2015
2007
|
}, undefined, never, never, never, never, InternalPatchEvent | MutationEvent | PatchesEvent | {
|
|
2016
2008
|
type: "blurred";
|
|
2017
|
-
event:
|
|
2009
|
+
event: react20.FocusEvent<HTMLDivElement, Element>;
|
|
2018
2010
|
} | {
|
|
2019
2011
|
type: "done loading";
|
|
2020
2012
|
} | {
|
|
@@ -2026,7 +2018,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
2026
2018
|
data: unknown;
|
|
2027
2019
|
} | {
|
|
2028
2020
|
type: "focused";
|
|
2029
|
-
event:
|
|
2021
|
+
event: react20.FocusEvent<HTMLDivElement, Element>;
|
|
2030
2022
|
} | {
|
|
2031
2023
|
type: "invalid value";
|
|
2032
2024
|
resolution: InvalidValueResolution | null;
|
|
@@ -2897,7 +2889,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
2897
2889
|
type: "drop";
|
|
2898
2890
|
}, undefined, never, never, never, never, InternalPatchEvent | MutationEvent | PatchesEvent | {
|
|
2899
2891
|
type: "blurred";
|
|
2900
|
-
event:
|
|
2892
|
+
event: react20.FocusEvent<HTMLDivElement, Element>;
|
|
2901
2893
|
} | {
|
|
2902
2894
|
type: "done loading";
|
|
2903
2895
|
} | {
|
|
@@ -2909,7 +2901,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
2909
2901
|
data: unknown;
|
|
2910
2902
|
} | {
|
|
2911
2903
|
type: "focused";
|
|
2912
|
-
event:
|
|
2904
|
+
event: react20.FocusEvent<HTMLDivElement, Element>;
|
|
2913
2905
|
} | {
|
|
2914
2906
|
type: "invalid value";
|
|
2915
2907
|
resolution: InvalidValueResolution | null;
|