@portabletext/editor 2.10.0 → 2.12.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.
@@ -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 xstate241 from "xstate";
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 react22 from "react";
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 xstate_guards14 from "xstate/guards";
11
+ import * as xstate_guards12 from "xstate/guards";
12
12
  import { Observable, Subject } from "rxjs";
13
13
  import { DOMNode } from "slate-dom";
14
14
  import { ReactEditor } from "slate-react";
@@ -202,7 +202,7 @@ declare class PortableTextEditor extends Component<PortableTextEditorProps<Inter
202
202
  componentDidUpdate(prevProps: PortableTextEditorProps): void;
203
203
  componentWillUnmount(): void;
204
204
  setEditable: (editable: EditableAPI) => void;
205
- render(): react22.JSX.Element;
205
+ render(): react20.JSX.Element;
206
206
  /**
207
207
  * @deprecated
208
208
  * Use built-in selectors or write your own: https://www.portabletext.org/reference/selectors/
@@ -597,7 +597,7 @@ type PortableTextEditableProps = Omit<TextareaHTMLAttributes<HTMLDivElement>, 'o
597
597
  * ```
598
598
  * @group Components
599
599
  */
600
- declare const PortableTextEditable: react22.ForwardRefExoticComponent<Omit<PortableTextEditableProps, "ref"> & react22.RefAttributes<Omit<HTMLDivElement, "as" | "onPaste" | "onBeforeInput">>>;
600
+ declare const PortableTextEditable: react20.ForwardRefExoticComponent<Omit<PortableTextEditableProps, "ref"> & react20.RefAttributes<Omit<HTMLDivElement, "as" | "onPaste" | "onBeforeInput">>>;
601
601
  type DecoratedRange = BaseRange & {
602
602
  rangeDecoration: RangeDecoration;
603
603
  };
@@ -1176,7 +1176,7 @@ type EditorActor = ActorRefFrom<typeof editorMachine>;
1176
1176
  /**
1177
1177
  * @internal
1178
1178
  */
