fix(tiptap-editor): use insertContentAt with drop position in onDrop handler
Previously dropped images were inserted at the current cursor position instead of the actual drop position. Now uses insertContentAt(pos, ...) to place images at the correct location.
This commit is contained in:
parent
00c5a880f4
commit
c2c7b46958
@ -78,7 +78,10 @@ class TiptapEditorInstance {
|
||||
files.forEach((file) => {
|
||||
this.options.onImageUpload!(file)
|
||||
.then((url) => {
|
||||
editor.chain().focus().setImage({ src: url }).run()
|
||||
editor.chain().focus().insertContentAt(pos, {
|
||||
type: 'image',
|
||||
attrs: { src: url }
|
||||
}).run()
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error('[TiptapEditor] Upload failed:', err)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user