@portabletext/editor 1.0.15 → 1.0.16

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.0.15",
3
+ "version": "1.0.16",
4
4
  "description": "Portable Text Editor made in React",
5
5
  "keywords": [
6
6
  "sanity",
@@ -51,18 +51,18 @@
51
51
  },
52
52
  "devDependencies": {
53
53
  "@jest/globals": "^29.7.0",
54
- "@playwright/test": "1.46.0",
54
+ "@playwright/test": "1.46.1",
55
55
  "@portabletext/toolkit": "^2.0.15",
56
- "@sanity/block-tools": "^3.54.0",
56
+ "@sanity/block-tools": "^3.55.0",
57
57
  "@sanity/diff-match-patch": "^3.1.1",
58
58
  "@sanity/eslint-config-i18n": "^1.1.0",
59
59
  "@sanity/eslint-config-studio": "^4.0.0",
60
- "@sanity/pkg-utils": "^6.10.9",
61
- "@sanity/schema": "^3.54.0",
60
+ "@sanity/pkg-utils": "^6.10.10",
61
+ "@sanity/schema": "^3.55.0",
62
62
  "@sanity/test": "0.0.1-alpha.1",
63
- "@sanity/types": "^3.54.0",
63
+ "@sanity/types": "^3.55.0",
64
64
  "@sanity/ui": "^2.8.8",
65
- "@sanity/util": "^3.54.0",
65
+ "@sanity/util": "^3.55.0",
66
66
  "@testing-library/dom": "^10.4.0",
67
67
  "@testing-library/react": "^16.0.0",
68
68
  "@types/debug": "^4.1.5",
@@ -74,8 +74,8 @@
74
74
  "@types/react": "^18.3.3",
75
75
  "@types/react-dom": "^18.3.0",
76
76
  "@types/ws": "~8.5.12",
77
- "@typescript-eslint/eslint-plugin": "^8.1.0",
78
- "@typescript-eslint/parser": "^8.1.0",
77
+ "@typescript-eslint/eslint-plugin": "^8.2.0",
78
+ "@typescript-eslint/parser": "^8.2.0",
79
79
  "@vitejs/plugin-react": "^4.3.1",
80
80
  "dotenv": "^16.4.5",
81
81
  "eslint": "^8.57.0",
@@ -84,14 +84,14 @@
84
84
  "eslint-import-resolver-typescript": "^3.6.1",
85
85
  "eslint-plugin-import": "^2.29.1",
86
86
  "eslint-plugin-prettier": "^5.2.1",
87
- "eslint-plugin-react-compiler": "0.0.0-experimental-d0e920e-20240815",
87
+ "eslint-plugin-react-compiler": "0.0.0-experimental-eeb1b2a-20240818",
88
88
  "eslint-plugin-tsdoc": "^0.3.0",
89
89
  "eslint-plugin-unicorn": "^55.0.0",
90
90
  "eslint-plugin-unused-imports": "^4.1.3",
91
91
  "express": "^4.19.2",
92
92
  "express-ws": "^5.0.2",
93
93
  "jest": "^29.7.0",
94
- "jest-dev-server": "^10.0.0",
94
+ "jest-dev-server": "^10.1.0",
95
95
  "jest-environment-jsdom": "^29.7.0",
96
96
  "jest-environment-node": "^29.7.0",
97
97
  "node-ipc": "npm:@node-ipc/compat@9.2.5",
@@ -101,7 +101,7 @@
101
101
  "styled-components": "^6.1.12",
102
102
  "tsx": "^4.17.0",
103
103
  "typescript": "5.5.4",
104
- "vite": "^5.4.1"
104
+ "vite": "^5.4.2"
105
105
  },
106
106
  "peerDependencies": {
107
107
  "@sanity/block-tools": "^3.47.1",
@@ -205,15 +205,6 @@ export function createWithPortableTextMarkModel(
205
205
  }
206
206
  }
207
207
  }
208
- // Empty marks if text is empty
209
- if (
210
- isSpan &&
211
- Array.isArray(node.marks) &&
212
- (!node.marks || (node.marks.length > 0 && node.text === ''))
213
- ) {
214
- Transforms.setNodes(editor, {marks: []}, {at: path, voids: false})
215
- return
216
- }
217
208
  }
218
209
  // Check consistency of markDefs (unless we are merging two nodes)
219
210
  if (
@@ -354,6 +345,18 @@ export function createWithPortableTextMarkModel(
354
345
  editor.onChange()
355
346
  return
356
347
  }
348
+
349
+ const nodeHasMarks = node.marks !== undefined && node.marks.length > 0
350
+
351
+ if (nodeHasMarks && deletingAllText) {
352
+ Editor.withoutNormalizing(editor, () => {
353
+ apply(op)
354
+ Transforms.setNodes(editor, {marks: []}, {at: op.path})
355
+ })
356
+
357
+ editor.onChange()
358
+ return
359
+ }
357
360
  }
358
361
  }
359
362