@portabletext/editor 2.13.4 → 2.13.6
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.
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _sanity_types5 from "@sanity/types";
|
|
2
2
|
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";
|
|
3
3
|
import { BaseRange, Descendant, Operation } from "slate";
|
|
4
4
|
import * as xstate227 from "xstate";
|
|
5
5
|
import { ActorRef, ActorRefFrom, EventObject, Snapshot } from "xstate";
|
|
6
|
-
import * as
|
|
6
|
+
import * as react20 from "react";
|
|
7
7
|
import React$1, { BaseSyntheticEvent, ClipboardEvent, Component, FocusEvent, JSX, KeyboardEvent as KeyboardEvent$1, MutableRefObject, PropsWithChildren, ReactElement, RefObject, TextareaHTMLAttributes } from "react";
|
|
8
8
|
import { Patch, Patch as Patch$1 } from "@portabletext/patches";
|
|
9
9
|
import * as _portabletext_schema5 from "@portabletext/schema";
|
|
@@ -219,7 +219,7 @@ declare class PortableTextEditor extends Component<PortableTextEditorProps<Inter
|
|
|
219
219
|
componentDidUpdate(prevProps: PortableTextEditorProps): void;
|
|
220
220
|
componentWillUnmount(): void;
|
|
221
221
|
setEditable: (editable: EditableAPI) => void;
|
|
222
|
-
render():
|
|
222
|
+
render(): react20.JSX.Element;
|
|
223
223
|
/**
|
|
224
224
|
* @deprecated
|
|
225
225
|
* Use built-in selectors or write your own: https://www.portabletext.org/reference/selectors/
|
|
@@ -276,7 +276,7 @@ declare class PortableTextEditor extends Component<PortableTextEditorProps<Inter
|
|
|
276
276
|
static blur: (editor: PortableTextEditor) => void;
|
|
277
277
|
static delete: (editor: PortableTextEditor, selection: EditorSelection, options?: EditableAPIDeleteOptions) => void;
|
|
278
278
|
static findDOMNode: (editor: PortableTextEditor, element: PortableTextBlock | PortableTextChild) => Node | undefined;
|
|
279
|
-
static findByPath: (editor: PortableTextEditor, path: Path) => [
|
|
279
|
+
static findByPath: (editor: PortableTextEditor, path: Path) => [_sanity_types5.PortableTextTextBlock<PortableTextObject | _sanity_types5.PortableTextSpan> | PortableTextObject | _sanity_types5.PortableTextSpan | undefined, Path | undefined];
|
|
280
280
|
/**
|
|
281
281
|
* @deprecated
|
|
282
282
|
* Use `editor.send(...)` instead
|
|
@@ -614,7 +614,7 @@ type PortableTextEditableProps = Omit<TextareaHTMLAttributes<HTMLDivElement>, 'o
|
|
|
614
614
|
* ```
|
|
615
615
|
* @group Components
|
|
616
616
|
*/
|
|
617
|
-
declare const PortableTextEditable:
|
|
617
|
+
declare const PortableTextEditable: react20.ForwardRefExoticComponent<Omit<PortableTextEditableProps, "ref"> & react20.RefAttributes<Omit<HTMLDivElement, "as" | "onPaste" | "onBeforeInput">>>;
|
|
618
618
|
type DecoratedRange = BaseRange & {
|
|
619
619
|
rangeDecoration: RangeDecoration;
|
|
620
620
|
};
|
|
@@ -1523,7 +1523,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
1523
1523
|
initialValue?: Array<PortableTextBlock>;
|
|
1524
1524
|
}, xstate227.NonReducibleUnknown, InternalPatchEvent | MutationEvent | PatchesEvent | {
|
|
1525
1525
|
type: "blurred";
|
|
1526
|
-
event:
|
|
1526
|
+
event: react20.FocusEvent<HTMLDivElement, Element>;
|
|
1527
1527
|
} | {
|
|
1528
1528
|
type: "done loading";
|
|
1529
1529
|
} | {
|
|
@@ -1535,7 +1535,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
1535
1535
|
data: unknown;
|
|
1536
1536
|
} | {
|
|
1537
1537
|
type: "focused";
|
|
1538
|
-
event:
|
|
1538
|
+
event: react20.FocusEvent<HTMLDivElement, Element>;
|
|
1539
1539
|
} | {
|
|
1540
1540
|
type: "invalid value";
|
|
1541
1541
|
resolution: InvalidValueResolution | null;
|
|
@@ -2198,7 +2198,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
2198
2198
|
type: "drop";
|
|
2199
2199
|
}, undefined, never, never, never, never, InternalPatchEvent | MutationEvent | PatchesEvent | {
|
|
2200
2200
|
type: "blurred";
|
|
2201
|
-
event:
|
|
2201
|
+
event: react20.FocusEvent<HTMLDivElement, Element>;
|
|
2202
2202
|
} | {
|
|
2203
2203
|
type: "done loading";
|
|
2204
2204
|
} | {
|
|
@@ -2210,7 +2210,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
2210
2210
|
data: unknown;
|
|
2211
2211
|
} | {
|
|
2212
2212
|
type: "focused";
|
|
2213
|
-
event:
|
|
2213
|
+
event: react20.FocusEvent<HTMLDivElement, Element>;
|
|
2214
2214
|
} | {
|
|
2215
2215
|
type: "invalid value";
|
|
2216
2216
|
resolution: InvalidValueResolution | null;
|
|
@@ -3081,7 +3081,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
3081
3081
|
type: "drop";
|
|
3082
3082
|
}, undefined, never, never, never, never, InternalPatchEvent | MutationEvent | PatchesEvent | {
|
|
3083
3083
|
type: "blurred";
|
|
3084
|
-
event:
|
|
3084
|
+
event: react20.FocusEvent<HTMLDivElement, Element>;
|
|
3085
3085
|
} | {
|
|
3086
3086
|
type: "done loading";
|
|
3087
3087
|
} | {
|
|
@@ -3093,7 +3093,7 @@ declare const editorMachine: xstate227.StateMachine<{
|
|
|
3093
3093
|
data: unknown;
|
|
3094
3094
|
} | {
|
|
3095
3095
|
type: "focused";
|
|
3096
|
-
event:
|
|
3096
|
+
event: react20.FocusEvent<HTMLDivElement, Element>;
|
|
3097
3097
|
} | {
|
|
3098
3098
|
type: "invalid value";
|
|
3099
3099
|
resolution: InvalidValueResolution | null;
|
package/lib/plugins/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Behavior, Editor, EditorEmittedEvent, EditorSchema } from "../_chunks-dts/behavior.types.action.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react22 from "react";
|
|
3
3
|
import React from "react";
|
|
4
4
|
/**
|
|
5
5
|
* @beta
|
|
@@ -181,7 +181,7 @@ type MarkdownPluginConfig = MarkdownBehaviorsConfig & {
|
|
|
181
181
|
*/
|
|
182
182
|
declare function MarkdownPlugin(props: {
|
|
183
183
|
config: MarkdownPluginConfig;
|
|
184
|
-
}):
|
|
184
|
+
}): react22.JSX.Element;
|
|
185
185
|
/**
|
|
186
186
|
* @beta
|
|
187
187
|
* Restrict the editor to one line. The plugin takes care of blocking
|
|
@@ -192,5 +192,5 @@ declare function MarkdownPlugin(props: {
|
|
|
192
192
|
*
|
|
193
193
|
* @deprecated Install the plugin from `@portabletext/plugin-one-line`
|
|
194
194
|
*/
|
|
195
|
-
declare function OneLinePlugin():
|
|
195
|
+
declare function OneLinePlugin(): react22.JSX.Element;
|
|
196
196
|
export { BehaviorPlugin, DecoratorShortcutPlugin, EditorRefPlugin, EventListenerPlugin, MarkdownPlugin, MarkdownPluginConfig, OneLinePlugin };
|
package/lib/utils/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BlockOffset, BlockPath, ChildPath, EditorContext, EditorSelection, EditorSelectionPoint } from "../_chunks-dts/behavior.types.action.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _sanity_types8 from "@sanity/types";
|
|
3
3
|
import { KeyedSegment, PortableTextBlock, PortableTextTextBlock } from "@sanity/types";
|
|
4
4
|
import { isSpan, isTextBlock } from "@portabletext/schema";
|
|
5
5
|
/**
|
|
@@ -143,7 +143,7 @@ declare function mergeTextBlocks({
|
|
|
143
143
|
context: Pick<EditorContext, 'keyGenerator' | 'schema'>;
|
|
144
144
|
targetBlock: PortableTextTextBlock;
|
|
145
145
|
incomingBlock: PortableTextTextBlock;
|
|
146
|
-
}): PortableTextTextBlock<
|
|
146
|
+
}): PortableTextTextBlock<_sanity_types8.PortableTextObject | _sanity_types8.PortableTextSpan>;
|
|
147
147
|
/**
|
|
148
148
|
* @public
|
|
149
149
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@portabletext/editor",
|
|
3
|
-
"version": "2.13.
|
|
3
|
+
"version": "2.13.6",
|
|
4
4
|
"description": "Portable Text Editor made in React",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sanity",
|
|
@@ -84,11 +84,11 @@
|
|
|
84
84
|
"slate": "0.118.1",
|
|
85
85
|
"slate-dom": "^0.118.1",
|
|
86
86
|
"slate-react": "0.117.4",
|
|
87
|
-
"xstate": "^5.22.
|
|
88
|
-
"@portabletext/block-tools": "^3.5.
|
|
87
|
+
"xstate": "^5.22.1",
|
|
88
|
+
"@portabletext/block-tools": "^3.5.10",
|
|
89
89
|
"@portabletext/patches": "^1.1.8",
|
|
90
|
-
"@portabletext/
|
|
91
|
-
"@portabletext/
|
|
90
|
+
"@portabletext/schema": "^1.2.0",
|
|
91
|
+
"@portabletext/keyboard-shortcuts": "^1.1.1"
|
|
92
92
|
},
|
|
93
93
|
"devDependencies": {
|
|
94
94
|
"@sanity/diff-match-patch": "^3.2.0",
|
|
@@ -98,8 +98,9 @@
|
|
|
98
98
|
"@types/debug": "^4.1.12",
|
|
99
99
|
"@types/lodash": "^4.17.20",
|
|
100
100
|
"@types/lodash.startcase": "^4.4.9",
|
|
101
|
-
"@types/
|
|
102
|
-
"@types/react
|
|
101
|
+
"@types/node": "^20",
|
|
102
|
+
"@types/react": "^19.2.0",
|
|
103
|
+
"@types/react-dom": "^19.2.0",
|
|
103
104
|
"@vitejs/plugin-react": "^4.7.0",
|
|
104
105
|
"@vitest/browser": "^3.2.4",
|
|
105
106
|
"@vitest/coverage-istanbul": "^3.2.4",
|
|
@@ -108,8 +109,8 @@
|
|
|
108
109
|
"eslint-formatter-gha": "^1.6.0",
|
|
109
110
|
"eslint-plugin-react-hooks": "6.0.0-rc.2",
|
|
110
111
|
"jsdom": "^27.0.0",
|
|
111
|
-
"react": "^19.
|
|
112
|
-
"react-dom": "^19.
|
|
112
|
+
"react": "^19.2.0",
|
|
113
|
+
"react-dom": "^19.2.0",
|
|
113
114
|
"rxjs": "^7.8.2",
|
|
114
115
|
"typescript": "5.9.3",
|
|
115
116
|
"typescript-eslint": "^8.44.1",
|
|
@@ -118,7 +119,7 @@
|
|
|
118
119
|
"vitest-browser-react": "^1.0.1",
|
|
119
120
|
"@portabletext/sanity-bridge": "1.1.13",
|
|
120
121
|
"@portabletext/test": "^0.0.0",
|
|
121
|
-
"racejar": "1.3.
|
|
122
|
+
"racejar": "1.3.1"
|
|
122
123
|
},
|
|
123
124
|
"peerDependencies": {
|
|
124
125
|
"@portabletext/sanity-bridge": "^1.1.13",
|
|
@@ -28,7 +28,7 @@ const parameterType = {
|
|
|
28
28
|
}),
|
|
29
29
|
decorator: createParameterType<'em' | 'strong'>({
|
|
30
30
|
name: 'decorator',
|
|
31
|
-
matcher: /"(em|strong)"/,
|
|
31
|
+
matcher: /"(code|em|strong)"/,
|
|
32
32
|
}),
|
|
33
33
|
index: createParameterType({
|
|
34
34
|
name: 'index',
|
|
@@ -52,7 +52,7 @@ const parameterType = {
|
|
|
52
52
|
}),
|
|
53
53
|
marks: createParameterType<Array<string>>({
|
|
54
54
|
name: 'marks',
|
|
55
|
-
matcher: /"((strong|em|[a-z]\d)(,(strong|em|[a-z]\d))*)"/,
|
|
55
|
+
matcher: /"((code|strong|em|[a-z]\d)(,(code|strong|em|[a-z]\d))*)"/,
|
|
56
56
|
type: Array,
|
|
57
57
|
transform: (input) => input.split(','),
|
|
58
58
|
}),
|