@portabletext/editor 1.18.4 → 1.18.6

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.18.4",
3
+ "version": "1.18.6",
4
4
  "description": "Portable Text Editor made in React",
5
5
  "keywords": [
6
6
  "sanity",
@@ -61,7 +61,7 @@
61
61
  "get-random-values-esm": "^1.0.2",
62
62
  "lodash": "^4.17.21",
63
63
  "lodash.startcase": "^4.4.0",
64
- "react-compiler-runtime": "19.0.0-beta-201e55d-20241215",
64
+ "react-compiler-runtime": "19.0.0-beta-b2e8e9c-20241220",
65
65
  "slate": "0.112.0",
66
66
  "slate-dom": "^0.111.0",
67
67
  "slate-react": "0.112.0",
@@ -70,11 +70,11 @@
70
70
  },
71
71
  "devDependencies": {
72
72
  "@portabletext/toolkit": "^2.0.16",
73
- "@sanity/block-tools": "^3.68.1",
73
+ "@sanity/block-tools": "^3.68.3",
74
74
  "@sanity/diff-match-patch": "^3.1.2",
75
75
  "@sanity/pkg-utils": "^6.12.2",
76
- "@sanity/schema": "^3.68.1",
77
- "@sanity/types": "^3.68.1",
76
+ "@sanity/schema": "^3.68.3",
77
+ "@sanity/types": "^3.68.3",
78
78
  "@testing-library/jest-dom": "^6.6.3",
79
79
  "@testing-library/react": "^16.1.0",
80
80
  "@types/debug": "^4.1.5",
@@ -87,9 +87,9 @@
87
87
  "@vitejs/plugin-react": "^4.3.4",
88
88
  "@vitest/browser": "^2.1.8",
89
89
  "@vitest/coverage-istanbul": "^2.1.8",
90
- "babel-plugin-react-compiler": "19.0.0-beta-201e55d-20241215",
90
+ "babel-plugin-react-compiler": "19.0.0-beta-b2e8e9c-20241220",
91
91
  "eslint": "8.57.1",
92
- "eslint-plugin-react-compiler": "19.0.0-beta-201e55d-20241215",
92
+ "eslint-plugin-react-compiler": "19.0.0-beta-b2e8e9c-20241220",
93
93
  "eslint-plugin-react-hooks": "^5.1.0",
94
94
  "jsdom": "^25.0.1",
95
95
  "react": "^19.0.0",
@@ -103,9 +103,9 @@
103
103
  "racejar": "1.1.1"
104
104
  },
105
105
  "peerDependencies": {
106
- "@sanity/block-tools": "^3.68.1",
107
- "@sanity/schema": "^3.68.1",
108
- "@sanity/types": "^3.68.1",
106
+ "@sanity/block-tools": "^3.68.3",
107
+ "@sanity/schema": "^3.68.3",
108
+ "@sanity/types": "^3.68.3",
109
109
  "react": "^16.9 || ^17 || ^18 || ^19",
110
110
  "rxjs": "^7.8.1",
111
111
  "styled-components": "^6.1.13"
@@ -156,16 +156,12 @@ export function createEmojiPickerBehaviors<TEmojiMatch>(
156
156
  return false
157
157
  }
158
158
 
159
- const isShift = isHotkey('Shift', event.keyboardEvent)
160
- const isColon = event.keyboardEvent.key === ':'
161
- const isEmojiChar = emojiCharRegEx.test(event.keyboardEvent.key)
159
+ const isEscape = isHotkey('Escape', event.keyboardEvent)
162
160
 
163
- if (isShift || isColon || isEmojiChar) {
164
- return false
161
+ if (isEscape) {
162
+ return {action: 'reset' as const}
165
163
  }
166
164
 
167
- const isArrowDown = isHotkey('ArrowDown', event.keyboardEvent)
168
- const isArrowUp = isHotkey('ArrowUp', event.keyboardEvent)
169
165
  const isEnter = isHotkey('Enter', event.keyboardEvent)
170
166
  const isTab = isHotkey('Tab', event.keyboardEvent)
171
167
 
@@ -204,6 +200,9 @@ export function createEmojiPickerBehaviors<TEmojiMatch>(
204
200
  return false
205
201
  }
206
202
 
203
+ const isArrowDown = isHotkey('ArrowDown', event.keyboardEvent)
204
+ const isArrowUp = isHotkey('ArrowUp', event.keyboardEvent)
205
+
207
206
  if (isArrowDown && matches.length > 0) {
208
207
  return {action: 'navigate down' as const}
209
208
  }
@@ -212,7 +211,7 @@ export function createEmojiPickerBehaviors<TEmojiMatch>(
212
211
  return {action: 'navigate up' as const}
213
212
  }
214
213
 
215
- return {action: 'reset' as const}
214
+ return false
216
215
  },
217
216
  actions: [
218
217
  (_, params) => {
@@ -49,16 +49,20 @@ export function toSlatePath(path: Path, editor: Editor): SlatePath {
49
49
  isKeySegment(path[0]) && (n as Descendant)._key === path[0]._key,
50
50
  }),
51
51
  )[0] || [undefined, undefined]
52
+
52
53
  if (!block || !Element.isElement(block)) {
53
54
  return []
54
55
  }
56
+
55
57
  if (editor.isVoid(block)) {
56
58
  return [blockPath[0], 0]
57
59
  }
60
+
58
61
  const childPath = [path[2]]
59
62
  const childIndex = block.children.findIndex((child) =>
60
63
  isEqual([{_key: child._key}], childPath),
61
64
  )
65
+
62
66
  if (childIndex >= 0 && block.children[childIndex]) {
63
67
  const child = block.children[childIndex]
64
68
  if (Element.isElement(child) && editor.isVoid(child)) {
@@ -66,5 +70,6 @@ export function toSlatePath(path: Path, editor: Editor): SlatePath {
66
70
  }
67
71
  return blockPath.concat(childIndex)
68
72
  }
69
- return blockPath
73
+
74
+ return [blockPath[0], 0]
70
75
  }