"},ref:function(e){return t.previewRef=e}}):o.createElement("div",{className:"mde-preview-content"},d),o.createElement("div",{className:i.classNames("mde-preview",r,{loading:c}),style:{minHeight:a+10},"data-testid":"mde-preview"},e)},t}(o.Component);t.Preview=l},function(e,t,n){"use strict";var r,a=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__assign||function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n
",readOnly:!1,l18n:c.enL18n,minEditorHeight:200,maxEditorHeight:500,minPreviewHeight:200,selectedTab:"write",disablePreview:!1,suggestionTriggerCharacters:["@"]},t}(i.Component);t.ReactMde=h},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extractCommandMap=function(e){var t={};if(!e||!e.length)return t;for(var n=0,r=e;n
"},ref:function(e){return t.previewRef=e}}):o.createElement("div",{className:"mde-preview-content"},d),o.createElement("div",{className:i.classNames("mde-preview",r,{loading:c}),style:{minHeight:a+10},"data-testid":"mde-preview"},e)},t}(o.Component);t.Preview=l},function(e,t,n){"use strict";var r,a=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__assign||function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n
",readOnly:!1,l18n:c.enL18n,minEditorHeight:200,maxEditorHeight:500,minPreviewHeight:200,selectedTab:"write",disablePreview:!1,suggestionTriggerCharacters:["@"]},t}(i.Component);t.ReactMde=h},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extractCommandMap=function(e){var t={};if(!e||!e.length)return t;for(var n=0,r=e;n
[^\r]+?<\/pre>)/gm,(function(e,t){var n=t;return n=(n=n.replace(/^ /gm,"ยจ0")).replace(/ยจ0/g,"")})),o.subParser("hashBlock")("","gim"),e=n.converter._dispatch("hashPreCodeTags.after",e,t,n)})),o.subParser("headers",(function(e,t,n){"use strict";e=n.converter._dispatch("headers.before",e,t,n);var r=isNaN(parseInt(t.headerLevelStart))?1:parseInt(t.headerLevelStart),a=t.smoothLivePreview?/^(.+)[ \t]*\n={2,}[ \t]*\n+/gm:/^(.+)[ \t]*\n=+[ \t]*\n+/gm,i=t.smoothLivePreview?/^(.+)[ \t]*\n-{2,}[ \t]*\n+/gm:/^(.+)[ \t]*\n-+[ \t]*\n+/gm;e=(e=e.replace(a,(function(e,a){var i=o.subParser("spanGamut")(a,t,n),l=t.noHeaderId?"":' id="'+s(a)+'"',u="\n"+e+"\n",t,n)})),e=n.converter._dispatch("blockQuotes.after",e,t,n)})),o.subParser("codeBlocks",(function(e,t,n){"use strict";e=n.converter._dispatch("codeBlocks.before",e,t,n);return e=(e=(e+="ยจ0").replace(/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=ยจ0))/g,(function(e,r,a){var i=r,l=a,s="\n";return i=o.subParser("outdent")(i,t,n),i=o.subParser("encodeCode")(i,t,n),i=(i=(i=o.subParser("detab")(i,t,n)).replace(/^\n+/g,"")).replace(/\n+$/g,""),t.omitExtraWLInCodeBlocks&&(s=""),i="",o.subParser("hashBlock")(i,t,n)+l}))).replace(/ยจ0/,""),e=n.converter._dispatch("codeBlocks.after",e,t,n)})),o.subParser("codeSpans",(function(e,t,n){"use strict";return void 0===(e=n.converter._dispatch("codeSpans.before",e,t,n))&&(e=""),e=e.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,(function(e,r,a,i){var l=i;return l=(l=l.replace(/^([ \t]*)/g,"")).replace(/[ \t]*$/g,""),l=r+""+i+s+"
"+(l=o.subParser("encodeCode")(l,t,n))+"
",l=o.subParser("hashHTMLSpans")(l,t,n)})),e=n.converter._dispatch("codeSpans.after",e,t,n)})),o.subParser("completeHTMLDocument",(function(e,t,n){"use strict";if(!t.completeHTMLDocument)return e;e=n.converter._dispatch("completeHTMLDocument.before",e,t,n);var r="html",a="\n",o="",i='\n',l="",s="";for(var u in void 0!==n.metadata.parsed.doctype&&(a="\n","html"!==(r=n.metadata.parsed.doctype.toString().toLowerCase())&&"html5"!==r||(i='')),n.metadata.parsed)if(n.metadata.parsed.hasOwnProperty(u))switch(u.toLowerCase()){case"doctype":break;case"title":o=""+n.metadata.parsed.title+" \n";break;case"charset":i="html"===r||"html5"===r?'\n':'\n';break;case"language":case"lang":l=' lang="'+n.metadata.parsed[u]+'"',s+='\n';break;default:s+='\n'}return e=a+"\n\n"+o+i+s+"\n\n"+e.trim()+"\n\n",e=n.converter._dispatch("completeHTMLDocument.after",e,t,n)})),o.subParser("detab",(function(e,t,n){"use strict";return e=(e=(e=(e=(e=(e=n.converter._dispatch("detab.before",e,t,n)).replace(/\t(?=\t)/g," ")).replace(/\t/g,"ยจAยจB")).replace(/ยจB(.+?)ยจA/g,(function(e,t){for(var n=t,r=4-n.length%4,a=0;a/g,">"),e=n.converter._dispatch("encodeAmpsAndAngles.after",e,t,n)})),o.subParser("encodeBackslashEscapes",(function(e,t,n){"use strict";return e=(e=(e=n.converter._dispatch("encodeBackslashEscapes.before",e,t,n)).replace(/\\(\\)/g,o.helper.escapeCharactersCallback)).replace(/\\([`*_{}\[\]()>#+.!~=|-])/g,o.helper.escapeCharactersCallback),e=n.converter._dispatch("encodeBackslashEscapes.after",e,t,n)})),o.subParser("encodeCode",(function(e,t,n){"use strict";return e=(e=n.converter._dispatch("encodeCode.before",e,t,n)).replace(/&/g,"&").replace(//g,">").replace(/([*_{}\[\]\\=~-])/g,o.helper.escapeCharactersCallback),e=n.converter._dispatch("encodeCode.after",e,t,n)})),o.subParser("escapeSpecialCharsWithinTagAttributes",(function(e,t,n){"use strict";return e=(e=(e=n.converter._dispatch("escapeSpecialCharsWithinTagAttributes.before",e,t,n)).replace(/<\/?[a-z\d_:-]+(?:[\s]+[\s\S]+?)?>/gi,(function(e){return e.replace(/(.)<\/?code>(?=.)/g,"$1`").replace(/([\\`*_~=|])/g,o.helper.escapeCharactersCallback)}))).replace(/-]|-[^>])(?:[^-]|-[^-])*)--)>/gi,(function(e){return e.replace(/([\\`*_~=|])/g,o.helper.escapeCharactersCallback)})),e=n.converter._dispatch("escapeSpecialCharsWithinTagAttributes.after",e,t,n)})),o.subParser("githubCodeBlocks",(function(e,t,n){"use strict";return t.ghCodeBlocks?(e=n.converter._dispatch("githubCodeBlocks.before",e,t,n),e=(e=(e+="ยจ0").replace(/(?:^|\n)(?: {0,3})(```+|~~~+)(?: *)([^\s`~]*)\n([\s\S]*?)\n(?: {0,3})\1/g,(function(e,r,a,i){var l=t.omitExtraWLInCodeBlocks?"":"\n";return i=o.subParser("encodeCode")(i,t,n),i=" ",i=o.subParser("hashBlock")(i,t,n),"\n\nยจG"+(n.ghCodeBlocks.push({text:e,codeblock:i})-1)+"G\n\n"}))).replace(/ยจ0/,""),n.converter._dispatch("githubCodeBlocks.after",e,t,n)):e})),o.subParser("hashBlock",(function(e,t,n){"use strict";return e=(e=n.converter._dispatch("hashBlock.before",e,t,n)).replace(/(^\n+|\n+$)/g,""),e="\n\nยจK"+(n.gHtmlBlocks.push(e)-1)+"K\n\n",e=n.converter._dispatch("hashBlock.after",e,t,n)})),o.subParser("hashCodeTags",(function(e,t,n){"use strict";e=n.converter._dispatch("hashCodeTags.before",e,t,n);return e=o.helper.replaceRecursiveRegExp(e,(function(e,r,a,i){var l=a+o.subParser("encodeCode")(r,t,n)+i;return"ยจC"+(n.gHtmlSpans.push(l)-1)+"C"}),""+(i=(i=(i=o.subParser("detab")(i,t,n)).replace(/^\n+/g,"")).replace(/\n+$/g,""))+l+"
]*>","
","gim"),e=n.converter._dispatch("hashCodeTags.after",e,t,n)})),o.subParser("hashElement",(function(e,t,n){"use strict";return function(e,t){var r=t;return r=(r=(r=r.replace(/\n\n/g,"\n")).replace(/^\n/,"")).replace(/\n+$/g,""),r="\n\nยจK"+(n.gHtmlBlocks.push(r)-1)+"K\n\n"}})),o.subParser("hashHTMLBlocks",(function(e,t,n){"use strict";e=n.converter._dispatch("hashHTMLBlocks.before",e,t,n);var r=["pre","div","h1","h2","h3","h4","h5","h6","blockquote","table","dl","ol","ul","script","noscript","form","fieldset","iframe","math","style","section","header","footer","nav","article","aside","address","audio","canvas","figure","hgroup","output","video","p"],a=function(e,t,r,a){var o=e;return-1!==r.search(/\bmarkdown\b/)&&(o=r+n.converter.makeHtml(t)+a),"\n\nยจK"+(n.gHtmlBlocks.push(o)-1)+"K\n\n"};t.backslashEscapesHTMLTags&&(e=e.replace(/\\<(\/?[^>]+?)>/g,(function(e,t){return"<"+t+">"})));for(var i=0;i]*>)","im"),u="<"+r[i]+"\\b[^>]*>",c=""+r[i]+">";-1!==(l=o.helper.regexIndexOf(e,s));){var d=o.helper.splitAtIndex(e,l),f=o.helper.replaceRecursiveRegExp(d[1],a,u,c,"im");if(f===d[1])break;e=d[0].concat(f)}return e=e.replace(/(\n {0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,o.subParser("hashElement")(e,t,n)),e=(e=o.helper.replaceRecursiveRegExp(e,(function(e){return"\n\nยจK"+(n.gHtmlBlocks.push(e)-1)+"K\n\n"}),"^ {0,3}\x3c!--","--\x3e","gm")).replace(/(?:\n\n)( {0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,o.subParser("hashElement")(e,t,n)),e=n.converter._dispatch("hashHTMLBlocks.after",e,t,n)})),o.subParser("hashHTMLSpans",(function(e,t,n){"use strict";function r(e){return"ยจC"+(n.gHtmlSpans.push(e)-1)+"C"}return e=(e=(e=(e=(e=n.converter._dispatch("hashHTMLSpans.before",e,t,n)).replace(/<[^>]+?\/>/gi,(function(e){return r(e)}))).replace(/<([^>]+?)>[\s\S]*?<\/\1>/g,(function(e){return r(e)}))).replace(/<([^>]+?)\s[^>]+?>[\s\S]*?<\/\1>/g,(function(e){return r(e)}))).replace(/<[^>]+?>/gi,(function(e){return r(e)})),e=n.converter._dispatch("hashHTMLSpans.after",e,t,n)})),o.subParser("unhashHTMLSpans",(function(e,t,n){"use strict";e=n.converter._dispatch("unhashHTMLSpans.before",e,t,n);for(var r=0;r ]*>\\s* ]*>","^ {0,3}
\\s*
"),s+="
",a.push(s))}for(i=a.length,l=0;l]*>\s*]*>/.test(c)&&(d=!0)}a[l]=c}return e=(e=(e=a.join("\n")).replace(/^\n+/g,"")).replace(/\n+$/g,""),n.converter._dispatch("paragraphs.after",e,t,n)})),o.subParser("runExtension",(function(e,t,n,r){"use strict";if(e.filter)t=e.filter(t,r.converter,n);else if(e.regex){var a=e.regex;a instanceof RegExp||(a=new RegExp(a,"g")),t=t.replace(a,e.replace)}return t})),o.subParser("spanGamut",(function(e,t,n){"use strict";return e=n.converter._dispatch("spanGamut.before",e,t,n),e=o.subParser("codeSpans")(e,t,n),e=o.subParser("escapeSpecialCharsWithinTagAttributes")(e,t,n),e=o.subParser("encodeBackslashEscapes")(e,t,n),e=o.subParser("images")(e,t,n),e=o.subParser("anchors")(e,t,n),e=o.subParser("autoLinks")(e,t,n),e=o.subParser("simplifiedAutoLinks")(e,t,n),e=o.subParser("emoji")(e,t,n),e=o.subParser("underline")(e,t,n),e=o.subParser("italicsAndBold")(e,t,n),e=o.subParser("strikethrough")(e,t,n),e=o.subParser("ellipsis")(e,t,n),e=o.subParser("hashHTMLSpans")(e,t,n),e=o.subParser("encodeAmpsAndAngles")(e,t,n),t.simpleLineBreaks?/\n\nยจK/.test(e)||(e=e.replace(/\n+/g,"
\n")):e=e.replace(/ +\n/g,"
\n"),e=n.converter._dispatch("spanGamut.after",e,t,n)})),o.subParser("strikethrough",(function(e,t,n){"use strict";return t.strikethrough&&(e=(e=n.converter._dispatch("strikethrough.before",e,t,n)).replace(/(?:~){2}([\s\S]+?)(?:~){2}/g,(function(e,r){return function(e){return t.simplifiedAutoLink&&(e=o.subParser("simplifiedAutoLinks")(e,t,n)),""+e+""}(r)})),e=n.converter._dispatch("strikethrough.after",e,t,n)),e})),o.subParser("stripLinkDefinitions",(function(e,t,n){"use strict";var r=function(e,r,a,i,l,s,u){return r=r.toLowerCase(),a.match(/^data:.+?\/.+?;base64,/)?n.gUrls[r]=a.replace(/\s/g,""):n.gUrls[r]=o.subParser("encodeAmpsAndAngles")(a,t,n),s?s+u:(u&&(n.gTitles[r]=u.replace(/"|'/g,""")),t.parseImgDimensions&&i&&l&&(n.gDimensions[r]={width:i,height:l}),"")};return e=(e=(e=(e+="ยจ0").replace(/^ {0,3}\[(.+)]:[ \t]*\n?[ \t]*(data:.+?\/.+?;base64,[A-Za-z0-9+/=\n]+?)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n\n|(?=ยจ0)|(?=\n\[))/gm,r)).replace(/^ {0,3}\[(.+)]:[ \t]*\n?[ \t]*([^>\s]+)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n+|(?=ยจ0))/gm,r)).replace(/ยจ0/,"")})),o.subParser("tables",(function(e,t,n){"use strict";if(!t.tables)return e;function r(e,r){return""+o.subParser("spanGamut")(e,t,n)+" \n"}function a(e){var a,i=e.split("\n");for(a=0;a"+(s=o.subParser("spanGamut")(s,t,n))+"\n"));for(a=0;a\n\n\n",a=0;a\n";for(var o=0;o\n"}return n+=" \n\n"}(h,g)}return e=(e=(e=(e=n.converter._dispatch("tables.before",e,t,n)).replace(/\\(\|)/g,o.helper.escapeCharactersCallback)).replace(/^ {0,3}\|?.+\|.+\n {0,3}\|?[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*:?[ \t]*(?:[-=]){2,}[\s\S]+?(?:\n\n|ยจ0)/gm,a)).replace(/^ {0,3}\|.+\|[ \t]*\n {0,3}\|[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*\n( {0,3}\|.+\|[ \t]*\n)*(?:\n|ยจ0)/gm,a),e=n.converter._dispatch("tables.after",e,t,n)})),o.subParser("underline",(function(e,t,n){"use strict";return t.underline?(e=n.converter._dispatch("underline.before",e,t,n),e=(e=t.literalMidWordUnderscores?(e=e.replace(/\b___(\S[\s\S]*?)___\b/g,(function(e,t){return""+t+""}))).replace(/\b__(\S[\s\S]*?)__\b/g,(function(e,t){return""+t+""})):(e=e.replace(/___(\S[\s\S]*?)___/g,(function(e,t){return/\S$/.test(t)?""+t+"":e}))).replace(/__(\S[\s\S]*?)__/g,(function(e,t){return/\S$/.test(t)?""+t+"":e}))).replace(/(_)/g,o.helper.escapeCharactersCallback),e=n.converter._dispatch("underline.after",e,t,n)):e})),o.subParser("unescapeSpecialChars",(function(e,t,n){"use strict";return e=(e=n.converter._dispatch("unescapeSpecialChars.before",e,t,n)).replace(/ยจE(\d+)E/g,(function(e,t){var n=parseInt(t);return String.fromCharCode(n)})),e=n.converter._dispatch("unescapeSpecialChars.after",e,t,n)})),o.subParser("makeMarkdown.blockquote",(function(e,t){"use strict";var n="";if(e.hasChildNodes())for(var r=e.childNodes,a=r.length,i=0;i ")})),o.subParser("makeMarkdown.codeBlock",(function(e,t){"use strict";var n=e.getAttribute("language"),r=e.getAttribute("precodenum");return"```"+n+"\n"+t.preList[r]+"\n```"})),o.subParser("makeMarkdown.codeSpan",(function(e){"use strict";return"`"+e.innerHTML+"`"})),o.subParser("makeMarkdown.emphasis",(function(e,t){"use strict";var n="";if(e.hasChildNodes()){n+="*";for(var r=e.childNodes,a=r.length,i=0;i",e.hasAttribute("width")&&e.hasAttribute("height")&&(t+=" ="+e.getAttribute("width")+"x"+e.getAttribute("height")),e.hasAttribute("title")&&(t+=' "'+e.getAttribute("title")+'"'),t+=")"),t})),o.subParser("makeMarkdown.links",(function(e,t){"use strict";var n="";if(e.hasChildNodes()&&e.hasAttribute("href")){var r=e.childNodes,a=r.length;n="[";for(var i=0;i",e.hasAttribute("title")&&(n+=' "'+e.getAttribute("title")+'"'),n+=")"}return n})),o.subParser("makeMarkdown.list",(function(e,t,n){"use strict";var r="";if(!e.hasChildNodes())return"";for(var a=e.childNodes,i=a.length,l=e.getAttribute("start")||1,s=0;s"+t.preList[n]+""})),o.subParser("makeMarkdown.strikethrough",(function(e,t){"use strict";var n="";if(e.hasChildNodes()){n+="~~";for(var r=e.childNodes,a=r.length,i=0;itr>th"),s=e.querySelectorAll("tbody>tr");for(n=0;nh&&(h=m)}for(n=0;n/g,"\\$1>")).replace(/^#/gm,"\\#")).replace(/^(\s*)([-=]{3,})(\s*)$/,"$1\\$2$3")).replace(/^( {0,3}\d+)\./gm,"$1\\.")).replace(/^( {0,3})([+-])/gm,"$1\\$2")).replace(/]([\s]*)\(/g,"\\]$1\\(")).replace(/^ {0,3}\[([\S \t]*?)]:/gm,"\\[$1]:")}));void 0===(r=function(){"use strict";return o}.call(t,n,t,e))||(e.exports=r)}).call(this)},function(e,t){},,function(e,t){},function(e,t){},function(e,t){}]);
\ No newline at end of file
diff --git a/package.json b/package.json
index 01fde6e0..98bfbe57 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "react-mde",
- "version": "8.2.0",
+ "version": "8.3.0",
"description": "React Markdown Editor",
"main": "./lib/js/index.js",
"types": "./lib/definitions/index.d.ts",
diff --git a/src/commandOrchestrator.ts b/src/commandOrchestrator.ts
index 28f97ec1..f4a8ad2d 100644
--- a/src/commandOrchestrator.ts
+++ b/src/commandOrchestrator.ts
@@ -24,7 +24,7 @@ export class TextAreaTextApi implements TextApi {
this.textArea.selectionEnd = selection.end;
return getStateFromTextArea(this.textArea);
}
-
+
getState(): TextState {
return getStateFromTextArea(this.textArea);
}
diff --git a/src/components/Preview.tsx b/src/components/Preview.tsx
index 9acc1d98..d397a1a1 100644
--- a/src/components/Preview.tsx
+++ b/src/components/Preview.tsx
@@ -40,7 +40,7 @@ export class Preview extends React.Component<
}
componentWillReceiveProps(nextProps): void {
- if(nextProps.markdown !== this.props.markdown) {
+ if (nextProps.markdown !== this.props.markdown) {
nextProps.generateMarkdownPreview(nextProps.markdown).then(preview => {
this.setState({
preview,