diff --git a/src/muya/lib/contentState/paragraphCtrl.js b/src/muya/lib/contentState/paragraphCtrl.js index cfb32c5f..38bdcb7e 100644 --- a/src/muya/lib/contentState/paragraphCtrl.js +++ b/src/muya/lib/contentState/paragraphCtrl.js @@ -157,7 +157,11 @@ const paragraphCtrl = ContentState => { setTimeout(() => { this.updateTaskListItem(listItemParagraph, listType) this.partialRender() + this.muya.dispatchSelectionChange() + this.muya.dispatchSelectionFormats() + this.muya.dispatchChange() }) + return false } else { this.updateList(paragraph, listType, undefined, block) } @@ -189,6 +193,8 @@ const paragraphCtrl = ContentState => { }) } } + + return true } ContentState.prototype.handleLooseListItem = function () { @@ -447,6 +453,7 @@ const paragraphCtrl = ContentState => { const { start, end } = this.cursor const block = this.getBlock(start.key) const { text } = block + let needDispatchChange = true switch (paraType) { case 'front-matter': { @@ -456,7 +463,7 @@ const paragraphCtrl = ContentState => { case 'ul-bullet': case 'ul-task': case 'ol-order': { - this.handleListMenu(paraType, insertMode) + needDispatchChange = this.handleListMenu(paraType, insertMode) break } case 'loose-list-item': { @@ -601,9 +608,11 @@ const paragraphCtrl = ContentState => { this.partialRender() } - this.muya.dispatchSelectionChange() - this.muya.dispatchSelectionFormats() - this.muya.dispatchChange() + if (needDispatchChange) { + this.muya.dispatchSelectionChange() + this.muya.dispatchSelectionFormats() + this.muya.dispatchChange() + } } ContentState.prototype.insertParagraph = function (location, text = '', outMost = false) { diff --git a/src/muya/lib/index.js b/src/muya/lib/index.js index 3bc2225b..dac37aa7 100644 --- a/src/muya/lib/index.js +++ b/src/muya/lib/index.js @@ -139,9 +139,9 @@ class Muya { return this.contentState.history.clearHistory() } - exportStyledHTML (title = '', printOptimization = false) { + exportStyledHTML (title = '', printOptimization = false, extraCss = '') { const { markdown } = this - return new ExportHtml(markdown, this).generate(title, printOptimization) + return new ExportHtml(markdown, this).generate(title, printOptimization, extraCss) } exportHtml () { diff --git a/src/muya/lib/utils/exportMarkdown.js b/src/muya/lib/utils/exportMarkdown.js index 88cb291a..da279acc 100644 --- a/src/muya/lib/utils/exportMarkdown.js +++ b/src/muya/lib/utils/exportMarkdown.js @@ -258,7 +258,7 @@ class ExportMarkdown { const tHeader = table.children[0] const tBody = table.children[1] const escapeText = str => { - return str.replace(/(? escapeText(th.text).trim()))