@portabletext/editor 2.15.0 → 2.15.1

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 { BlockOffset, BlockPath, ChildPath, EditorContext, EditorSelection, EditorSelectionPoint } from "../_chunks-dts/behavior.types.action.cjs";
2
- import * as _sanity_types9 from "@sanity/types";
2
+ import * as _sanity_types8 from "@sanity/types";
3
3
  import { KeyedSegment, PortableTextBlock, PortableTextTextBlock } from "@sanity/types";
4
4
  import { isSpan, isTextBlock } from "@portabletext/schema";
5
5
  /**
@@ -143,7 +143,7 @@ declare function mergeTextBlocks({
143
143
  context: Pick<EditorContext, 'keyGenerator' | 'schema'>;
144
144
  targetBlock: PortableTextTextBlock;
145
145
  incomingBlock: PortableTextTextBlock;
146
- }): PortableTextTextBlock<_sanity_types9.PortableTextObject | _sanity_types9.PortableTextSpan>;
146
+ }): PortableTextTextBlock<_sanity_types8.PortableTextObject | _sanity_types8.PortableTextSpan>;
147
147
  /**
148
148
  * @public
149
149
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@portabletext/editor",
3
- "version": "2.15.0",
3
+ "version": "2.15.1",
4
4
  "description": "Portable Text Editor made in React",
5
5
  "keywords": [
6
6
  "sanity",
@@ -85,7 +85,7 @@
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.11",
88
+ "@portabletext/block-tools": "^3.5.12",
89
89
  "@portabletext/keyboard-shortcuts": "^1.1.1",
90
90
  "@portabletext/patches": "^1.1.8",
91
91
  "@portabletext/schema": "^1.2.0"
@@ -93,8 +93,8 @@
93
93
  "devDependencies": {
94
94
  "@sanity/diff-match-patch": "^3.2.0",
95
95
  "@sanity/pkg-utils": "^8.1.14",
96
- "@sanity/schema": "^4.10.3",
97
- "@sanity/types": "^4.10.3",
96
+ "@sanity/schema": "^4.11.0",
97
+ "@sanity/types": "^4.11.0",
98
98
  "@types/debug": "^4.1.12",
99
99
  "@types/lodash": "^4.17.20",
100
100
  "@types/lodash.startcase": "^4.4.9",
@@ -117,14 +117,14 @@
117
117
  "vite": "^7.1.7",
118
118
  "vitest": "^3.2.4",
119
119
  "vitest-browser-react": "^1.0.1",
120
- "@portabletext/sanity-bridge": "1.1.14",
120
+ "@portabletext/sanity-bridge": "1.1.15",
121
121
  "@portabletext/test": "^0.0.0",
122
122
  "racejar": "1.3.2"
123
123
  },
124
124
  "peerDependencies": {
125
- "@portabletext/sanity-bridge": "^1.1.14",
126
- "@sanity/schema": "^4.10.3",
127
- "@sanity/types": "^4.10.3",
125
+ "@portabletext/sanity-bridge": "^1.1.15",
126
+ "@sanity/schema": "^4.11.0",
127
+ "@sanity/types": "^4.11.0",
128
128
  "react": "^18.3 || ^19",
129
129
  "rxjs": "^7.8.2"
130
130
  },
@@ -74,27 +74,53 @@ export const insertChildOperationImplementation: BehaviorOperationImplementation
74
74
  if (inlineObject) {
75
75
  const {_key, _type, ...rest} = inlineObject
76
76
 
77
- Transforms.insertNodes(
78
- operation.editor,
79
- {
80
- _key,
81
- _type,
82
- children: [
83
- {
84
- _key: VOID_CHILD_KEY,
85
- _type: 'span',
86
- text: '',
87
- marks: [],
88
- },
89
- ],
90
- value: rest,
91
- __inline: true,
92
- },
93
- {
94
- at: [focusBlockIndex, focusChildIndex + 1],
95
- select: true,
96
- },
97
- )
77
+ const [focusSpan] = getFocusSpan({editor: operation.editor})
78
+
79
+ if (focusSpan) {
80
+ Transforms.insertNodes(
81
+ operation.editor,
82
+ {
83
+ _key,
84
+ _type,
85
+ children: [
86
+ {
87
+ _key: VOID_CHILD_KEY,
88
+ _type: 'span',
89
+ text: '',
90
+ marks: [],
91
+ },
92
+ ],
93
+ value: rest,
94
+ __inline: true,
95
+ },
96
+ {
97
+ at: focus,
98
+ select: true,
99
+ },
100
+ )
101
+ } else {
102
+ Transforms.insertNodes(
103
+ operation.editor,
104
+ {
105
+ _key,
106
+ _type,
107
+ children: [
108
+ {
109
+ _key: VOID_CHILD_KEY,
110
+ _type: 'span',
111
+ text: '',
112
+ marks: [],
113
+ },
114
+ ],
115
+ value: rest,
116
+ __inline: true,
117
+ },
118
+ {
119
+ at: [focusBlockIndex, focusChildIndex + 1],
120
+ select: true,
121
+ },
122
+ )
123
+ }
98
124
 
99
125
  return
100
126
  }