@tiptap/core 3.4.3 → 3.4.4

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": "3.4.3",
4
+ "version": "3.4.4",
5
5
  "homepage": "https://tiptap.dev",
6
6
  "keywords": [
7
7
  "tiptap",
@@ -52,10 +52,10 @@
52
52
  "jsx-dev-runtime"
53
53
  ],
54
54
  "devDependencies": {
55
- "@tiptap/pm": "^3.4.3"
55
+ "@tiptap/pm": "^3.4.4"
56
56
  },
57
57
  "peerDependencies": {
58
- "@tiptap/pm": "^3.4.3"
58
+ "@tiptap/pm": "^3.4.4"
59
59
  },
60
60
  "repository": {
61
61
  "type": "git",
@@ -74,7 +74,6 @@ export const insertContentAt: RawCommands['insertContentAt'] =
74
74
  }
75
75
 
76
76
  let content: Fragment | ProseMirrorNode
77
- const { selection } = editor.state
78
77
 
79
78
  const emitContentError = (error: Error) => {
80
79
  editor.emit('contentError', {
@@ -180,9 +179,11 @@ export const insertContentAt: RawCommands['insertContentAt'] =
180
179
  } else {
181
180
  newContent = content
182
181
 
183
- const fromSelectionAtStart = selection.$from.parentOffset === 0
184
- const isTextSelection = selection.$from.node().isText || selection.$from.node().isTextblock
185
- const hasContent = selection.$from.node().content.size > 0
182
+ const $from = tr.doc.resolve(from)
183
+ const $fromNode = $from.node()
184
+ const fromSelectionAtStart = $from.parentOffset === 0
185
+ const isTextSelection = $fromNode.isText || $fromNode.isTextblock
186
+ const hasContent = $fromNode.content.size > 0
186
187
 
187
188
  if (fromSelectionAtStart && isTextSelection && hasContent) {
188
189
  from = Math.max(0, from - 1)