fix: prevent dispatch empty fragment when parsing content with insertContent
This commit is contained in:
@@ -25,6 +25,12 @@ export const insertContentAt: RawCommands['insertContentAt'] = (position, value)
|
|||||||
preserveWhitespace: 'full',
|
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'
|
const { from, to } = typeof position === 'number'
|
||||||
? { from: position, to: position }
|
? { from: position, to: position }
|
||||||
: position
|
: position
|
||||||
|
|||||||
Reference in New Issue
Block a user