Skip to content

Commit

Permalink
Fixed typo in EditorFactory serializePlainText
Browse files Browse the repository at this point in the history
An empty text file should be serialized as `''` so fix
checking if the document only contains an empty code block
which type is `codeBlock` on tiptap v2 not `code_block`.

Signed-off-by: Ferdinand Thiessen <[email protected]>
  • Loading branch information
susnux committed Jul 19, 2022
1 parent d8abe1d commit f9b28a9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/EditorFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ const serializePlainText = (tiptap) => {
const doc = tiptap.getJSON()

if (doc.content.length !== 1 || typeof doc.content[0].content === 'undefined' || doc.content[0].content.length !== 1) {
if (doc.content[0].type === 'code_block' && typeof doc.content[0].content === 'undefined') {
if (doc.content[0].type === 'codeBlock' && typeof doc.content[0].content === 'undefined') {
return ''
}
throw new SerializeException('Failed to serialize document to plain text')
Expand Down

0 comments on commit f9b28a9

Please sign in to comment.