@tiptap/core 3.4.2 → 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/dist/index.cjs +8 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -6
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/Editor.ts +2 -1
- package/src/commands/insertContentAt.ts +5 -4
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.
|
|
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.
|
|
55
|
+
"@tiptap/pm": "^3.4.4"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
|
-
"@tiptap/pm": "^3.4.
|
|
58
|
+
"@tiptap/pm": "^3.4.4"
|
|
59
59
|
},
|
|
60
60
|
"repository": {
|
|
61
61
|
"type": "git",
|
package/src/Editor.ts
CHANGED
|
@@ -506,6 +506,8 @@ export class Editor extends EventEmitter<EditorEvents> {
|
|
|
506
506
|
},
|
|
507
507
|
dispatchTransaction: this.dispatchTransaction.bind(this),
|
|
508
508
|
state: this.editorState,
|
|
509
|
+
markViews: this.extensionManager.markViews,
|
|
510
|
+
nodeViews: this.extensionManager.nodeViews,
|
|
509
511
|
})
|
|
510
512
|
|
|
511
513
|
// `editor.view` is not yet available at this time.
|
|
@@ -516,7 +518,6 @@ export class Editor extends EventEmitter<EditorEvents> {
|
|
|
516
518
|
|
|
517
519
|
this.view.updateState(newState)
|
|
518
520
|
|
|
519
|
-
this.createNodeViews()
|
|
520
521
|
this.prependClass()
|
|
521
522
|
this.injectCSS()
|
|
522
523
|
|
|
@@ -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
|
|
184
|
-
const
|
|
185
|
-
const
|
|
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)
|