diff options
author | Julius Härtl <jus@bitgrid.net> | 2019-07-09 11:55:46 +0300 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2019-07-10 17:11:40 +0300 |
commit | e9e09b82b908690991cd9c60e4baedd8833c83f5 (patch) | |
tree | 281ef8ea4a2a03624c7f9a1f5638c54b36e25498 /src/EditorFactory.js | |
parent | eb155ec1e94f33574d990fb33459b91bce311e18 (diff) |
Reconnect after session has timed out
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'src/EditorFactory.js')
-rw-r--r-- | src/EditorFactory.js | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/EditorFactory.js b/src/EditorFactory.js index e0cbd3206..32fbf12be 100644 --- a/src/EditorFactory.js +++ b/src/EditorFactory.js @@ -101,7 +101,7 @@ const createEditor = ({ content, onUpdate, extensions, enableRichEditing, langua const markdownit = MarkdownIt('commonmark', { html: false, breaks: false }) .enable('strikethrough') -const SerializeException = (message) => { +const SerializeException = function(message) { this.message = message } const createMarkdownSerializer = (_nodes, _marks) => { @@ -135,7 +135,10 @@ const createMarkdownSerializer = (_nodes, _marks) => { const serializePlainText = (tiptap) => { const doc = tiptap.getJSON() - if (doc.content.length !== 1 || doc.content[0].content.length !== 1) { + 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') { + return '' + } throw new SerializeException('Failed to serialize document to plain text') } const codeBlock = doc.content[0].content[0] |