diff --git a/docs/bundle-prod.js b/docs/bundle-prod.js index afc08b9b..e9f81c1d 100644 --- a/docs/bundle-prod.js +++ b/docs/bundle-prod.js @@ -3,7 +3,7 @@ Copyright (c) 2018 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames -*/Object.defineProperty(t,"__esModule",{value:!0}),t.classNames=function e(){for(var t=[],n=0;n0}function o(e){return"object"==typeof e}Object.defineProperty(t,"__esModule",{value:!0}),t.classNames=function e(){for(var t=[],n=0;n=k},l=function(){},t.unstable_forceFrameRate=function(e){0>e||125P(i,n))void 0!==u&&0>P(u,i)?(e[r]=u,e[l]=n,r=l):(e[r]=i,e[o]=n,r=o);else{if(!(void 0!==u&&0>P(u,n)))break e;e[r]=u,e[l]=n,r=l}}}return t}return null}function P(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}var z=[],M=[],j=1,O=null,N=3,L=!1,A=!1,I=!1;function R(e){for(var t=T(M);null!==t;){if(null===t.callback)S(M);else{if(!(t.startTime<=e))break;S(M),t.sortIndex=t.expirationTime,C(z,t)}t=T(M)}}function H(e){if(I=!1,R(e),!A)if(null!==T(z))A=!0,r(D);else{var t=T(M);null!==t&&a(H,t.startTime-e)}}function D(e,n){A=!1,I&&(I=!1,o()),L=!0;var r=N;try{for(R(n),O=T(z);null!==O&&(!(O.expirationTime>n)||e&&!i());){var l=O.callback;if(null!==l){O.callback=null,N=O.priorityLevel;var u=l(O.expirationTime<=n);n=t.unstable_now(),"function"==typeof u?O.callback=u:O===T(z)&&S(z),R(n)}else S(z);O=T(z)}if(null!==O)var s=!0;else{var c=T(M);null!==c&&a(H,c.startTime-n),s=!1}return s}finally{O=null,N=r,L=!1}}function F(e){switch(e){case 1:return-1;case 2:return 250;case 5:return 1073741823;case 4:return 1e4;default:return 5e3}}var U=l;t.unstable_ImmediatePriority=1,t.unstable_UserBlockingPriority=2,t.unstable_NormalPriority=3,t.unstable_IdlePriority=5,t.unstable_LowPriority=4,t.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=N;N=e;try{return t()}finally{N=n}},t.unstable_next=function(e){switch(N){case 1:case 2:case 3:var t=3;break;default:t=N}var n=N;N=t;try{return e()}finally{N=n}},t.unstable_scheduleCallback=function(e,n,i){var l=t.unstable_now();if("object"==typeof i&&null!==i){var u=i.delay;u="number"==typeof u&&0l?(e.sortIndex=u,C(M,e),null===T(z)&&e===T(M)&&(I?o():I=!0,a(H,u-l))):(e.sortIndex=i,C(z,e),A||L||(A=!0,r(D))),e},t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_wrapCallback=function(e){var t=N;return function(){var n=N;N=t;try{return e.apply(this,arguments)}finally{N=n}}},t.unstable_getCurrentPriorityLevel=function(){return N},t.unstable_shouldYield=function(){var e=t.unstable_now();R(e);var n=T(z);return n!==O&&null!==O&&null!==n&&null!==n.callback&&n.startTime<=e&&n.expirationTime "+a.selectedText+u);var s=a.selection.start+o+2,c=s+a.selectedText.length;t.setSelectionRange({start:s,end:c})},keyCommand:"quote"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1);t.codeCommand={name:"code",buttonProps:{"aria-label":"Insert code"},execute:function(e,t){var n=r.selectWord({text:e.text,selection:e.selection}),a=t.setSelectionRange(n);if(-1!==a.selectedText.indexOf("\n")){var o=r.getBreaksNeededForEmptyLineBefore(a.text,a.selection.start),i=Array(o+1).join("\n"),l=r.getBreaksNeededForEmptyLineAfter(a.text,a.selection.end),u=Array(l+1).join("\n");t.replaceSelection(i+"```\n"+a.selectedText+"\n```"+u);var s=a.selection.start+o+4,c=s+a.selectedText.length;t.setSelectionRange({start:s,end:c})}else{t.replaceSelection("`"+a.selectedText+"`");var d=a.selection.start+1,f=d+a.selectedText.length;t.setSelectionRange({start:d,end:f})}},keyCommand:"code"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1);t.imageCommand={name:"image",buttonProps:{"aria-label":"Add image"},execute:function(e,t){var n=r.selectWord({text:e.text,selection:e.selection}),a=t.setSelectionRange(n),o=a.selectedText||"https://example.com/your-image.png";t.replaceSelection("![]("+o+")"),t.setSelectionRange({start:4+a.selection.start,end:4+a.selection.start+o.length})},keyCommand:"image"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1);function a(e,t){var n=e.split(/\n/),r=0;return{modifiedText:n.map((function(e,n){if("string"==typeof t)return r+=t.length,t+e;if("function"==typeof t){var a=t(e,n);return r+=a.length,t(e,n)+e}throw Error("insertion is expected to be either a string or a function")})).join("\n"),insertionLength:r}}t.insertBeforeEachLine=a,t.makeList=function(e,t,n){var o=r.selectWord({text:e.text,selection:e.selection}),i=t.setSelectionRange(o),l=r.getBreaksNeededForEmptyLineBefore(i.text,i.selection.start),u=Array(l+1).join("\n"),s=r.getBreaksNeededForEmptyLineAfter(i.text,i.selection.end),c=Array(s+1).join("\n"),d=a(i.selectedText,n);t.replaceSelection(""+u+d.modifiedText+c);var f=-1===i.selectedText.indexOf("\n")?d.insertionLength:0,p=i.selection.start+l+f,h=p+d.modifiedText.length-f;t.setSelectionRange({start:p,end:h})},t.unorderedListCommand={name:"unordered-list",buttonProps:{"aria-label":"Add unordered list"},execute:function(e,n){t.makeList(e,n,"- ")},keyCommand:"code"},t.orderedListCommand={name:"ordered-list",buttonProps:{"aria-label":"Add ordered list"},execute:function(e,n){t.makeList(e,n,(function(e,t){return t+1+". "}))},keyCommand:"code"},t.checkedListCommand={name:"checked-list",buttonProps:{"aria-label":"Add checked list"},execute:function(e,n){t.makeList(e,n,(function(e,t){return"- [ ] "}))},keyCommand:"code"}},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)});Object.defineProperty(t,"__esModule",{value:!0});var o=n(0),i=n(2),l=function(e){function t(t){var n=e.call(this,t)||this;return n.state={loading:!0},n}return a(t,e),t.prototype.componentDidMount=function(){var e=this,t=this.props,n=t.markdown;(0,t.generateMarkdownPreview)(n).then((function(t){e.setState({preview:t,loading:!1})}))},t.prototype.render=function(){var e,t=this,n=this.props,r=n.className,a=n.minHeight,l=n.loadingPreview,u=this.state,s=u.preview,c=u.loading,d=c?l:s;return e="string"==typeof d?o.createElement("div",{className:"mde-preview-content",dangerouslySetInnerHTML:{__html:d||"

 

"},ref:function(e){return t.previewRef=e}}):o.createElement("div",{className:"mde-preview-content"},d),o.createElement("div",{className:i.classNames("mde-preview",{className:r,loading:c}),style:{minHeight:a+10},"data-testid":"mde-preview"},e)},t}(o.Component);t.MdePreview=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=n.props.minEditorHeight&&t<=n.props.maxEditorHeight&&n.setState(o(o({},n.state),{editorHeight:n.gripDrag.originalHeight+(e.clientY-n.gripDrag.originalDragY)}))}},n.handleTabChange=function(e){(0,n.props.onTabChange)(e)},n.setTextAreaRef=function(e){n.textAreaRef=e,n.commandOrchestrator=new d.TextAreaCommandOrchestrator(n.textAreaRef)},n.handleCommand=function(e){n.commandOrchestrator.executeCommand(e)},n.state={editorHeight:t.minEditorHeight},n.keyCommandMap={};var r=n.props.commands;return n.keyCommandMap=s.extractCommandMap(r),n}return a(t,e),t.prototype.componentDidMount=function(){document.addEventListener("mousemove",this.handleGripMouseMove),document.addEventListener("mouseup",this.handleGripMouseUp)},t.prototype.render=function(){var e=this,t=this.props,n=t.getIcon,r=t.commands,a=t.className,o=t.loadingPreview,l=t.emptyPreviewHtml,s=t.readOnly,c=t.disablePreview,d=t.value,f=t.l18n,h=t.minPreviewHeight,m=t.textAreaProps,g=t.selectedTab,b=t.generateMarkdownPreview;return i.createElement("div",{className:p.classNames("react-mde","react-mde-tabbed-layout",a)},i.createElement(u.MdeToolbar,{getIcon:n,commands:r,onCommand:this.handleCommand,onTabChange:this.handleTabChange,tab:g,readOnly:s,disablePreview:c,l18n:f}),"write"===g?i.createElement(i.Fragment,null,i.createElement(u.TextArea,{editorRef:this.setTextAreaRef,onChange:this.handleTextChange,readOnly:s,textAreaProps:m,height:this.state.editorHeight,value:d}),i.createElement("div",{className:"grip",onMouseDown:this.handleGripMouseDown},i.createElement("svg",{"aria-hidden":"true","data-prefix":"far","data-icon":"ellipsis-h",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",className:"icon"},i.createElement("path",{fill:"currentColor",d:"M304 256c0 26.5-21.5 48-48 48s-48-21.5-48-48 21.5-48 48-48 48 21.5 48 48zm120-48c-26.5 0-48 21.5-48 48s21.5 48 48 48 48-21.5 48-48-21.5-48-48-48zm-336 0c-26.5 0-48 21.5-48 48s21.5 48 48 48 48-21.5 48-48-21.5-48-48-48z",className:""})))):i.createElement(u.MdePreview,{previewRef:function(t){return e.previewRef=t},loadingPreview:o||l,minHeight:h,generateMarkdownPreview:b,markdown:d}))},t.defaultProps={commands:l.getDefaultCommands(),getIcon:function(e){return i.createElement(f.SvgIcon,{icon:e})},emptyPreviewHtml:"

 

",readOnly:!1,l18n:c.enL18n,minEditorHeight:200,maxEditorHeight:500,minPreviewHeight:200,selectedTab:"write",disablePreview:!1},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=k},l=function(){},t.unstable_forceFrameRate=function(e){0>e||125P(i,n))void 0!==u&&0>P(u,i)?(e[r]=u,e[l]=n,r=l):(e[r]=i,e[o]=n,r=o);else{if(!(void 0!==u&&0>P(u,n)))break e;e[r]=u,e[l]=n,r=l}}}return t}return null}function P(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}var z=[],M=[],j=1,O=null,N=3,L=!1,A=!1,I=!1;function R(e){for(var t=T(M);null!==t;){if(null===t.callback)S(M);else{if(!(t.startTime<=e))break;S(M),t.sortIndex=t.expirationTime,C(z,t)}t=T(M)}}function H(e){if(I=!1,R(e),!A)if(null!==T(z))A=!0,r(D);else{var t=T(M);null!==t&&a(H,t.startTime-e)}}function D(e,n){A=!1,I&&(I=!1,o()),L=!0;var r=N;try{for(R(n),O=T(z);null!==O&&(!(O.expirationTime>n)||e&&!i());){var l=O.callback;if(null!==l){O.callback=null,N=O.priorityLevel;var u=l(O.expirationTime<=n);n=t.unstable_now(),"function"==typeof u?O.callback=u:O===T(z)&&S(z),R(n)}else S(z);O=T(z)}if(null!==O)var s=!0;else{var c=T(M);null!==c&&a(H,c.startTime-n),s=!1}return s}finally{O=null,N=r,L=!1}}function F(e){switch(e){case 1:return-1;case 2:return 250;case 5:return 1073741823;case 4:return 1e4;default:return 5e3}}var U=l;t.unstable_ImmediatePriority=1,t.unstable_UserBlockingPriority=2,t.unstable_NormalPriority=3,t.unstable_IdlePriority=5,t.unstable_LowPriority=4,t.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=N;N=e;try{return t()}finally{N=n}},t.unstable_next=function(e){switch(N){case 1:case 2:case 3:var t=3;break;default:t=N}var n=N;N=t;try{return e()}finally{N=n}},t.unstable_scheduleCallback=function(e,n,i){var l=t.unstable_now();if("object"==typeof i&&null!==i){var u=i.delay;u="number"==typeof u&&0l?(e.sortIndex=u,C(M,e),null===T(z)&&e===T(M)&&(I?o():I=!0,a(H,u-l))):(e.sortIndex=i,C(z,e),A||L||(A=!0,r(D))),e},t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_wrapCallback=function(e){var t=N;return function(){var n=N;N=t;try{return e.apply(this,arguments)}finally{N=n}}},t.unstable_getCurrentPriorityLevel=function(){return N},t.unstable_shouldYield=function(){var e=t.unstable_now();R(e);var n=T(z);return n!==O&&null!==O&&null!==n&&null!==n.callback&&n.startTime<=e&&n.expirationTime "+a.selectedText+u);var s=a.selection.start+o+2,c=s+a.selectedText.length;t.setSelectionRange({start:s,end:c})},keyCommand:"quote"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1);t.codeCommand={name:"code",buttonProps:{"aria-label":"Insert code"},execute:function(e,t){var n=r.selectWord({text:e.text,selection:e.selection}),a=t.setSelectionRange(n);if(-1!==a.selectedText.indexOf("\n")){var o=r.getBreaksNeededForEmptyLineBefore(a.text,a.selection.start),i=Array(o+1).join("\n"),l=r.getBreaksNeededForEmptyLineAfter(a.text,a.selection.end),u=Array(l+1).join("\n");t.replaceSelection(i+"```\n"+a.selectedText+"\n```"+u);var s=a.selection.start+o+4,c=s+a.selectedText.length;t.setSelectionRange({start:s,end:c})}else{t.replaceSelection("`"+a.selectedText+"`");var d=a.selection.start+1,f=d+a.selectedText.length;t.setSelectionRange({start:d,end:f})}},keyCommand:"code"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1);t.imageCommand={name:"image",buttonProps:{"aria-label":"Add image"},execute:function(e,t){var n=r.selectWord({text:e.text,selection:e.selection}),a=t.setSelectionRange(n),o=a.selectedText||"https://example.com/your-image.png";t.replaceSelection("![]("+o+")"),t.setSelectionRange({start:4+a.selection.start,end:4+a.selection.start+o.length})},keyCommand:"image"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1);function a(e,t){var n=e.split(/\n/),r=0;return{modifiedText:n.map((function(e,n){if("string"==typeof t)return r+=t.length,t+e;if("function"==typeof t){var a=t(e,n);return r+=a.length,t(e,n)+e}throw Error("insertion is expected to be either a string or a function")})).join("\n"),insertionLength:r}}t.insertBeforeEachLine=a,t.makeList=function(e,t,n){var o=r.selectWord({text:e.text,selection:e.selection}),i=t.setSelectionRange(o),l=r.getBreaksNeededForEmptyLineBefore(i.text,i.selection.start),u=Array(l+1).join("\n"),s=r.getBreaksNeededForEmptyLineAfter(i.text,i.selection.end),c=Array(s+1).join("\n"),d=a(i.selectedText,n);t.replaceSelection(""+u+d.modifiedText+c);var f=-1===i.selectedText.indexOf("\n")?d.insertionLength:0,p=i.selection.start+l+f,h=p+d.modifiedText.length-f;t.setSelectionRange({start:p,end:h})},t.unorderedListCommand={name:"unordered-list",buttonProps:{"aria-label":"Add unordered list"},execute:function(e,n){t.makeList(e,n,"- ")},keyCommand:"code"},t.orderedListCommand={name:"ordered-list",buttonProps:{"aria-label":"Add ordered list"},execute:function(e,n){t.makeList(e,n,(function(e,t){return t+1+". "}))},keyCommand:"code"},t.checkedListCommand={name:"checked-list",buttonProps:{"aria-label":"Add checked list"},execute:function(e,n){t.makeList(e,n,(function(e,t){return"- [ ] "}))},keyCommand:"code"}},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)});Object.defineProperty(t,"__esModule",{value:!0});var o=n(0),i=n(2),l=function(e){function t(t){var n=e.call(this,t)||this;return n.state={loading:!0},n}return a(t,e),t.prototype.componentDidMount=function(){var e=this,t=this.props,n=t.markdown;(0,t.generateMarkdownPreview)(n).then((function(t){e.setState({preview:t,loading:!1})}))},t.prototype.render=function(){var e,t=this,n=this.props,r=n.classes,a=n.minHeight,l=n.loadingPreview,u=this.state,s=u.preview,c=u.loading,d=c?l:s;return e="string"==typeof d?o.createElement("div",{className:"mde-preview-content",dangerouslySetInnerHTML:{__html:d||"

 

"},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.MdePreview=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=n.props.minEditorHeight&&t<=n.props.maxEditorHeight&&n.setState(o(o({},n.state),{editorHeight:n.gripDrag.originalHeight+(e.clientY-n.gripDrag.originalDragY)}))}},n.handleTabChange=function(e){(0,n.props.onTabChange)(e)},n.setTextAreaRef=function(e){n.textAreaRef=e,n.commandOrchestrator=new d.TextAreaCommandOrchestrator(n.textAreaRef)},n.handleCommand=function(e){n.commandOrchestrator.executeCommand(e)},n.state={editorHeight:t.minEditorHeight},n.keyCommandMap={};var r=n.props.commands;return n.keyCommandMap=s.extractCommandMap(r),n}return a(t,e),t.prototype.componentDidMount=function(){document.addEventListener("mousemove",this.handleGripMouseMove),document.addEventListener("mouseup",this.handleGripMouseUp)},t.prototype.render=function(){var e,t,n,r,a,o=this,l=this.props,s=l.getIcon,c=l.commands,d=l.classes,f=l.className,h=l.loadingPreview,m=l.emptyPreviewHtml,g=l.readOnly,b=l.disablePreview,v=l.value,_=l.l18n,y=l.minPreviewHeight,w=l.textAreaProps,k=l.selectedTab,x=l.generateMarkdownPreview;return i.createElement("div",{className:p.classNames("react-mde","react-mde-tabbed-layout",null===(e=d)||void 0===e?void 0:e.reactMde,f)},i.createElement(u.MdeToolbar,{classes:null===(t=d)||void 0===t?void 0:t.toolbar,getIcon:s,commands:c,onCommand:this.handleCommand,onTabChange:this.handleTabChange,tab:k,readOnly:g,disablePreview:b,l18n:_}),"write"===k?i.createElement(i.Fragment,null,i.createElement(u.TextArea,{classes:null===(n=d)||void 0===n?void 0:n.textArea,editorRef:this.setTextAreaRef,onChange:this.handleTextChange,readOnly:g,textAreaProps:w,height:this.state.editorHeight,value:v}),i.createElement("div",{className:p.classNames("grip",null===(r=d)||void 0===r?void 0:r.grip),onMouseDown:this.handleGripMouseDown},i.createElement("svg",{"aria-hidden":"true","data-prefix":"far","data-icon":"ellipsis-h",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",className:"icon"},i.createElement("path",{fill:"currentColor",d:"M304 256c0 26.5-21.5 48-48 48s-48-21.5-48-48 21.5-48 48-48 48 21.5 48 48zm120-48c-26.5 0-48 21.5-48 48s21.5 48 48 48 48-21.5 48-48-21.5-48-48-48zm-336 0c-26.5 0-48 21.5-48 48s21.5 48 48 48 48-21.5 48-48-21.5-48-48-48z",className:""})))):i.createElement(u.MdePreview,{classes:null===(a=d)||void 0===a?void 0:a.preview,previewRef:function(e){return o.previewRef=e},loadingPreview:h||m,minHeight:y,generateMarkdownPreview:x,markdown:v}))},t.defaultProps={commands:l.getDefaultCommands(),getIcon:function(e){return i.createElement(f.SvgIcon,{icon:e})},emptyPreviewHtml:"

 

",readOnly:!1,l18n:c.enL18n,minEditorHeight:200,maxEditorHeight:500,minPreviewHeight:200,selectedTab:"write",disablePreview:!1},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