@portabletext/editor 3.0.9 → 3.1.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/index.d.ts +16 -10
- package/lib/index.js +176 -262
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/behaviors/behavior.types.event.ts +1 -1
- package/src/editor/PortableTextEditor.tsx +14 -0
- package/src/editor/create-slate-editor.tsx +1 -8
- package/src/editor/plugins/createWithEditableAPI.ts +18 -83
- package/src/editor/plugins/createWithPatches.ts +3 -1
- package/src/editor/plugins/createWithPortableTextMarkModel.ts +14 -0
- package/src/editor/plugins/with-plugins.ts +8 -19
- package/src/editor/range-decorations-machine.ts +13 -3
- package/src/editor/sync-machine.ts +0 -18
- package/src/internal-utils/applyPatch.ts +31 -41
- package/src/internal-utils/values.ts +22 -0
- package/src/operations/behavior.operation.delete.ts +17 -4
- package/src/operations/behavior.operation.insert.block.ts +5 -0
- package/src/types/editor.ts +0 -9
- package/src/editor/plugins/createWithPlaceholderBlock.ts +0 -67
- package/src/editor/plugins/createWithUtils.ts +0 -52
|
@@ -266,6 +266,20 @@ declare class PortableTextEditor extends Component<PortableTextEditorProps<Inter
|
|
|
266
266
|
* ```
|
|
267
267
|
*/
|
|
268
268
|
static blur: (editor: PortableTextEditor) => void;
|
|
269
|
+
/**
|
|
270
|
+
* @deprecated
|
|
271
|
+
* Use `editor.send(...)` instead
|
|
272
|
+
*
|
|
273
|
+
* ```
|
|
274
|
+
* const editor = useEditor()
|
|
275
|
+
* editor.send({
|
|
276
|
+
* type: 'delete',
|
|
277
|
+
* at: {...},
|
|
278
|
+
* direction: '...',
|
|
279
|
+
* unit: '...',
|
|
280
|
+
* })
|
|
281
|
+
* ```
|
|
282
|
+
*/
|
|
269
283
|
static delete: (editor: PortableTextEditor, selection: EditorSelection, options?: EditableAPIDeleteOptions) => void;
|
|
270
284
|
static findDOMNode: (editor: PortableTextEditor, element: PortableTextBlock | PortableTextChild) => Node | undefined;
|
|
271
285
|
static findByPath: (editor: PortableTextEditor, path: Path) => [_sanity_types4.PortableTextTextBlock<PortableTextObject | _sanity_types4.PortableTextSpan> | PortableTextObject | _sanity_types4.PortableTextSpan | undefined, Path | undefined];
|
|
@@ -740,14 +754,6 @@ interface PortableTextSlateEditor extends ReactEditor {
|
|
|
740
754
|
* Use hotkeys
|
|
741
755
|
*/
|
|
742
756
|
pteWithHotKeys: (event: KeyboardEvent$1<HTMLDivElement>) => void;
|
|
743
|
-
/**
|
|
744
|
-
* Helper function that creates a text block
|
|
745
|
-
*/
|
|
746
|
-
pteCreateTextBlock: (options: {
|
|
747
|
-
decorators: Array<string>;
|
|
748
|
-
listItem?: string;
|
|
749
|
-
level?: number;
|
|
750
|
-
}) => Descendant;
|
|
751
757
|
/**
|
|
752
758
|
* Undo
|
|
753
759
|
*/
|
|
@@ -1700,7 +1706,7 @@ declare const editorMachine: xstate228.StateMachine<{
|
|
|
1700
1706
|
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", "delete">;
|
|
1701
1707
|
at?: NonNullable<EditorSelection>;
|
|
1702
1708
|
direction?: "backward" | "forward";
|
|
1703
|
-
unit?: "character" | "word" | "line" | "block";
|
|
1709
|
+
unit?: "character" | "word" | "line" | "block" | "child";
|
|
1704
1710
|
} | {
|
|
1705
1711
|
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", "history.redo">;
|
|
1706
1712
|
} | {
|
|
@@ -3100,7 +3106,7 @@ type SyntheticBehaviorEvent = {
|
|
|
3100
3106
|
/**
|
|
3101
3107
|
* Defaults to character deletion.
|
|
3102
3108
|
*/
|
|
3103
|
-
unit?: 'character' | 'word' | 'line' | 'block';
|
|
3109
|
+
unit?: 'character' | 'word' | 'line' | 'block' | 'child';
|
|
3104
3110
|
} | {
|
|
3105
3111
|
type: StrictExtract<SyntheticBehaviorEventType, 'history.redo'>;
|
|
3106
3112
|
} | {
|