fix: emit a contentError on inserting invalid content

This commit is contained in:
Nick the Sick 2024-07-26 13:44:03 +02:00
parent 42dc27aa4b
commit d3e88e791d
No known key found for this signature in database
GPG Key ID: F575992F156E5BCC

View File

@ -81,6 +81,13 @@ export const insertContentAt: RawCommands['insertContentAt'] = (position, value,
errorOnInvalidContent: options.errorOnInvalidContent ?? editor.options.enableContentCheck,
})
} catch (e) {
editor.emit('contentError', {
editor,
error: e as Error,
disableCollaboration: () => {
console.error('[tiptap error]: Unable to disable collaboration at this point in time')
},
})
return false
}