From 379ffbddbcdce83325ed428fb48a4bf38c7ba914 Mon Sep 17 00:00:00 2001 From: Jocs Date: Sat, 31 Mar 2018 22:16:21 +0800 Subject: [PATCH] Bugfix: #112 --- src/editor/index.js | 1 + src/editor/utils/importMarkdown.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) 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) {