@portabletext/editor 1.21.4 → 1.21.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.
- package/lib/index.cjs +6 -7
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +7 -8
- package/lib/index.js.map +1 -1
- package/package.json +11 -11
- package/src/editor/plugins/createWithInsertData.ts +6 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@portabletext/editor",
|
|
3
|
-
"version": "1.21.
|
|
3
|
+
"version": "1.21.6",
|
|
4
4
|
"description": "Portable Text Editor made in React",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sanity",
|
|
@@ -61,9 +61,8 @@
|
|
|
61
61
|
"src"
|
|
62
62
|
],
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@
|
|
65
|
-
"
|
|
66
|
-
"debug": "^4.3.4",
|
|
64
|
+
"@xstate/react": "^5.0.2",
|
|
65
|
+
"debug": "^4.4.0",
|
|
67
66
|
"get-random-values-esm": "^1.0.2",
|
|
68
67
|
"lodash": "^4.17.21",
|
|
69
68
|
"lodash.startcase": "^4.4.0",
|
|
@@ -72,18 +71,19 @@
|
|
|
72
71
|
"slate-dom": "^0.111.0",
|
|
73
72
|
"slate-react": "0.112.0",
|
|
74
73
|
"use-effect-event": "^1.0.2",
|
|
75
|
-
"xstate": "^5.19.
|
|
76
|
-
"@portabletext/block-tools": "
|
|
74
|
+
"xstate": "^5.19.2",
|
|
75
|
+
"@portabletext/block-tools": "1.1.0",
|
|
76
|
+
"@portabletext/patches": "1.1.1"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
79
|
"@portabletext/toolkit": "^2.0.16",
|
|
80
80
|
"@sanity/diff-match-patch": "^3.1.2",
|
|
81
81
|
"@sanity/pkg-utils": "^7.0.1",
|
|
82
|
-
"@sanity/schema": "^3.
|
|
83
|
-
"@sanity/types": "^3.
|
|
82
|
+
"@sanity/schema": "^3.70.0",
|
|
83
|
+
"@sanity/types": "^3.70.0",
|
|
84
84
|
"@testing-library/jest-dom": "^6.6.3",
|
|
85
85
|
"@testing-library/react": "^16.1.0",
|
|
86
|
-
"@types/debug": "^4.1.
|
|
86
|
+
"@types/debug": "^4.1.12",
|
|
87
87
|
"@types/lodash": "^4.17.13",
|
|
88
88
|
"@types/lodash.startcase": "^4.4.9",
|
|
89
89
|
"@types/react": "^19.0.2",
|
|
@@ -108,8 +108,8 @@
|
|
|
108
108
|
"racejar": "1.1.1"
|
|
109
109
|
},
|
|
110
110
|
"peerDependencies": {
|
|
111
|
-
"@sanity/schema": "^3.
|
|
112
|
-
"@sanity/types": "^3.
|
|
111
|
+
"@sanity/schema": "^3.70.0",
|
|
112
|
+
"@sanity/types": "^3.70.0",
|
|
113
113
|
"react": "^16.9 || ^17 || ^18 || ^19",
|
|
114
114
|
"rxjs": "^7.8.1"
|
|
115
115
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {htmlToBlocks
|
|
1
|
+
import {htmlToBlocks} from '@portabletext/block-tools'
|
|
2
2
|
import type {PortableTextBlock, PortableTextChild} from '@sanity/types'
|
|
3
3
|
import {isEqual, uniq} from 'lodash'
|
|
4
4
|
import {Editor, Range, Transforms, type Descendant, type Node} from 'slate'
|
|
@@ -194,9 +194,8 @@ export function createWithInsertData(
|
|
|
194
194
|
if (html) {
|
|
195
195
|
portableText = htmlToBlocks(html, schemaTypes.portableText, {
|
|
196
196
|
unstable_whitespaceOnPasteMode: whitespaceOnPasteMode,
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
) as PortableTextBlock[]
|
|
197
|
+
keyGenerator: editorActor.getSnapshot().context.keyGenerator,
|
|
198
|
+
}) as PortableTextBlock[]
|
|
200
199
|
fragment = toSlateValue(portableText, {schemaTypes})
|
|
201
200
|
insertedType = 'HTML'
|
|
202
201
|
|
|
@@ -214,9 +213,9 @@ export function createWithInsertData(
|
|
|
214
213
|
)
|
|
215
214
|
.join('')
|
|
216
215
|
const textToHtml = `<html><body>${blocks}</body></html>`
|
|
217
|
-
portableText = htmlToBlocks(textToHtml, schemaTypes.portableText
|
|
218
|
-
|
|
219
|
-
) as PortableTextBlock[]
|
|
216
|
+
portableText = htmlToBlocks(textToHtml, schemaTypes.portableText, {
|
|
217
|
+
keyGenerator: editorActor.getSnapshot().context.keyGenerator,
|
|
218
|
+
}) as PortableTextBlock[]
|
|
220
219
|
fragment = toSlateValue(portableText, {
|
|
221
220
|
schemaTypes,
|
|
222
221
|
})
|