mirror of
https://github.com/ueberdosis/tiptap.git
synced 2025-08-06 13:38:49 +08:00
fix: prevent dispatch empty fragment when parsing content with insertContent
This commit is contained in:
parent
f5febda470
commit
2a4e02ade3
@ -25,6 +25,12 @@ export const insertContentAt: RawCommands['insertContentAt'] = (position, value)
|
||||
preserveWhitespace: 'full',
|
||||
},
|
||||
})
|
||||
|
||||
// don’t dispatch an empty fragment because this can lead to strange errors
|
||||
if (content.toString() === '<>') {
|
||||
return true
|
||||
}
|
||||
|
||||
const { from, to } = typeof position === 'number'
|
||||
? { from: position, to: position }
|
||||
: position
|
||||
|
Loading…
Reference in New Issue
Block a user