@portabletext/editor 2.1.10 → 2.1.11
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.cts +9 -9
- package/lib/index.cjs +1 -1
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/plugins/index.d.cts +3 -3
- package/lib/utils/index.d.ts +2 -2
- package/package.json +5 -5
- package/src/editor/plugins/createWithEditableAPI.ts +1 -1
- package/src/internal-utils/applyPatch.ts +1 -1
- package/src/internal-utils/text-marks.ts +1 -1
- package/src/internal-utils/to-slate-range.ts +1 -1
- package/src/operations/behavior.operation.annotation.add.ts +1 -1
package/lib/plugins/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Behavior, Editor, EditorEmittedEvent, EditorSchema } from "../_chunks-dts/behavior.types.action.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react12 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
|
+
}): react12.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(): react12.JSX.Element;
|
|
196
196
|
export { BehaviorPlugin, DecoratorShortcutPlugin, EditorRefPlugin, EventListenerPlugin, MarkdownPlugin, type 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_types9 from "@sanity/types";
|
|
3
3
|
import { KeyedSegment, PortableTextBlock, PortableTextChild, PortableTextSpan, PortableTextTextBlock } from "@sanity/types";
|
|
4
4
|
/**
|
|
5
5
|
* @public
|
|
@@ -150,7 +150,7 @@ declare function mergeTextBlocks({
|
|
|
150
150
|
context: Pick<EditorContext, 'keyGenerator' | 'schema'>;
|
|
151
151
|
targetBlock: PortableTextTextBlock;
|
|
152
152
|
incomingBlock: PortableTextTextBlock;
|
|
153
|
-
}): PortableTextTextBlock<
|
|
153
|
+
}): PortableTextTextBlock<_sanity_types9.PortableTextObject | _sanity_types9.PortableTextSpan>;
|
|
154
154
|
/**
|
|
155
155
|
* @public
|
|
156
156
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@portabletext/editor",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.11",
|
|
4
4
|
"description": "Portable Text Editor made in React",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sanity",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"slate": "0.118.0",
|
|
79
79
|
"slate-dom": "^0.117.4",
|
|
80
80
|
"slate-react": "0.117.4",
|
|
81
|
-
"xstate": "^5.20.
|
|
81
|
+
"xstate": "^5.20.2",
|
|
82
82
|
"@portabletext/block-tools": "2.0.8",
|
|
83
83
|
"@portabletext/patches": "1.1.6",
|
|
84
84
|
"@portabletext/keyboard-shortcuts": "1.1.1"
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"devDependencies": {
|
|
87
87
|
"@portabletext/toolkit": "^2.0.17",
|
|
88
88
|
"@sanity/diff-match-patch": "^3.2.0",
|
|
89
|
-
"@sanity/pkg-utils": "^7.
|
|
89
|
+
"@sanity/pkg-utils": "^7.11.1",
|
|
90
90
|
"@sanity/schema": "^4.3.0",
|
|
91
91
|
"@sanity/types": "^4.3.0",
|
|
92
92
|
"@testing-library/react": "^16.3.0",
|
|
@@ -95,8 +95,8 @@
|
|
|
95
95
|
"@types/lodash.startcase": "^4.4.9",
|
|
96
96
|
"@types/react": "^19.1.9",
|
|
97
97
|
"@types/react-dom": "^19.1.7",
|
|
98
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
99
|
-
"@typescript-eslint/parser": "^8.
|
|
98
|
+
"@typescript-eslint/eslint-plugin": "^8.39.0",
|
|
99
|
+
"@typescript-eslint/parser": "^8.39.0",
|
|
100
100
|
"@vitejs/plugin-react": "^4.7.0",
|
|
101
101
|
"@vitest/browser": "^3.2.4",
|
|
102
102
|
"@vitest/coverage-istanbul": "^3.2.4",
|
|
@@ -424,7 +424,7 @@ export function createEditableAPI(
|
|
|
424
424
|
return isActiveAnnotation(annotationType)(snapshot)
|
|
425
425
|
},
|
|
426
426
|
addAnnotation: (type, value) => {
|
|
427
|
-
let paths: ReturnType<EditableAPI['addAnnotation']>
|
|
427
|
+
let paths: ReturnType<EditableAPI['addAnnotation']>
|
|
428
428
|
|
|
429
429
|
Editor.withoutNormalizing(editor, () => {
|
|
430
430
|
paths = addAnnotationOperationImplementation({
|
|
@@ -298,7 +298,7 @@ function setPatch(editor: PortableTextSlateEditor, patch: SetPatch) {
|
|
|
298
298
|
return true
|
|
299
299
|
} else if (Element.isElement(block.node) && patch.path.length === 1) {
|
|
300
300
|
const {children, ...nextRest} = value as unknown as PortableTextBlock
|
|
301
|
-
const {children:
|
|
301
|
+
const {children: _prevChildren, ...prevRest} = block.node || {
|
|
302
302
|
children: undefined,
|
|
303
303
|
}
|
|
304
304
|
|
|
@@ -136,7 +136,7 @@ function toSlateSelectionPoint(
|
|
|
136
136
|
let offset = spanSelectionPoint?.offset ?? selectionPoint.offset
|
|
137
137
|
let childPath: Array<number> = []
|
|
138
138
|
let childIndex = -1
|
|
139
|
-
let pathChild: PortableTextSpan | PortableTextObject | undefined
|
|
139
|
+
let pathChild: PortableTextSpan | PortableTextObject | undefined
|
|
140
140
|
|
|
141
141
|
for (const child of block.children) {
|
|
142
142
|
childIndex++
|
|
@@ -46,7 +46,7 @@ export const addAnnotationOperationImplementation: BehaviorOperationImplementati
|
|
|
46
46
|
return
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
let paths: AddedAnnotationPaths | undefined
|
|
49
|
+
let paths: AddedAnnotationPaths | undefined
|
|
50
50
|
let spanPath: Path | undefined
|
|
51
51
|
let markDefPath: Path | undefined
|
|
52
52
|
const markDefPaths: Path[] = []
|