@portabletext/editor 2.15.2 → 2.15.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.
@@ -1,5 +1,5 @@
1
1
  import { Behavior, Editor, EditorEmittedEvent, EditorSchema } from "../_chunks-dts/behavior.types.action.js";
2
- import * as react22 from "react";
2
+ import * as react21 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
- }): react22.JSX.Element;
184
+ }): react21.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(): react22.JSX.Element;
195
+ declare function OneLinePlugin(): react21.JSX.Element;
196
196
  export { BehaviorPlugin, DecoratorShortcutPlugin, EditorRefPlugin, EventListenerPlugin, MarkdownPlugin, MarkdownPluginConfig, OneLinePlugin };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@portabletext/editor",
3
- "version": "2.15.2",
3
+ "version": "2.15.3",
4
4
  "description": "Portable Text Editor made in React",
5
5
  "keywords": [
6
6
  "sanity",
@@ -85,9 +85,9 @@
85
85
  "slate-dom": "^0.118.1",
86
86
  "slate-react": "0.117.4",
87
87
  "xstate": "^5.23.0",
88
- "@portabletext/block-tools": "^3.5.12",
89
88
  "@portabletext/keyboard-shortcuts": "^1.1.1",
90
89
  "@portabletext/patches": "^1.1.8",
90
+ "@portabletext/block-tools": "^3.5.12",
91
91
  "@portabletext/schema": "^1.2.0"
92
92
  },
93
93
  "devDependencies": {
@@ -124,6 +124,12 @@ export function setNodePatch(
124
124
  }
125
125
  }
126
126
 
127
+ for (const key of Object.keys(operation.properties)) {
128
+ if (!(key in operation.newProperties)) {
129
+ patches.push(unset([{_key: block._key}, key]))
130
+ }
131
+ }
132
+
127
133
  return patches
128
134
  } else {
129
135
  const patches: Patch[] = []
@@ -134,20 +140,32 @@ export function setNodePatch(
134
140
  patches.push(set(_key, [blockIndex, '_key']))
135
141
  }
136
142
 
137
- const properties =
143
+ const newValue =
138
144
  'value' in operation.newProperties &&
139
145
  typeof operation.newProperties.value === 'object'
140
146
  ? (operation.newProperties.value as Record<string, unknown>)
141
147
  : ({} satisfies Record<string, unknown>)
142
148
 
143
- const keys = Object.keys(properties)
149
+ const keys = Object.keys(newValue)
144
150
 
145
151
  for (const key of keys) {
146
- const value = properties[key]
152
+ const value = newValue[key]
147
153
 
148
154
  patches.push(set(value, [{_key: block._key}, key]))
149
155
  }
150
156
 
157
+ const value =
158
+ 'value' in operation.properties &&
159
+ typeof operation.properties.value === 'object'
160
+ ? (operation.properties.value as Record<string, unknown>)
161
+ : ({} satisfies Record<string, unknown>)
162
+
163
+ for (const key of Object.keys(value)) {
164
+ if (!(key in newValue)) {
165
+ patches.push(unset([{_key: block._key}, key]))
166
+ }
167
+ }
168
+
151
169
  return patches
152
170
  }
153
171
  } else if (operation.path.length === 2) {