@portabletext/editor 1.47.8 → 1.47.10

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": "1.47.8",
3
+ "version": "1.47.10",
4
4
  "description": "Portable Text Editor made in React",
5
5
  "keywords": [
6
6
  "sanity",
@@ -93,8 +93,8 @@
93
93
  "@types/debug": "^4.1.12",
94
94
  "@types/lodash": "^4.17.16",
95
95
  "@types/lodash.startcase": "^4.4.9",
96
- "@types/react": "^19.1.0",
97
- "@types/react-dom": "^19.1.1",
96
+ "@types/react": "^19.1.2",
97
+ "@types/react-dom": "^19.1.2",
98
98
  "@typescript-eslint/eslint-plugin": "^8.29.0",
99
99
  "@typescript-eslint/parser": "^8.29.0",
100
100
  "@vitejs/plugin-react": "^4.3.4",
@@ -112,7 +112,7 @@
112
112
  "vite": "^6.2.5",
113
113
  "vitest": "^3.1.1",
114
114
  "vitest-browser-react": "^0.1.1",
115
- "racejar": "1.2.3"
115
+ "racejar": "1.2.4"
116
116
  },
117
117
  "peerDependencies": {
118
118
  "@sanity/schema": "^3.85.1",
@@ -9,7 +9,6 @@ import {
9
9
  } from 'slate'
10
10
  import {
11
11
  and,
12
- assertEvent,
13
12
  assign,
14
13
  fromCallback,
15
14
  setup,
@@ -82,16 +81,16 @@ export const rangeDecorationsMachine = setup({
82
81
  },
83
82
  actions: {
84
83
  'update pending range decorations': assign({
85
- pendingRangeDecorations: ({event}) => {
86
- assertEvent(event, 'range decorations updated')
84
+ pendingRangeDecorations: ({context, event}) => {
85
+ if (event.type !== 'range decorations updated') {
86
+ return context.pendingRangeDecorations
87
+ }
87
88
 
88
89
  return event.rangeDecorations
89
90
  },
90
91
  }),
91
92
  'set up initial range decorations': assign({
92
- decoratedRanges: ({context, event}) => {
93
- assertEvent(event, 'ready')
94
-
93
+ decoratedRanges: ({context}) => {
95
94
  const rangeDecorationState: Array<DecoratedRange> = []
96
95
 
97
96
  for (const rangeDecoration of context.pendingRangeDecorations) {
@@ -120,7 +119,9 @@ export const rangeDecorationsMachine = setup({
120
119
  }),
121
120
  'update range decorations': assign({
122
121
  decoratedRanges: ({context, event}) => {
123
- assertEvent(event, 'range decorations updated')
122
+ if (event.type !== 'range decorations updated') {
123
+ return context.decoratedRanges
124
+ }
124
125
 
125
126
  const rangeDecorationState: Array<DecoratedRange> = []
126
127
 
@@ -150,7 +151,9 @@ export const rangeDecorationsMachine = setup({
150
151
  }),
151
152
  'move range decorations': assign({
152
153
  decoratedRanges: ({context, event}) => {
153
- assertEvent(event, 'slate operation')
154
+ if (event.type !== 'slate operation') {
155
+ return context.decoratedRanges
156
+ }
154
157
 
155
158
  const rangeDecorationState: Array<DecoratedRange> = []
156
159
 
@@ -212,8 +215,11 @@ export const rangeDecorationsMachine = setup({
212
215
  },
213
216
  }),
214
217
  'assign readOnly': assign({
215
- readOnly: ({event}) => {
216
- assertEvent(event, 'update read only')
218
+ readOnly: ({context, event}) => {
219
+ if (event.type !== 'update read only') {
220
+ return context.readOnly
221
+ }
222
+
217
223
  return event.readOnly
218
224
  },
219
225
  }),
@@ -231,7 +237,9 @@ export const rangeDecorationsMachine = setup({
231
237
  context.pendingRangeDecorations.length > 0,
232
238
  'has range decorations': ({context}) => context.decoratedRanges.length > 0,
233
239
  'has different decorations': ({context, event}) => {
234
- assertEvent(event, 'range decorations updated')
240
+ if (event.type !== 'range decorations updated') {
241
+ return false
242
+ }
235
243
 
236
244
  const existingRangeDecorations = context.decoratedRanges.map(
237
245
  (decoratedRange) => ({