@portabletext/editor 4.2.0 → 4.2.1
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 +19 -8
- package/lib/index.js +4716 -4676
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ import { BaseRange, Descendant, Operation, Range } from "slate";
|
|
|
4
4
|
import * as xstate71 from "xstate";
|
|
5
5
|
import { ActorRef, ActorRefFrom, EventObject, Snapshot } from "xstate";
|
|
6
6
|
import * as react10 from "react";
|
|
7
|
-
import React$1, { BaseSyntheticEvent, ClipboardEvent, Component, FocusEvent, JSX,
|
|
7
|
+
import React$1, { BaseSyntheticEvent, ClipboardEvent, Component, FocusEvent, JSX, MutableRefObject, PropsWithChildren, ReactElement, RefObject, TextareaHTMLAttributes } from "react";
|
|
8
8
|
import { Patch, Patch as Patch$1 } from "@portabletext/patches";
|
|
9
9
|
import { Observable, Subject } from "rxjs";
|
|
10
10
|
import { ArrayDefinition, ArraySchemaType, BlockDecoratorDefinition, BlockListDefinition, BlockStyleDefinition, ObjectSchemaType } from "@sanity/types";
|
|
@@ -134,7 +134,6 @@ type RemotePatch = {
|
|
|
134
134
|
interface PortableTextSlateEditor extends ReactEditor {
|
|
135
135
|
_key: 'editor';
|
|
136
136
|
_type: 'editor';
|
|
137
|
-
createPlaceholderBlock: () => Descendant;
|
|
138
137
|
isTextBlock: (value: unknown) => value is PortableTextTextBlock;
|
|
139
138
|
isTextSpan: (value: unknown) => value is PortableTextSpan;
|
|
140
139
|
isListBlock: (value: unknown) => value is PortableTextListBlock;
|
|
@@ -156,10 +155,6 @@ interface PortableTextSlateEditor extends ReactEditor {
|
|
|
156
155
|
isRedoing: boolean;
|
|
157
156
|
isUndoing: boolean;
|
|
158
157
|
withHistory: boolean;
|
|
159
|
-
/**
|
|
160
|
-
* Use hotkeys
|
|
161
|
-
*/
|
|
162
|
-
pteWithHotKeys: (event: KeyboardEvent$1<HTMLDivElement>) => void;
|
|
163
158
|
/**
|
|
164
159
|
* Undo
|
|
165
160
|
*/
|
|
@@ -1340,6 +1335,20 @@ type BehaviorConfig = {
|
|
|
1340
1335
|
behavior: Behavior;
|
|
1341
1336
|
priority: EditorPriority;
|
|
1342
1337
|
};
|
|
1338
|
+
type BehaviorIndex = {
|
|
1339
|
+
global: Array<SortedBehavior>;
|
|
1340
|
+
namespaced: Map<string, Array<SortedBehavior>>;
|
|
1341
|
+
exact: Map<string, Array<SortedBehavior>>;
|
|
1342
|
+
};
|
|
1343
|
+
type SortedBehavior = {
|
|
1344
|
+
behavior: Behavior;
|
|
1345
|
+
sortOrder: number;
|
|
1346
|
+
};
|
|
1347
|
+
/**
|
|
1348
|
+
* Given an array of Behaviors, build a `BehaviorIndex` where the `sortOrder`
|
|
1349
|
+
* of each Behavior is preserved.
|
|
1350
|
+
*/
|
|
1351
|
+
|
|
1343
1352
|
/**
|
|
1344
1353
|
* @public
|
|
1345
1354
|
*/
|
|
@@ -1368,7 +1377,9 @@ type EditorActor = ActorRefFrom<typeof editorMachine>;
|
|
|
1368
1377
|
*/
|
|
1369
1378
|
declare const editorMachine: xstate71.StateMachine<{
|
|
1370
1379
|
behaviors: Set<BehaviorConfig>;
|
|
1371
|
-
|
|
1380
|
+
behaviorIndex: BehaviorIndex;
|
|
1381
|
+
abstractBehaviorIndex: BehaviorIndex;
|
|
1382
|
+
behaviorsIndexed: boolean;
|
|
1372
1383
|
converters: Set<Converter>;
|
|
1373
1384
|
getLegacySchema: () => PortableTextMemberSchemaTypes;
|
|
1374
1385
|
keyGenerator: () => string;
|
|
@@ -1478,7 +1489,7 @@ declare const editorMachine: xstate71.StateMachine<{
|
|
|
1478
1489
|
type: "handle behavior event";
|
|
1479
1490
|
params: unknown;
|
|
1480
1491
|
} | {
|
|
1481
|
-
type: "
|
|
1492
|
+
type: "index behaviors";
|
|
1482
1493
|
params: xstate71.NonReducibleUnknown;
|
|
1483
1494
|
}, {
|
|
1484
1495
|
type: "slate is busy";
|