@portabletext/editor 2.1.2 → 2.1.3
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/index.cjs +5 -4
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +5 -4
- package/lib/index.js.map +1 -1
- package/lib/plugins/index.d.ts +3 -3
- package/lib/utils/index.d.cts +2 -2
- package/package.json +7 -7
- package/src/behaviors/behavior.abstract.list-item.ts +10 -2
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 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.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BlockOffset, BlockPath, ChildPath, EditorContext, EditorSelection, EditorSelectionPoint } from "../_chunks-dts/behavior.types.action.cjs";
|
|
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.3",
|
|
4
4
|
"description": "Portable Text Editor made in React",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sanity",
|
|
@@ -75,14 +75,14 @@
|
|
|
75
75
|
"lodash": "^4.17.21",
|
|
76
76
|
"lodash.startcase": "^4.4.0",
|
|
77
77
|
"react-compiler-runtime": "19.1.0-rc.2",
|
|
78
|
-
"slate": "0.
|
|
78
|
+
"slate": "0.118.0",
|
|
79
79
|
"slate-dom": "^0.117.4",
|
|
80
80
|
"slate-react": "0.117.4",
|
|
81
81
|
"use-effect-event": "^1.0.2",
|
|
82
82
|
"xstate": "^5.20.1",
|
|
83
|
-
"@portabletext/block-tools": "2.0.
|
|
84
|
-
"@portabletext/
|
|
85
|
-
"@portabletext/
|
|
83
|
+
"@portabletext/block-tools": "2.0.4",
|
|
84
|
+
"@portabletext/patches": "1.1.6",
|
|
85
|
+
"@portabletext/keyboard-shortcuts": "1.1.1"
|
|
86
86
|
},
|
|
87
87
|
"devDependencies": {
|
|
88
88
|
"@portabletext/toolkit": "^2.0.17",
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
"@types/react-dom": "^19.1.7",
|
|
99
99
|
"@typescript-eslint/eslint-plugin": "^8.38.0",
|
|
100
100
|
"@typescript-eslint/parser": "^8.38.0",
|
|
101
|
-
"@vitejs/plugin-react": "^4.
|
|
101
|
+
"@vitejs/plugin-react": "^4.7.0",
|
|
102
102
|
"@vitest/browser": "^3.2.4",
|
|
103
103
|
"@vitest/coverage-istanbul": "^3.2.4",
|
|
104
104
|
"babel-plugin-react-compiler": "19.1.0-rc.2",
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
"vite": "^7.0.6",
|
|
113
113
|
"vitest": "^3.2.4",
|
|
114
114
|
"vitest-browser-react": "^1.0.1",
|
|
115
|
-
"racejar": "1.2.
|
|
115
|
+
"racejar": "1.2.12"
|
|
116
116
|
},
|
|
117
117
|
"peerDependencies": {
|
|
118
118
|
"@sanity/schema": "^4.2.0",
|
|
@@ -5,7 +5,15 @@ import {defineBehavior} from './behavior.types.behavior'
|
|
|
5
5
|
export const abstractListItemBehaviors = [
|
|
6
6
|
defineBehavior({
|
|
7
7
|
on: 'list item.add',
|
|
8
|
-
guard: ({snapshot}) => {
|
|
8
|
+
guard: ({snapshot, event}) => {
|
|
9
|
+
if (
|
|
10
|
+
!snapshot.context.schema.lists.some(
|
|
11
|
+
(list) => list.name === event.listItem,
|
|
12
|
+
)
|
|
13
|
+
) {
|
|
14
|
+
return false
|
|
15
|
+
}
|
|
16
|
+
|
|
9
17
|
const selectedTextBlocks = getSelectedTextBlocks(snapshot)
|
|
10
18
|
|
|
11
19
|
return {selectedTextBlocks}
|
|
@@ -17,7 +25,7 @@ export const abstractListItemBehaviors = [
|
|
|
17
25
|
type: 'block.set',
|
|
18
26
|
at: block.path,
|
|
19
27
|
props: {
|
|
20
|
-
level: 1,
|
|
28
|
+
level: block.node.level ?? 1,
|
|
21
29
|
listItem: event.listItem,
|
|
22
30
|
},
|
|
23
31
|
}),
|