@uiw/react-md-editor 3.19.6 → 3.19.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mdeditor.js +4 -4
- package/dist/mdeditor.min.js +1 -1
- package/esm/commands/bold.js +2 -1
- package/esm/commands/bold.js.map +2 -2
- package/esm/commands/index.js +2 -1
- package/esm/commands/index.js.map +2 -2
- package/esm/components/TextArea/Markdown.js +0 -1
- package/esm/components/TextArea/Markdown.js.map +2 -4
- package/lib/commands/bold.js +2 -1
- package/lib/commands/bold.js.map +2 -2
- package/lib/commands/index.js +2 -1
- package/lib/commands/index.js.map +2 -2
- package/lib/components/TextArea/Markdown.js +0 -1
- package/lib/components/TextArea/Markdown.js.map +2 -4
- package/package.json +1 -1
- package/src/commands/bold.tsx +1 -1
- package/src/commands/index.ts +1 -1
- package/src/components/TextArea/Markdown.tsx +0 -2
package/dist/mdeditor.js
CHANGED
|
@@ -62535,7 +62535,7 @@ const rehype = unified().use(rehypeParse).use(rehypeStringify).freeze()
|
|
|
62535
62535
|
|
|
62536
62536
|
;// CONCATENATED MODULE: ./src/components/TextArea/Markdown.tsx
|
|
62537
62537
|
var _templateObject;function html2Escape(sHtml){return sHtml.replace(/```(\w+)?([\s\S]*?)(\s.+)?```/g,function(str){return str.replace(/[<&"]/g,function(c){return{'<':'<','>':'>','&':'&','"':'"'}[c];});}).replace(/[<&"]/g,function(c){return{'<':'<','>':'>','&':'&','"':'"'}[c];});}function Markdown(props){var prefixCls=props.prefixCls;var _useContext=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(EditorContext),_useContext$markdown=_useContext.markdown,markdown=_useContext$markdown===void 0?'':_useContext$markdown,highlightEnable=_useContext.highlightEnable,dispatch=_useContext.dispatch;var preRef=/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createRef();(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){if(preRef.current&&dispatch){dispatch({textareaPre:preRef.current});}// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
62538
|
-
},[]);if(!markdown){return/*#__PURE__*/(0,jsx_runtime.jsx)("pre",{ref:preRef,className:"".concat(prefixCls,"-text-pre wmde-markdown-color")});}var mdStr="<pre class=\"language-markdown ".concat(prefixCls,"-text-pre wmde-markdown-color\"><code class=\"language-markdown\">").concat(html2Escape(String.raw(_templateObject||(_templateObject=_taggedTemplateLiteral(["",""])),markdown)),"\n</code></pre>");
|
|
62538
|
+
},[]);if(!markdown){return/*#__PURE__*/(0,jsx_runtime.jsx)("pre",{ref:preRef,className:"".concat(prefixCls,"-text-pre wmde-markdown-color")});}var mdStr="<pre class=\"language-markdown ".concat(prefixCls,"-text-pre wmde-markdown-color\"><code class=\"language-markdown\">").concat(html2Escape(String.raw(_templateObject||(_templateObject=_taggedTemplateLiteral(["",""])),markdown)),"\n</code></pre>");if(highlightEnable){try{mdStr=rehype().data('settings',{fragment:true}).use(m,{ignoreMissing:true}).processSync(mdStr).toString();}catch(error){}}return/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement('div',{className:'wmde-markdown-color',dangerouslySetInnerHTML:{__html:mdStr||''}});}
|
|
62539
62539
|
;// CONCATENATED MODULE: ../node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
|
|
62540
62540
|
|
|
62541
62541
|
function _arrayWithoutHoles(arr) {
|
|
@@ -62643,10 +62643,10 @@ var end=text.length;// iterate to the left
|
|
|
62643
62643
|
for(var i=position;i-1>-1;i--){if(isWordDelimiter(text[i-1])){start=i;break;}}// iterate to the right
|
|
62644
62644
|
for(var _i=position;_i<text.length;_i++){if(isWordDelimiter(text[_i])){end=_i;break;}}return{start:start,end:end};}
|
|
62645
62645
|
;// CONCATENATED MODULE: ./src/commands/bold.tsx
|
|
62646
|
-
var bold={name:'bold',keyCommand:'bold',shortcuts:'ctrlcmd+b',value:'**',buttonProps:{'aria-label':'Add bold text (ctrl + b)',title:'Add bold text (ctrl + b)'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{role:"img",width:"12",height:"12",viewBox:"0 0 384 512",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",d:"M304.793 243.891c33.639-18.537 53.657-54.16 53.657-95.693 0-48.236-26.25-87.626-68.626-104.179C265.138 34.01 240.849 32 209.661 32H24c-8.837 0-16 7.163-16 16v33.049c0 8.837 7.163 16 16 16h33.113v318.53H24c-8.837 0-16 7.163-16 16V464c0 8.837 7.163 16 16 16h195.69c24.203 0 44.834-1.289 66.866-7.584C337.52 457.193 376 410.647 376 350.014c0-52.168-26.573-91.684-71.207-106.123zM142.217 100.809h67.444c16.294 0 27.536 2.019 37.525 6.717 15.828 8.479 24.906 26.502 24.906 49.446 0 35.029-20.32 56.79-53.029 56.79h-76.846V100.809zm112.642 305.475c-10.14 4.056-22.677 4.907-31.409 4.907h-81.233V281.943h84.367c39.645 0 63.057 25.38 63.057 63.057.001 28.425-13.66 52.483-34.782 61.284z"})}),execute:function execute(state,api){
|
|
62646
|
+
var bold={name:'bold',keyCommand:'bold',shortcuts:'ctrlcmd+b',value:'**',buttonProps:{'aria-label':'Add bold text (ctrl + b)',title:'Add bold text (ctrl + b)'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{role:"img",width:"12",height:"12",viewBox:"0 0 384 512",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",d:"M304.793 243.891c33.639-18.537 53.657-54.16 53.657-95.693 0-48.236-26.25-87.626-68.626-104.179C265.138 34.01 240.849 32 209.661 32H24c-8.837 0-16 7.163-16 16v33.049c0 8.837 7.163 16 16 16h33.113v318.53H24c-8.837 0-16 7.163-16 16V464c0 8.837 7.163 16 16 16h195.69c24.203 0 44.834-1.289 66.866-7.584C337.52 457.193 376 410.647 376 350.014c0-52.168-26.573-91.684-71.207-106.123zM142.217 100.809h67.444c16.294 0 27.536 2.019 37.525 6.717 15.828 8.479 24.906 26.502 24.906 49.446 0 35.029-20.32 56.79-53.029 56.79h-76.846V100.809zm112.642 305.475c-10.14 4.056-22.677 4.907-31.409 4.907h-81.233V281.943h84.367c39.645 0 63.057 25.38 63.057 63.057.001 28.425-13.66 52.483-34.782 61.284z"})}),execute:function execute(state,api){var _state1$selectedText;// Adjust the selection to encompass the whole word if the caret is inside one
|
|
62647
62647
|
var newSelectionRange=selectWord({text:state.text,selection:state.selection});var state1=api.setSelectionRange(newSelectionRange);// Replaces the current selection with the bold mark up
|
|
62648
62648
|
var state2=api.replaceSelection("**".concat(state1.selectedText,"**"));// Adjust the selection to not contain the **
|
|
62649
|
-
api.setSelectionRange({start:state2.selection.end-2-state1.selectedText.length,end:state2.selection.end-2});}};
|
|
62649
|
+
api.setSelectionRange({start:state2.selection.end-2-((_state1$selectedText=state1.selectedText)===null||_state1$selectedText===void 0?void 0:_state1$selectedText.length),end:state2.selection.end-2});}};
|
|
62650
62650
|
;// CONCATENATED MODULE: ./src/commands/code.tsx
|
|
62651
62651
|
var code_code={name:'code',keyCommand:'code',shortcuts:'ctrlcmd+j',value:'``',buttonProps:{'aria-label':'Insert code (ctrl + j)',title:'Insert code (ctrl + j)'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{width:"14",height:"14",role:"img",viewBox:"0 0 640 512",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",d:"M278.9 511.5l-61-17.7c-6.4-1.8-10-8.5-8.2-14.9L346.2 8.7c1.8-6.4 8.5-10 14.9-8.2l61 17.7c6.4 1.8 10 8.5 8.2 14.9L293.8 503.3c-1.9 6.4-8.5 10.1-14.9 8.2zm-114-112.2l43.5-46.4c4.6-4.9 4.3-12.7-.8-17.2L117 256l90.6-79.7c5.1-4.5 5.5-12.3.8-17.2l-43.5-46.4c-4.5-4.8-12.1-5.1-17-.5L3.8 247.2c-5.1 4.7-5.1 12.8 0 17.5l144.1 135.1c4.9 4.6 12.5 4.4 17-.5zm327.2.6l144.1-135.1c5.1-4.7 5.1-12.8 0-17.5L492.1 112.1c-4.8-4.5-12.4-4.3-17 .5L431.6 159c-4.6 4.9-4.3 12.7.8 17.2L523 256l-90.6 79.7c-5.1 4.5-5.5 12.3-.8 17.2l43.5 46.4c4.5 4.9 12.1 5.1 17 .6z"})}),execute:function execute(tate,api){// Adjust the selection to encompass the whole word if the caret is inside one
|
|
62652
62652
|
var newSelectionRange=selectWord({text:tate.text,selection:tate.selection});var state1=api.setSelectionRange(newSelectionRange);// when there's no breaking line
|
|
@@ -62718,7 +62718,7 @@ var title5={name:'title5',keyCommand:'title5',shortcuts:'ctrlcmd+5',value:'title
|
|
|
62718
62718
|
;// CONCATENATED MODULE: ./src/commands/title6.tsx
|
|
62719
62719
|
var title6={name:'title6',keyCommand:'title6',shortcuts:'ctrlcmd+6',value:'title6',buttonProps:{'aria-label':'Insert title6 (ctrl + 6)',title:'Insert title6 (ctrl + 6)'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("div",{style:{fontSize:12,textAlign:'left'},children:"Title 6"}),execute:function execute(state,api){if(state.selection.start===0||/\n$/.test(state.text)){api.replaceSelection('###### ');}else{insertAtLineStart('###### ',state.selection.start,api.textArea);}}};
|
|
62720
62720
|
;// CONCATENATED MODULE: ./src/commands/index.ts
|
|
62721
|
-
var commands_getCommands=function getCommands(){return[bold,italic,strikeThrough_strikethrough,hr,group([title1,title2,title3,title4,title5,title6],{name:'title',groupName:'title',buttonProps:{'aria-label':'Insert title',title:'Insert title'}}),divider,commands_link_link,quote,code_code,codeBlock,commands_comment_comment,commands_image_image,divider,unorderedListCommand,orderedListCommand,checkedListCommand];};var getExtraCommands=function getExtraCommands(){return[codeEdit,codeLive,codePreview,divider,fullscreen];};function getStateFromTextArea(textArea){return{selection:{start:textArea.selectionStart,end:textArea.selectionEnd},text:textArea.value,selectedText:textArea.value.slice(textArea.selectionStart,textArea.selectionEnd)};}var TextAreaTextApi=/*#__PURE__*/function(){function TextAreaTextApi(textArea){_classCallCheck(this,TextAreaTextApi);this.textArea=void 0;this.textArea=textArea;}/**
|
|
62721
|
+
var commands_getCommands=function getCommands(){return[bold,italic,strikeThrough_strikethrough,hr,group([title1,title2,title3,title4,title5,title6],{name:'title',groupName:'title',buttonProps:{'aria-label':'Insert title',title:'Insert title'}}),divider,commands_link_link,quote,code_code,codeBlock,commands_comment_comment,commands_image_image,divider,unorderedListCommand,orderedListCommand,checkedListCommand];};var getExtraCommands=function getExtraCommands(){return[codeEdit,codeLive,codePreview,divider,fullscreen];};function getStateFromTextArea(textArea){var _textArea$value;return{selection:{start:textArea.selectionStart,end:textArea.selectionEnd},text:textArea.value,selectedText:(_textArea$value=textArea.value)===null||_textArea$value===void 0?void 0:_textArea$value.slice(textArea.selectionStart,textArea.selectionEnd)};}var TextAreaTextApi=/*#__PURE__*/function(){function TextAreaTextApi(textArea){_classCallCheck(this,TextAreaTextApi);this.textArea=void 0;this.textArea=textArea;}/**
|
|
62722
62722
|
* Replaces the current selection with the new text. This will make the new selectedText to be empty, the
|
|
62723
62723
|
* selection start and selection end will be the same and will both point to the end
|
|
62724
62724
|
* @param text Text that should replace the current selection
|