1179
- declare const editorMachine: xstate241.StateMachine<{
1179
+ declare const editorMachine: xstate227.StateMachine<{
1180
1180
  behaviors: Set<BehaviorConfig>;
1181
1181
  behaviorsSorted: boolean;
1182
1182
  converters: Set<Converter>;
@@ -1194,7 +1194,7 @@ declare const editorMachine: xstate241.StateMachine<{
1194
1194
  };
1195
1195
  dragGhost?: HTMLElement;
1196
1196
  slateEditor?: PortableTextSlateEditor;
1197
- }, MutationEvent | InternalPatchEvent | PatchesEvent | {
1197
+ }, InternalPatchEvent | MutationEvent | PatchesEvent | {
1198
1198
  type: "update readOnly";
1199
1199
  readOnly: boolean;
1200
1200
  } | {
@@ -1241,58 +1241,58 @@ declare const editorMachine: xstate241.StateMachine<{
1241
1241
  type: "dragend";
1242
1242
  } | {
1243
1243
  type: "drop";
1244
- }, {}, never, xstate241.Values<{
1244
+ }, {}, never, xstate227.Values<{
1245
1245
  "add behavior to context": {
1246
1246
  type: "add behavior to context";
1247
- params: xstate241.NonReducibleUnknown;
1247
+ params: xstate227.NonReducibleUnknown;
1248
1248
  };
1249
1249
  "remove behavior from context": {
1250
1250
  type: "remove behavior from context";
1251
- params: xstate241.NonReducibleUnknown;
1251
+ params: xstate227.NonReducibleUnknown;
1252
1252
  };
1253
1253
  "emit patch event": {
1254
1254
  type: "emit patch event";
1255
- params: xstate241.NonReducibleUnknown;
1255
+ params: xstate227.NonReducibleUnknown;
1256
1256
  };
1257
1257
  "emit mutation event": {
1258
1258
  type: "emit mutation event";
1259
- params: xstate241.NonReducibleUnknown;
1259
+ params: xstate227.NonReducibleUnknown;
1260
1260
  };
1261
1261
  "emit read only": {
1262
1262
  type: "emit read only";
1263
- params: xstate241.NonReducibleUnknown;
1263
+ params: xstate227.NonReducibleUnknown;
1264
1264
  };
1265
1265
  "emit editable": {
1266
1266
  type: "emit editable";
1267
- params: xstate241.NonReducibleUnknown;
1267
+ params: xstate227.NonReducibleUnknown;
1268
1268
  };
1269
1269
  "defer event": {
1270
1270
  type: "defer event";
1271
- params: xstate241.NonReducibleUnknown;
1271
+ params: xstate227.NonReducibleUnknown;
1272
1272
  };
1273
1273
  "emit pending events": {
1274
1274
  type: "emit pending events";
1275
- params: xstate241.NonReducibleUnknown;
1275
+ params: xstate227.NonReducibleUnknown;
1276
1276
  };
1277
1277
  "emit ready": {
1278
1278
  type: "emit ready";
1279
- params: xstate241.NonReducibleUnknown;
1279
+ params: xstate227.NonReducibleUnknown;
1280
1280
  };
1281
1281
  "clear pending events": {
1282
1282
  type: "clear pending events";
1283
- params: xstate241.NonReducibleUnknown;
1283
+ params: xstate227.NonReducibleUnknown;
1284
1284
  };
1285
1285
  "defer incoming patches": {
1286
1286
  type: "defer incoming patches";
1287
- params: xstate241.NonReducibleUnknown;
1287
+ params: xstate227.NonReducibleUnknown;
1288
1288
  };
1289
1289
  "emit pending incoming patches": {
1290
1290
  type: "emit pending incoming patches";
1291
- params: xstate241.NonReducibleUnknown;
1291
+ params: xstate227.NonReducibleUnknown;
1292
1292
  };
1293
1293
  "clear pending incoming patches": {
1294
1294
  type: "clear pending incoming patches";
1295
- params: xstate241.NonReducibleUnknown;
1295
+ params: xstate227.NonReducibleUnknown;
1296
1296
  };
1297
1297
  "handle blur": {
1298
1298
  type: "handle blur";
@@ -1308,7 +1308,7 @@ declare const editorMachine: xstate241.StateMachine<{
1308
1308
  };
1309
1309
  "sort behaviors": {
1310
1310
  type: "sort behaviors";
1311
- params: xstate241.NonReducibleUnknown;
1311
+ params: xstate227.NonReducibleUnknown;
1312
1312
  };
1313
1313
  }>, {
1314
1314
  type: "slate is busy";
@@ -1337,9 +1337,9 @@ declare const editorMachine: xstate241.StateMachine<{
1337
1337
  readOnly?: boolean;
1338
1338
  schema: EditorSchema;
1339
1339
  initialValue?: Array<PortableTextBlock>;
1340
- }, xstate241.NonReducibleUnknown, {
1340
+ }, xstate227.NonReducibleUnknown, InternalPatchEvent | MutationEvent | PatchesEvent | {
1341
1341
  type: "blurred";
1342
- event: react22.FocusEvent<HTMLDivElement, Element>;
1342
+ event: react20.FocusEvent<HTMLDivElement, Element>;
1343
1343
  } | {
1344
1344
  type: "done loading";
1345
1345
  } | {
@@ -1351,14 +1351,14 @@ declare const editorMachine: xstate241.StateMachine<{
1351
1351
  data: unknown;
1352
1352
  } | {
1353
1353
  type: "focused";
1354
- event: react22.FocusEvent<HTMLDivElement, Element>;
1354
+ event: react20.FocusEvent<HTMLDivElement, Element>;
1355
1355
  } | {
1356
1356
  type: "invalid value";
1357
1357
  resolution: InvalidValueResolution | null;
1358
1358
  value: Array<PortableTextBlock> | undefined;
1359
1359
  } | {
1360
1360
  type: "loading";
1361
- } | MutationEvent | {
1361
+ } | {
1362
1362
  type: "read only";
1363
1363
  } | {
1364
1364
  type: "ready";
@@ -1368,19 +1368,19 @@ declare const editorMachine: xstate241.StateMachine<{
1368
1368
  } | {
1369
1369
  type: "value changed";
1370
1370
  value: Array<PortableTextBlock> | undefined;
1371
- } | InternalPatchEvent | PatchesEvent, xstate241.MetaObject, {
1371
+ }, xstate227.MetaObject, {
1372
1372
  readonly id: "editor";
1373
1373
  readonly context: ({
1374
1374
  input
1375
1375
  }: {
1376
1376
  spawn: {
1377
- <TSrc extends never>(logic: TSrc, ...[options]: never): xstate241.ActorRefFromLogic<never>;
1378
- <TLogic extends xstate241.AnyActorLogic>(src: TLogic, ...[options]: xstate241.ConditionalRequired<[options?: ({
1377
+ <TSrc extends never>(logic: TSrc, ...[options]: never): xstate227.ActorRefFromLogic<never>;
1378
+ <TLogic extends xstate227.AnyActorLogic>(src: TLogic, ...[options]: xstate227.ConditionalRequired<[options?: ({
1379
1379
  id?: never;
1380
1380
  systemId?: string;
1381
- input?: xstate241.InputFrom<TLogic> | undefined;
1381
+ input?: xstate227.InputFrom<TLogic> | undefined;
1382
1382
  syncSnapshot?: boolean;
1383
- } & { [K in xstate241.RequiredLogicInput<TLogic>]: unknown }) | undefined], xstate241.IsNotNever<xstate241.RequiredLogicInput<TLogic>>>): xstate241.ActorRefFromLogic<TLogic>;
1383
+ } & { [K in xstate227.RequiredLogicInput<TLogic>]: unknown }) | undefined], xstate227.IsNotNever<xstate227.RequiredLogicInput<TLogic>>>): xstate227.ActorRefFromLogic<TLogic>;
1384
1384
  };
1385
1385
  input: {
1386
1386
  converters?: Array<Converter>;
@@ -1391,7 +1391,7 @@ declare const editorMachine: xstate241.StateMachine<{
1391
1391
  schema: EditorSchema;
1392
1392
  initialValue?: Array<PortableTextBlock>;
1393
1393
  };
1394
- self: xstate241.ActorRef<xstate241.MachineSnapshot<{
1394
+ self: xstate227.ActorRef<xstate227.MachineSnapshot<{
1395
1395
  behaviors: Set<BehaviorConfig>;
1396
1396
  behaviorsSorted: boolean;
1397
1397
  converters: Set<Converter>;
@@ -1409,7 +1409,7 @@ declare const editorMachine: xstate241.StateMachine<{
1409
1409
  };
1410
1410
  dragGhost?: HTMLElement;
1411
1411
  slateEditor?: PortableTextSlateEditor;
1412
- }, MutationEvent | InternalPatchEvent | PatchesEvent | {
1412
+ }, InternalPatchEvent | MutationEvent | PatchesEvent | {
1413
1413
  type: "update readOnly";
1414
1414
  readOnly: boolean;
1415
1415
  } | {
@@ -1456,7 +1456,7 @@ declare const editorMachine: xstate241.StateMachine<{
1456
1456
  type: "dragend";
1457
1457
  } | {
1458
1458
  type: "drop";
1459
- }, Record<string, xstate241.AnyActorRef | undefined>, xstate241.StateValue, string, unknown, any, any>, MutationEvent | InternalPatchEvent | PatchesEvent | {
1459
+ }, Record<string, xstate227.AnyActorRef | undefined>, xstate227.StateValue, string, unknown, any, any>, InternalPatchEvent | MutationEvent | PatchesEvent | {
1460
1460
  type: "update readOnly";
1461
1461
  readOnly: boolean;
1462
1462
  } | {
@@ -1503,10 +1503,10 @@ declare const editorMachine: xstate241.StateMachine<{
1503
1503
  type: "dragend";
1504
1504
  } | {
1505
1505
  type: "drop";
1506
- }, xstate241.AnyEventObject>;
1506
+ }, xstate227.AnyEventObject>;
1507
1507
  }) => {
1508
1508
  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" | "history.*" | "split.*" | "delete.*" | "select.*" | "deserialize.*" | "serialize.*" | "annotation.*" | "block.*" | "child.*" | "decorator.*" | "insert.*" | "move.*" | "deserialization.*" | "list item.*" | "serialization.*" | "style.*" | "clipboard.*" | "drag.*" | "keyboard.*" | "mouse.*", true, {
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" | "style.*" | "history.*" | "split.*" | "delete.*" | "select.*" | "deserialize.*" | "serialize.*" | "annotation.*" | "block.*" | "child.*" | "decorator.*" | "insert.*" | "move.*" | "deserialization.*" | "list item.*" | "serialization.*" | "clipboard.*" | "drag.*" | "keyboard.*" | "mouse.*", true, {
1510
1510
  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
1511
  annotation: {
1512
1512
  name: string;
@@ -1805,7 +1805,7 @@ declare const editorMachine: xstate241.StateMachine<{
1805
1805
  readonly actions: "remove behavior from context";
1806
1806
  };
1807
1807
  readonly 'update maxBlocks': {
1808
- readonly actions: xstate241.ActionFunction<{
1808
+ readonly actions: xstate227.ActionFunction<{
1809
1809
  behaviors: Set<BehaviorConfig>;
1810
1810
  behaviorsSorted: boolean;
1811
1811
  converters: Set<Converter>;
@@ -1826,7 +1826,7 @@ declare const editorMachine: xstate241.StateMachine<{
1826
1826
  }, {
1827
1827
  type: "update maxBlocks";
1828
1828
  maxBlocks: number | undefined;
1829
- }, MutationEvent | InternalPatchEvent | PatchesEvent | {
1829
+ }, InternalPatchEvent | MutationEvent | PatchesEvent | {
1830
1830
  type: "update readOnly";
1831
1831
  readOnly: boolean;
1832
1832
  } | {
@@ -1876,7 +1876,7 @@ declare const editorMachine: xstate241.StateMachine<{
1876
1876
  }, undefined, never, never, never, never, never>;
1877
1877
  };
1878
1878
  readonly 'update selection': {
1879
- readonly actions: readonly [xstate241.ActionFunction<{
1879
+ readonly actions: readonly [xstate227.ActionFunction<{
1880
1880
  behaviors: Set<BehaviorConfig>;
1881
1881
  behaviorsSorted: boolean;
1882
1882
  converters: Set<Converter>;
@@ -1897,7 +1897,7 @@ declare const editorMachine: xstate241.StateMachine<{
1897
1897
  }, {
1898
1898
  type: "update selection";
1899
1899
  selection: EditorSelection;
1900
- }, MutationEvent | InternalPatchEvent | PatchesEvent | {
1900
+ }, InternalPatchEvent | MutationEvent | PatchesEvent | {
1901
1901
  type: "update readOnly";
1902
1902
  readOnly: boolean;
1903
1903
  } | {
@@ -1944,7 +1944,7 @@ declare const editorMachine: xstate241.StateMachine<{
1944
1944
  type: "dragend";
1945
1945
  } | {
1946
1946
  type: "drop";
1947
- }, undefined, never, never, never, never, never>, xstate241.ActionFunction<{
1947
+ }, undefined, never, never, never, never, never>, xstate227.ActionFunction<{
1948
1948
  behaviors: Set<BehaviorConfig>;
1949
1949
  behaviorsSorted: boolean;
1950
1950
  converters: Set<Converter>;
@@ -1965,7 +1965,7 @@ declare const editorMachine: xstate241.StateMachine<{
1965
1965
  }, {
1966
1966
  type: "update selection";
1967
1967
  selection: EditorSelection;
1968
- }, MutationEvent | InternalPatchEvent | PatchesEvent | {
1968
+ }, InternalPatchEvent | MutationEvent | PatchesEvent | {
1969
1969
  type: "update readOnly";
1970
1970
  readOnly: boolean;
1971
1971
  } | {
@@ -2012,9 +2012,9 @@ declare const editorMachine: xstate241.StateMachine<{
2012
2012
  type: "dragend";
2013
2013
  } | {
2014
2014
  type: "drop";
2015
- }, undefined, never, never, never, never, {
2015
+ }, undefined, never, never, never, never, InternalPatchEvent | MutationEvent | PatchesEvent | {
2016
2016
  type: "blurred";
2017
- event: react22.FocusEvent<HTMLDivElement, Element>;
2017
+ event: react20.FocusEvent<HTMLDivElement, Element>;
2018
2018
  } | {
2019
2019
  type: "done loading";
2020
2020
  } | {
@@ -2026,14 +2026,14 @@ declare const editorMachine: xstate241.StateMachine<{
2026
2026
  data: unknown;
2027
2027
  } | {
2028
2028
  type: "focused";
2029
- event: react22.FocusEvent<HTMLDivElement, Element>;
2029
+ event: react20.FocusEvent<HTMLDivElement, Element>;
2030
2030
  } | {
2031
2031
  type: "invalid value";
2032
2032
  resolution: InvalidValueResolution | null;
2033
2033
  value: Array<PortableTextBlock> | undefined;
2034
2034
  } | {
2035
2035
  type: "loading";
2036
- } | MutationEvent | {
2036
+ } | {
2037
2037
  type: "read only";
2038
2038
  } | {
2039
2039
  type: "ready";
@@ -2043,10 +2043,10 @@ declare const editorMachine: xstate241.StateMachine<{
2043
2043
  } | {
2044
2044
  type: "value changed";
2045
2045
  value: Array<PortableTextBlock> | undefined;
2046
- } | InternalPatchEvent | PatchesEvent>];
2046
+ }>];
2047
2047
  };
2048
2048
  readonly 'set drag ghost': {
2049
- readonly actions: xstate241.ActionFunction<{
2049
+ readonly actions: xstate227.ActionFunction<{
2050
2050
  behaviors: Set<BehaviorConfig>;
2051
2051
  behaviorsSorted: boolean;
2052
2052
  converters: Set<Converter>;
@@ -2067,7 +2067,7 @@ declare const editorMachine: xstate241.StateMachine<{
2067
2067
  }, {
2068
2068
  type: "set drag ghost";
2069
2069
  ghost: HTMLElement;
2070
- }, MutationEvent | InternalPatchEvent | PatchesEvent | {
2070
+ }, InternalPatchEvent | MutationEvent | PatchesEvent | {
2071
2071
  type: "update readOnly";
2072
2072
  readOnly: boolean;
2073
2073
  } | {
@@ -2129,7 +2129,7 @@ declare const editorMachine: xstate241.StateMachine<{
2129
2129
  readonly actions: readonly ["sort behaviors", "handle behavior event"];
2130
2130
  readonly guard: ({
2131
2131
  event
2132
- }: xstate_guards14.GuardArgs<{
2132
+ }: xstate_guards12.GuardArgs<{
2133
2133
  behaviors: Set<BehaviorConfig>;
2134
2134
  behaviorsSorted: boolean;
2135
2135
  converters: Set<Converter>;
@@ -2166,7 +2166,7 @@ declare const editorMachine: xstate241.StateMachine<{
2166
2166
  readonly target: "#editor.edit mode.read only.read only";
2167
2167
  readonly guard: ({
2168
2168
  context
2169
- }: xstate_guards14.GuardArgs<{
2169
+ }: xstate_guards12.GuardArgs<{
2170
2170
  behaviors: Set<BehaviorConfig>;
2171
2171
  behaviorsSorted: boolean;
2172
2172
  converters: Set<Converter>;
@@ -2199,7 +2199,7 @@ declare const editorMachine: xstate241.StateMachine<{
2199
2199
  readonly 'update readOnly': {
2200
2200
  readonly guard: ({
2201
2201
  event
2202
- }: xstate_guards14.GuardArgs<{
2202
+ }: xstate_guards12.GuardArgs<{
2203
2203
  behaviors: Set<BehaviorConfig>;
2204
2204
  behaviorsSorted: boolean;
2205
2205
  converters: Set<Converter>;
@@ -2233,7 +2233,7 @@ declare const editorMachine: xstate241.StateMachine<{
2233
2233
  readonly 'update readOnly': {
2234
2234
  readonly guard: ({
2235
2235
  event
2236
- }: xstate_guards14.GuardArgs<{
2236
+ }: xstate_guards12.GuardArgs<{
2237
2237
  behaviors: Set<BehaviorConfig>;
2238
2238
  behaviorsSorted: boolean;
2239
2239
  converters: Set<Converter>;
@@ -2266,7 +2266,7 @@ declare const editorMachine: xstate241.StateMachine<{
2266
2266
  };
2267
2267
  readonly focus: {
2268
2268
  readonly target: ".focusing";
2269
- readonly actions: readonly [xstate241.ActionFunction<{
2269
+ readonly actions: readonly [xstate227.ActionFunction<{
2270
2270
  behaviors: Set<BehaviorConfig>;
2271
2271
  behaviorsSorted: boolean;
2272
2272
  converters: Set<Converter>;
@@ -2287,7 +2287,7 @@ declare const editorMachine: xstate241.StateMachine<{
2287
2287
  }, {
2288
2288
  type: "focus";
2289
2289
  editor: PortableTextSlateEditor;
2290
- }, MutationEvent | InternalPatchEvent | PatchesEvent | {
2290
+ }, InternalPatchEvent | MutationEvent | PatchesEvent | {
2291
2291
  type: "update readOnly";
2292
2292
  readOnly: boolean;
2293
2293
  } | {
@@ -2344,7 +2344,7 @@ declare const editorMachine: xstate241.StateMachine<{
2344
2344
  readonly exit: readonly [() => void];
2345
2345
  readonly on: {
2346
2346
  readonly dragstart: {
2347
- readonly actions: readonly [xstate241.ActionFunction<{
2347
+ readonly actions: readonly [xstate227.ActionFunction<{
2348
2348
  behaviors: Set<BehaviorConfig>;
2349
2349
  behaviorsSorted: boolean;
2350
2350
  converters: Set<Converter>;
@@ -2366,7 +2366,7 @@ declare const editorMachine: xstate241.StateMachine<{
2366
2366
  type: "dragstart";
2367
2367
  ghost?: HTMLElement;
2368
2368
  origin: Pick<EventPosition, "selection">;
2369
- }, MutationEvent | InternalPatchEvent | PatchesEvent | {
2369
+ }, InternalPatchEvent | MutationEvent | PatchesEvent | {
2370
2370
  type: "update readOnly";
2371
2371
  readOnly: boolean;
2372
2372
  } | {
@@ -2447,7 +2447,7 @@ declare const editorMachine: xstate241.StateMachine<{
2447
2447
  readonly entry: readonly [() => void];
2448
2448
  readonly exit: readonly [() => void, ({
2449
2449
  context
2450
- }: xstate241.ActionArgs<{
2450
+ }: xstate227.ActionArgs<{
2451
2451
  behaviors: Set<BehaviorConfig>;
2452
2452
  behaviorsSorted: boolean;
2453
2453
  converters: Set<Converter>;
@@ -2465,7 +2465,7 @@ declare const editorMachine: xstate241.StateMachine<{
2465
2465
  };
2466
2466
  dragGhost?: HTMLElement;
2467
2467
  slateEditor?: PortableTextSlateEditor;
2468
- }, MutationEvent | InternalPatchEvent | PatchesEvent | {
2468
+ }, InternalPatchEvent | MutationEvent | PatchesEvent | {
2469
2469
  type: "update readOnly";
2470
2470
  readOnly: boolean;
2471
2471
  } | {
@@ -2512,7 +2512,7 @@ declare const editorMachine: xstate241.StateMachine<{
2512
2512
  type: "dragend";
2513
2513
  } | {
2514
2514
  type: "drop";
2515
- }, MutationEvent | InternalPatchEvent | PatchesEvent | {
2515
+ }, InternalPatchEvent | MutationEvent | PatchesEvent | {
2516
2516
  type: "update readOnly";
2517
2517
  readOnly: boolean;
2518
2518
  } | {
@@ -2559,7 +2559,7 @@ declare const editorMachine: xstate241.StateMachine<{
2559
2559
  type: "dragend";
2560
2560
  } | {
2561
2561
  type: "drop";
2562
- }>) => void, xstate241.ActionFunction<{
2562
+ }>) => void, xstate227.ActionFunction<{
2563
2563
  behaviors: Set<BehaviorConfig>;
2564
2564
  behaviorsSorted: boolean;
2565
2565
  converters: Set<Converter>;
@@ -2577,7 +2577,7 @@ declare const editorMachine: xstate241.StateMachine<{
2577
2577
  };
2578
2578
  dragGhost?: HTMLElement;
2579
2579
  slateEditor?: PortableTextSlateEditor;
2580
- }, MutationEvent | InternalPatchEvent | PatchesEvent | {
2580
+ }, InternalPatchEvent | MutationEvent | PatchesEvent | {
2581
2581
  type: "update readOnly";
2582
2582
  readOnly: boolean;
2583
2583
  } | {
@@ -2624,7 +2624,7 @@ declare const editorMachine: xstate241.StateMachine<{
2624
2624
  type: "dragend";
2625
2625
  } | {
2626
2626
  type: "drop";
2627
- }, MutationEvent | InternalPatchEvent | PatchesEvent | {
2627
+ }, InternalPatchEvent | MutationEvent | PatchesEvent | {
2628
2628
  type: "update readOnly";
2629
2629
  readOnly: boolean;
2630
2630
  } | {
@@ -2671,7 +2671,7 @@ declare const editorMachine: xstate241.StateMachine<{
2671
2671
  type: "dragend";
2672
2672
  } | {
2673
2673
  type: "drop";
2674
- }, undefined, never, never, never, never, never>, xstate241.ActionFunction<{
2674
+ }, undefined, never, never, never, never, never>, xstate227.ActionFunction<{
2675
2675
  behaviors: Set<BehaviorConfig>;
2676
2676
  behaviorsSorted: boolean;
2677
2677
  converters: Set<Converter>;
@@ -2689,7 +2689,7 @@ declare const editorMachine: xstate241.StateMachine<{
2689
2689
  };
2690
2690
  dragGhost?: HTMLElement;
2691
2691
  slateEditor?: PortableTextSlateEditor;
2692
- }, MutationEvent | InternalPatchEvent | PatchesEvent | {
2692
+ }, InternalPatchEvent | MutationEvent | PatchesEvent | {
2693
2693
  type: "update readOnly";
2694
2694
  readOnly: boolean;
2695
2695
  } | {
@@ -2736,7 +2736,7 @@ declare const editorMachine: xstate241.StateMachine<{
2736
2736
  type: "dragend";
2737
2737
  } | {
2738
2738
  type: "drop";
2739
- }, MutationEvent | InternalPatchEvent | PatchesEvent | {
2739
+ }, InternalPatchEvent | MutationEvent | PatchesEvent | {
2740
2740
  type: "update readOnly";
2741
2741
  readOnly: boolean;
2742
2742
  } | {
@@ -2830,7 +2830,7 @@ declare const editorMachine: xstate241.StateMachine<{
2830
2830
  readonly exit: readonly [() => void];
2831
2831
  readonly on: {
2832
2832
  readonly patches: {
2833
- readonly actions: readonly [xstate241.ActionFunction<{
2833
+ readonly actions: readonly [xstate227.ActionFunction<{
2834
2834
  behaviors: Set<BehaviorConfig>;
2835
2835
  behaviorsSorted: boolean;
2836
2836
  converters: Set<Converter>;
@@ -2848,7 +2848,7 @@ declare const editorMachine: xstate241.StateMachine<{
2848
2848
  };
2849
2849
  dragGhost?: HTMLElement;
2850
2850
  slateEditor?: PortableTextSlateEditor;
2851
- }, PatchesEvent, MutationEvent | InternalPatchEvent | PatchesEvent | {
2851
+ }, PatchesEvent, InternalPatchEvent | MutationEvent | PatchesEvent | {
2852
2852
  type: "update readOnly";
2853
2853
  readOnly: boolean;
2854
2854
  } | {
@@ -2895,9 +2895,9 @@ declare const editorMachine: xstate241.StateMachine<{
2895
2895
  type: "dragend";
2896
2896
  } | {
2897
2897
  type: "drop";
2898
- }, undefined, never, never, never, never, {
2898
+ }, undefined, never, never, never, never, InternalPatchEvent | MutationEvent | PatchesEvent | {
2899
2899
  type: "blurred";
2900
- event: react22.FocusEvent<HTMLDivElement, Element>;
2900
+ event: react20.FocusEvent<HTMLDivElement, Element>;
2901
2901
  } | {
2902
2902
  type: "done loading";
2903
2903
  } | {
@@ -2909,14 +2909,14 @@ declare const editorMachine: xstate241.StateMachine<{
2909
2909
  data: unknown;
2910
2910
  } | {
2911
2911
  type: "focused";
2912
- event: react22.FocusEvent<HTMLDivElement, Element>;
2912
+ event: react20.FocusEvent<HTMLDivElement, Element>;
2913
2913
  } | {
2914
2914
  type: "invalid value";
2915
2915
  resolution: InvalidValueResolution | null;
2916
2916
  value: Array<PortableTextBlock> | undefined;
2917
2917
  } | {
2918
2918
  type: "loading";
2919
- } | MutationEvent | {
2919
+ } | {
2920
2920
  type: "read only";
2921
2921
  } | {
2922
2922
  type: "ready";
@@ -2926,7 +2926,7 @@ declare const editorMachine: xstate241.StateMachine<{
2926
2926
  } | {
2927
2927
  type: "value changed";
2928
2928
  value: Array<PortableTextBlock> | undefined;
2929
- } | InternalPatchEvent | PatchesEvent>];
2929
+ }>];
2930
2930
  };
2931
2931
  readonly 'syncing value': {
2932
2932
  readonly target: "syncing value";
@@ -3046,7 +3046,7 @@ type ExternalBehaviorEvent = {
3046
3046
  [prop: string]: unknown;
3047
3047
  };
3048
3048
  };
3049
- } | SyntheticBehaviorEvent | CustomBehaviorEvent;
3049
+ } | BehaviorEvent;
3050
3050
  /**************************************
3051
3051
  * Synthetic events
3052
3052
  **************************************/
@@ -3046,7 +3046,7 @@ type ExternalBehaviorEvent = {
3046
3046
  [prop: string]: unknown;
3047
3047
  };
3048
3048
  };
3049
- } | SyntheticBehaviorEvent | CustomBehaviorEvent;
3049
+ } | BehaviorEvent;
3050
3050
  /**************************************
3051
3051
  * Synthetic events
3052
3052
  **************************************/
package/lib/index.cjs CHANGED
@@ -4762,7 +4762,7 @@ const insertChildOperationImplementation = ({
4762
4762
  }) : slate.Transforms.insertNodes(operation.editor, span, {
4763
4763
  at: [focusBlockIndex, focusChildIndex + 1],
4764
4764
  select: !0
4765
- });
4765
+ }), slateDom.EDITOR_TO_PENDING_SELECTION.set(operation.editor, operation.editor.selection);
4766
4766
  return;
4767
4767
  }
4768
4768
  const inlineObject = util_sliceBlocks.parseInlineObject({
@@ -4797,44 +4797,9 @@ const insertChildOperationImplementation = ({
4797
4797
  }
4798
4798
  throw new Error("Unable to parse child");
4799
4799
  }, insertTextOperationImplementation = ({
4800
- context,
4801
4800
  operation
4802
4801
  }) => {
4803
- const snapshot = {
4804
- blockIndexMap: operation.editor.blockIndexMap,
4805
- context: {
4806
- value: operation.editor.value,
4807
- selection: operation.editor.selection ? slateRangeToSelection({
4808
- schema: context.schema,
4809
- editor: operation.editor,
4810
- range: operation.editor.selection
4811
- }) : null,
4812
- schema: context.schema,
4813
- keyGenerator: context.keyGenerator,
4814
- converters: [],
4815
- readOnly: !1
4816
- },
4817
- decoratorState: operation.editor.decoratorState
4818
- }, markState = selector_isSelectingEntireBlocks.getMarkState(snapshot), activeDecorators = selector_isSelectingEntireBlocks.getActiveDecorators(snapshot), activeAnnotations = selector_isSelectingEntireBlocks.getActiveAnnotationsMarks(snapshot), [focusSpan] = getFocusSpan({
4819
- editor: operation.editor
4820
- });
4821
- if (!focusSpan) {
4822
- slate.Transforms.insertText(operation.editor, operation.text);
4823
- return;
4824
- }
4825
- if (markState && markState.state === "unchanged") {
4826
- const markStateDecorators = (markState.marks ?? []).filter((mark) => context.schema.decorators.map((decorator) => decorator.name).includes(mark));
4827
- if (markStateDecorators.length === activeDecorators.length && markStateDecorators.every((mark) => activeDecorators.includes(mark))) {
4828
- slate.Transforms.insertText(operation.editor, operation.text);
4829
- return;
4830
- }
4831
- }
4832
- slate.Transforms.insertNodes(operation.editor, {
4833
- _type: focusSpan._type,
4834
- _key: context.keyGenerator(),
4835
- text: operation.text,
4836
- marks: [...activeDecorators, ...activeAnnotations]
4837
- }), slateDom.EDITOR_TO_PENDING_SELECTION.set(operation.editor, operation.editor.selection), operation.editor.decoratorState = {};
4802
+ slate.Transforms.insertText(operation.editor, operation.text);
4838
4803
  }, moveBackwardOperationImplementation = ({
4839
4804
  operation
4840
4805
  }) => {
@@ -7218,7 +7183,39 @@ const coreDndBehaviors = [
7218
7183
  placement: draggingEntireBlocks ? originEvent.position.block === "start" ? "before" : originEvent.position.block === "end" ? "after" : "auto" : "auto"
7219
7184
  })]]
7220
7185
  })
7221
- ], breakingAtTheEndOfTextBlock = behaviors_index.defineBehavior({
7186
+ ], coreInsertBehaviors = [behaviors_index.defineBehavior({
7187
+ on: "insert.text",
7188
+ guard: ({
7189
+ snapshot
7190
+ }) => {
7191
+ if (!selector_isSelectionExpanded.getFocusSpan(snapshot))
7192
+ return !1;
7193
+ const markState = selector_isSelectingEntireBlocks.getMarkState(snapshot), activeDecorators = selector_isSelectingEntireBlocks.getActiveDecorators(snapshot), activeAnnotations = selector_isSelectingEntireBlocks.getActiveAnnotationsMarks(snapshot);
7194
+ if (markState && markState.state === "unchanged") {
7195
+ const markStateDecorators = (markState.marks ?? []).filter((mark) => snapshot.context.schema.decorators.map((decorator) => decorator.name).includes(mark));
7196
+ if (markStateDecorators.length === activeDecorators.length && markStateDecorators.every((mark) => activeDecorators.includes(mark)))
7197
+ return !1;
7198
+ }
7199
+ return {
7200
+ activeDecorators,
7201
+ activeAnnotations
7202
+ };
7203
+ },
7204
+ actions: [({
7205
+ snapshot,
7206
+ event
7207
+ }, {
7208
+ activeDecorators,
7209
+ activeAnnotations
7210
+ }) => [behaviors_index.raise({
7211
+ type: "insert.child",
7212
+ child: {
7213
+ _type: snapshot.context.schema.span.name,
7214
+ text: event.text,
7215
+ marks: [...activeDecorators, ...activeAnnotations]
7216
+ }
7217
+ })]]
7218
+ })], breakingAtTheEndOfTextBlock = behaviors_index.defineBehavior({
7222
7219
  on: "insert.break",
7223
7220
  guard: ({
7224
7221
  snapshot
@@ -7779,7 +7776,7 @@ const MAX_LIST_LEVEL = 10, clearListOnBackspace = behaviors_index.defineBehavior
7779
7776
  inheritListLevel,
7780
7777
  inheritListItem,
7781
7778
  inheritListProperties
7782
- }, coreBehaviorsConfig = [...coreAnnotationBehaviors, coreDecoratorBehaviors.strongShortcut, coreDecoratorBehaviors.emShortcut, coreDecoratorBehaviors.underlineShortcut, coreDecoratorBehaviors.codeShortcut, ...coreDndBehaviors, coreBlockObjectBehaviors.clickingAboveLonelyBlockObject, coreBlockObjectBehaviors.clickingBelowLonelyBlockObject, coreBlockObjectBehaviors.arrowDownOnLonelyBlockObject, coreBlockObjectBehaviors.arrowUpOnLonelyBlockObject, coreBlockObjectBehaviors.breakingBlockObject, coreBlockObjectBehaviors.deletingEmptyTextBlockAfterBlockObject, coreBlockObjectBehaviors.deletingEmptyTextBlockBeforeBlockObject, coreListBehaviors.clearListOnBackspace, coreListBehaviors.unindentListOnBackspace, coreListBehaviors.mergeTextIntoListOnDelete, coreListBehaviors.mergeTextIntoListOnBackspace, coreListBehaviors.deletingListFromStart, coreListBehaviors.clearListOnEnter, coreListBehaviors.indentListOnTab, coreListBehaviors.unindentListOnShiftTab, coreListBehaviors.inheritListLevel, coreListBehaviors.inheritListItem, coreListBehaviors.inheritListProperties, coreInsertBreakBehaviors.breakingAtTheEndOfTextBlock, coreInsertBreakBehaviors.breakingAtTheStartOfTextBlock, coreInsertBreakBehaviors.breakingEntireDocument, coreInsertBreakBehaviors.breakingEntireBlocks, coreInsertBreakBehaviors.breakingInlineObject].map((behavior) => ({
7779
+ }, coreBehaviorsConfig = [...coreAnnotationBehaviors, coreDecoratorBehaviors.strongShortcut, coreDecoratorBehaviors.emShortcut, coreDecoratorBehaviors.underlineShortcut, coreDecoratorBehaviors.codeShortcut, ...coreDndBehaviors, coreBlockObjectBehaviors.clickingAboveLonelyBlockObject, coreBlockObjectBehaviors.clickingBelowLonelyBlockObject, coreBlockObjectBehaviors.arrowDownOnLonelyBlockObject, coreBlockObjectBehaviors.arrowUpOnLonelyBlockObject, coreBlockObjectBehaviors.breakingBlockObject, coreBlockObjectBehaviors.deletingEmptyTextBlockAfterBlockObject, coreBlockObjectBehaviors.deletingEmptyTextBlockBeforeBlockObject, ...coreInsertBehaviors, coreListBehaviors.clearListOnBackspace, coreListBehaviors.unindentListOnBackspace, coreListBehaviors.mergeTextIntoListOnDelete, coreListBehaviors.mergeTextIntoListOnBackspace, coreListBehaviors.deletingListFromStart, coreListBehaviors.clearListOnEnter, coreListBehaviors.indentListOnTab, coreListBehaviors.unindentListOnShiftTab, coreListBehaviors.inheritListLevel, coreListBehaviors.inheritListItem, coreListBehaviors.inheritListProperties, coreInsertBreakBehaviors.breakingAtTheEndOfTextBlock, coreInsertBreakBehaviors.breakingAtTheStartOfTextBlock, coreInsertBreakBehaviors.breakingEntireDocument, coreInsertBreakBehaviors.breakingEntireBlocks, coreInsertBreakBehaviors.breakingInlineObject].map((behavior) => ({
7783
7780
  behavior,
7784
7781
  priority: corePriority
7785
7782
  }));