@portabletext/editor 2.1.7 → 2.1.9

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 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
- }): react22.JSX.Element;
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(): react22.JSX.Element;
195
+ declare function OneLinePlugin(): react12.JSX.Element;
196
196
  export { BehaviorPlugin, DecoratorShortcutPlugin, EditorRefPlugin, EventListenerPlugin, MarkdownPlugin, type MarkdownPluginConfig, OneLinePlugin };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@portabletext/editor",
3
- "version": "2.1.7",
3
+ "version": "2.1.9",
4
4
  "description": "Portable Text Editor made in React",
5
5
  "keywords": [
6
6
  "sanity",
@@ -79,16 +79,16 @@
79
79
  "slate-dom": "^0.117.4",
80
80
  "slate-react": "0.117.4",
81
81
  "xstate": "^5.20.1",
82
- "@portabletext/keyboard-shortcuts": "1.1.1",
82
+ "@portabletext/block-tools": "2.0.7",
83
83
  "@portabletext/patches": "1.1.6",
84
- "@portabletext/block-tools": "2.0.5"
84
+ "@portabletext/keyboard-shortcuts": "1.1.1"
85
85
  },
86
86
  "devDependencies": {
87
87
  "@portabletext/toolkit": "^2.0.17",
88
88
  "@sanity/diff-match-patch": "^3.2.0",
89
89
  "@sanity/pkg-utils": "^7.9.21",
90
- "@sanity/schema": "^4.2.0",
91
- "@sanity/types": "^4.2.0",
90
+ "@sanity/schema": "^4.3.0",
91
+ "@sanity/types": "^4.3.0",
92
92
  "@testing-library/react": "^16.3.0",
93
93
  "@types/debug": "^4.1.12",
94
94
  "@types/lodash": "^4.17.16",
@@ -102,7 +102,7 @@
102
102
  "@vitest/coverage-istanbul": "^3.2.4",
103
103
  "babel-plugin-react-compiler": "19.1.0-rc.2",
104
104
  "eslint": "8.57.1",
105
- "eslint-plugin-react-hooks": "0.0.0-experimental-dffacc7b-20250717",
105
+ "eslint-plugin-react-hooks": "6.0.0-rc.1",
106
106
  "jsdom": "^26.0.0",
107
107
  "react": "^19.1.1",
108
108
  "react-dom": "^19.1.1",
@@ -114,8 +114,8 @@
114
114
  "racejar": "1.2.12"
115
115
  },
116
116
  "peerDependencies": {
117
- "@sanity/schema": "^4.2.0",
118
- "@sanity/types": "^4.2.0",
117
+ "@sanity/schema": "^4.3.0",
118
+ "@sanity/types": "^4.3.0",
119
119
  "react": "^18.3 || ^19",
120
120
  "rxjs": "^7.8.2"
121
121
  },
@@ -1,7 +1,14 @@
1
1
  import type {Patch} from '@portabletext/patches'
2
2
  import type {PortableTextBlock} from '@sanity/types'
3
3
  import {isEqual} from 'lodash'
4
- import {Editor, Text, Transforms, type Descendant, type Node} from 'slate'
4
+ import {
5
+ deleteText,
6
+ Editor,
7
+ Text,
8
+ Transforms,
9
+ type Descendant,
10
+ type Node,
11
+ } from 'slate'
5
12
  import {
6
13
  and,
7
14
  assertEvent,
@@ -172,12 +179,11 @@ export const syncMachine = setup({
172
179
  guards: {
173
180
  'initial value synced': ({context}) => context.initialValueSynced,
174
181
  'is busy': ({context}) => {
175
- const editable = !context.readOnly
176
182
  const isProcessingLocalChanges = context.isProcessingLocalChanges
177
183
  const isChanging = isChangingRemotely(context.slateEditor) ?? false
178
- const isBusy = editable && (isProcessingLocalChanges || isChanging)
184
+ const isBusy = isProcessingLocalChanges || isChanging
179
185
 
180
- debug('isBusy', {isBusy, editable, isProcessingLocalChanges, isChanging})
186
+ debug('isBusy', {isBusy, isProcessingLocalChanges, isChanging})
181
187
 
182
188
  return isBusy
183
189
  },
@@ -823,7 +829,7 @@ function _updateBlock(
823
829
  oldBlockChild._type === 'span'
824
830
  if (isSpanNode && isTextChanged) {
825
831
  if (oldBlockChild.text.length > 0) {
826
- Transforms.delete(slateEditor, {
832
+ deleteText(slateEditor, {
827
833
  at: {
828
834
  focus: {path, offset: 0},
829
835
  anchor: {path, offset: oldBlockChild.text.length},