fix: prevent dispatch empty fragment when parsing content with insertContent

This commit is contained in:
Philipp Kühn 2021-06-01 18:20:01 +02:00
parent f5febda470
commit 2a4e02ade3

View File

@ -25,6 +25,12 @@ export const insertContentAt: RawCommands['insertContentAt'] = (position, value)
preserveWhitespace: 'full',
},
})
// dont 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