@tiptap/core 2.22.0 → 2.22.2

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,7 +1,7 @@
1
1
  {
2
2
  "name": "@tiptap/core",
3
3
  "description": "headless rich text editor",
4
- "version": "2.22.0",
4
+ "version": "2.22.2",
5
5
  "homepage": "https://tiptap.dev",
6
6
  "keywords": [
7
7
  "tiptap",
@@ -32,7 +32,7 @@
32
32
  "dist"
33
33
  ],
34
34
  "devDependencies": {
35
- "@tiptap/pm": "^2.22.0"
35
+ "@tiptap/pm": "^2.22.2"
36
36
  },
37
37
  "peerDependencies": {
38
38
  "@tiptap/pm": "^2.7.0"
package/src/NodePos.ts CHANGED
@@ -138,6 +138,12 @@ export class NodePos {
138
138
  const isNonTextAtom = node.isAtom && !node.isText
139
139
 
140
140
  const targetPos = this.pos + offset + (isNonTextAtom ? 0 : 1)
141
+
142
+ // Check if targetPos is within valid document range
143
+ if (targetPos < 0 || targetPos > this.resolvedPos.doc.nodeSize - 2) {
144
+ return
145
+ }
146
+
141
147
  const $pos = this.resolvedPos.doc.resolve(targetPos)
142
148
 
143
149
  if (!isBlock && $pos.depth <= this.depth) {