@portabletext/editor 3.2.0 → 3.2.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@portabletext/editor",
3
- "version": "3.2.0",
3
+ "version": "3.2.2",
4
4
  "description": "Portable Text Editor made in React",
5
5
  "keywords": [
6
6
  "sanity",
@@ -75,7 +75,6 @@
75
75
  "xstate": "^5.24.0",
76
76
  "@portabletext/block-tools": "^4.1.4",
77
77
  "@portabletext/keyboard-shortcuts": "^2.1.0",
78
- "@portabletext/markdown": "^1.0.1",
79
78
  "@portabletext/patches": "^2.0.0",
80
79
  "@portabletext/schema": "^2.0.0"
81
80
  },
@@ -88,8 +87,8 @@
88
87
  "@types/lodash": "^4.17.20",
89
88
  "@types/lodash.startcase": "^4.4.9",
90
89
  "@types/node": "^20",
91
- "@types/react": "^19.2.2",
92
- "@types/react-dom": "^19.2.2",
90
+ "@types/react": "^19.2.7",
91
+ "@types/react-dom": "^19.2.3",
93
92
  "@vitejs/plugin-react": "^5.0.4",
94
93
  "@vitest/browser": "^4.0.14",
95
94
  "@vitest/browser-playwright": "^4.0.14",
@@ -99,8 +98,8 @@
99
98
  "eslint-formatter-gha": "^1.6.0",
100
99
  "eslint-plugin-react-hooks": "7.0.1",
101
100
  "jsdom": "^27.0.0",
102
- "react": "^19.2.0",
103
- "react-dom": "^19.2.0",
101
+ "react": "^19.2.1",
102
+ "react-dom": "^19.2.1",
104
103
  "rxjs": "^7.8.2",
105
104
  "typescript": "5.9.3",
106
105
  "typescript-eslint": "^8.46.1",
@@ -35,18 +35,6 @@ export const abstractDeserializeBehaviors = [
35
35
  } as const
36
36
  }
37
37
 
38
- const markdown =
39
- event.originEvent.originEvent.dataTransfer.getData('text/markdown')
40
-
41
- if (markdown) {
42
- return {
43
- type: 'deserialize.data',
44
- mimeType: 'text/markdown',
45
- data: markdown,
46
- originEvent: event.originEvent,
47
- } as const
48
- }
49
-
50
38
  const html =
51
39
  event.originEvent.originEvent.dataTransfer.getData('text/html')
52
40
 
@@ -211,20 +199,6 @@ export const abstractDeserializeBehaviors = [
211
199
  }
212
200
 
213
201
  if (event.mimeType === 'application/json') {
214
- const markdown =
215
- event.originEvent.originEvent.dataTransfer.getData('text/markdown')
216
-
217
- if (markdown) {
218
- return {
219
- type: 'deserialize.data',
220
- mimeType: 'text/markdown',
221
- data: markdown,
222
- originEvent: event.originEvent,
223
- } as const
224
- }
225
- }
226
-
227
- if (event.mimeType === 'text/markdown') {
228
202
  const html =
229
203
  event.originEvent.originEvent.dataTransfer.getData('text/html')
230
204
 
@@ -2,7 +2,6 @@ import type {PortableTextMemberSchemaTypes} from '../types/editor'
2
2
  import {converterJson} from './converter.json'
3
3
  import {converterPortableText} from './converter.portable-text'
4
4
  import {createConverterTextHtml} from './converter.text-html'
5
- import {converterTextMarkdown} from './converter.text-markdown'
6
5
  import {createConverterTextPlain} from './converter.text-plain'
7
6
 
8
7
  export function createCoreConverters(
@@ -11,7 +10,6 @@ export function createCoreConverters(
11
10
  return [
12
11
  converterJson,
13
12
  converterPortableText,
14
- converterTextMarkdown,
15
13
  createConverterTextHtml(legacySchema),
16
14
  createConverterTextPlain(legacySchema),
17
15
  ]
@@ -1,67 +0,0 @@
1
- import {
2
- markdownToPortableText,
3
- portableTextToMarkdown,
4
- } from '@portabletext/markdown'
5
- import {getSelectedValue} from '../selectors/selector.get-selected-value'
6
- import {parseBlock} from '../utils/parse-blocks'
7
- import {defineConverter} from './converter.types'
8
-
9
- export const converterTextMarkdown = defineConverter({
10
- mimeType: 'text/markdown',
11
- serialize: ({snapshot, event}) => {
12
- const selection = snapshot.context.selection
13
-
14
- if (!selection) {
15
- return {
16
- type: 'serialization.failure',
17
- mimeType: 'text/markdown',
18
- reason: 'No selection',
19
- originEvent: event.originEvent,
20
- }
21
- }
22
-
23
- const blocks = getSelectedValue(snapshot)
24
-
25
- const markdown = portableTextToMarkdown(blocks)
26
-
27
- return {
28
- type: 'serialization.success',
29
- data: markdown,
30
- mimeType: 'text/markdown',
31
- originEvent: event.originEvent,
32
- }
33
- },
34
- deserialize: ({snapshot, event}) => {
35
- const blocks = markdownToPortableText(event.data, {
36
- keyGenerator: snapshot.context.keyGenerator,
37
- schema: snapshot.context.schema,
38
- })
39
-
40
- const parsedBlocks = blocks.flatMap((block) => {
41
- const parsedBlock = parseBlock({
42
- context: snapshot.context,
43
- block,
44
- options: {
45
- normalize: false,
46
- removeUnusedMarkDefs: true,
47
- validateFields: false,
48
- },
49
- })
50
- return parsedBlock ? [parsedBlock] : []
51
- })
52
-
53
- if (parsedBlocks.length === 0) {
54
- return {
55
- type: 'deserialization.failure',
56
- mimeType: 'text/markdown',
57
- reason: 'No blocks deserialized',
58
- }
59
- }
60
-
61
- return {
62
- type: 'deserialization.success',
63
- data: parsedBlocks,
64
- mimeType: 'text/markdown',
65
- }
66
- },
67
- })