diff --git a/src/editor/index.js b/src/editor/index.js index a179c6d2..4bc90496 100644 --- a/src/editor/index.js +++ b/src/editor/index.js @@ -424,6 +424,7 @@ class Aganippe { setMarkdown (markdown, cursor, renderCursor = true) { // if markdown is blank, dont need to import markdown + // if (!markdown.trim()) return let newMarkdown = markdown if (cursor) { newMarkdown = this.contentState.addCursorToMarkdown(markdown, cursor) diff --git a/src/editor/utils/importMarkdown.js b/src/editor/utils/importMarkdown.js index 26c49098..33092322 100644 --- a/src/editor/utils/importMarkdown.js +++ b/src/editor/utils/importMarkdown.js @@ -218,7 +218,7 @@ const importRegister = ContentState => { } travel(rootState, childNodes) - return rootState.children + return rootState.children.length ? rootState.children : [this.createBlock()] } // transform `paste's text/html data` to content state blocks. ContentState.prototype.html2State = function (html) {