@uiw/react-md-editor 3.10.1 → 3.10.2

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 CHANGED
@@ -75354,8 +75354,8 @@ const rehype = unified().use(rehypeParse).use(rehypeStringify).freeze()
75354
75354
 
75355
75355
  ;// CONCATENATED MODULE: ./src/components/TextArea/Markdown.tsx
75356
75356
  // @ts-ignore
75357
- 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
75358
- },[]);function html2Escape(sHtml){return sHtml.replace(/```(tsx?|jsx?|html|xml)(.*)\s+([\s\S]*?)(\s.+)?```/g,function(str){return str.replace(/[<&"]/g,function(c){return{'<':'&lt;','>':'&gt;','&':'&amp;','"':'&quot;'}[c];});}).replace(/[<&"]/g,function(c){return{'<':'&lt;','>':'&gt;','&':'&amp;','"':'&quot;'}[c];});}return (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function(){if(!highlightEnable||!markdown){return/*#__PURE__*/(0,jsx_runtime.jsx)("pre",{children:markdown||'',ref:preRef,className:"".concat(prefixCls,"-text-pre wmde-markdown-color")});}var str=rehype().data('settings',{fragment:true}).use((rehype_prism_default()),{ignoreMissing:true}).processSync("<pre class=\"language-markdown ".concat(prefixCls,"-text-pre wmde-markdown-color\"><code class=\"language-markdown\">").concat(html2Escape(markdown),"\n</code></pre>"));return/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement('div',{className:'wmde-markdown-color',dangerouslySetInnerHTML:{__html:str.value}});},[highlightEnable,markdown,preRef,prefixCls]);}
75357
+ 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,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
75358
+ },[]);function html2Escape(sHtml){return sHtml.replace(/```(tsx?|jsx?|html|xml)(.*)\s+([\s\S]*?)(\s.+)?```/g,function(str){return str.replace(/[<&"]/g,function(c){return{'<':'&lt;','>':'&gt;','&':'&amp;','"':'&quot;'}[c];});}).replace(/[<&"]/g,function(c){return{'<':'&lt;','>':'&gt;','&':'&amp;','"':'&quot;'}[c];});}return (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function(){if(!markdown){return/*#__PURE__*/(0,jsx_runtime.jsx)("pre",{children:markdown||'',ref:preRef,className:"".concat(prefixCls,"-text-pre wmde-markdown-color")});}var str=rehype().data('settings',{fragment:true}).use((rehype_prism_default()),{ignoreMissing:true}).processSync("<pre class=\"language-markdown ".concat(prefixCls,"-text-pre wmde-markdown-color\"><code class=\"language-markdown\">").concat(html2Escape(markdown),"\n</code></pre>"));return/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement('div',{className:'wmde-markdown-color',dangerouslySetInnerHTML:{__html:str.value}});},[markdown,preRef,prefixCls]);}
75359
75359
  ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
75360
75360
 
75361
75361
  function _arrayWithoutHoles(arr) {
@@ -75561,9 +75561,10 @@ var Textarea_excluded=["prefixCls","onChange"];function Textarea(props){var pref
75561
75561
  textRef.current.removeEventListener('keydown',onKeyDown);}};// eslint-disable-next-line react-hooks/exhaustive-deps
75562
75562
  },[]);return/*#__PURE__*/(0,jsx_runtime.jsx)("textarea",_objectSpread2(_objectSpread2({autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:false},other),{},{ref:textRef,className:"".concat(prefixCls,"-text-input ").concat(other.className?other.className:''),value:markdown,onChange:function onChange(e){dispatch&&dispatch({markdown:e.target.value});_onChange&&_onChange(e);}}));}
75563
75563
  ;// CONCATENATED MODULE: ./src/components/TextArea/index.tsx
75564
- var TextArea_excluded=["prefixCls","className","onScroll","renderTextarea"];function TextArea_TextArea(props){var _ref=props||{},prefixCls=_ref.prefixCls,className=_ref.className,onScroll=_ref.onScroll,renderTextarea=_ref.renderTextarea,otherProps=_objectWithoutProperties(_ref,TextArea_excluded);var _useContext=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(EditorContext),markdown=_useContext.markdown,scrollTop=_useContext.scrollTop,commands=_useContext.commands,extraCommands=_useContext.extraCommands,dispatch=_useContext.dispatch;var textRef=external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef(null);var executeRef=external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef();var warp=/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createRef();(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){var state={};if(warp.current){state.textareaWarp=warp.current||undefined;warp.current.scrollTop=scrollTop||0;}if(dispatch){dispatch(_objectSpread2({},state));}// eslint-disable-next-line react-hooks/exhaustive-deps
75564
+ var TextArea_excluded=["prefixCls","className","onScroll","renderTextarea"];function TextArea_TextArea(props){var _ref=props||{},prefixCls=_ref.prefixCls,className=_ref.className,onScroll=_ref.onScroll,renderTextarea=_ref.renderTextarea,otherProps=_objectWithoutProperties(_ref,TextArea_excluded);var _useContext=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(EditorContext),markdown=_useContext.markdown,scrollTop=_useContext.scrollTop,commands=_useContext.commands,highlightEnable=_useContext.highlightEnable,extraCommands=_useContext.extraCommands,dispatch=_useContext.dispatch;var textRef=external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef(null);var executeRef=external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef();var warp=/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createRef();(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){var state={};if(warp.current){state.textareaWarp=warp.current||undefined;warp.current.scrollTop=scrollTop||0;}if(dispatch){dispatch(_objectSpread2({},state));}// eslint-disable-next-line react-hooks/exhaustive-deps
75565
75565
  },[]);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){if(textRef.current&&dispatch){var _commandOrchestrator=new TextAreaCommandOrchestrator(textRef.current);executeRef.current=_commandOrchestrator;dispatch({textarea:textRef.current,commandOrchestrator:_commandOrchestrator});}// eslint-disable-next-line react-hooks/exhaustive-deps
75566
- },[]);return/*#__PURE__*/(0,jsx_runtime.jsx)("div",{ref:warp,className:"".concat(prefixCls,"-aree ").concat(className||''),onScroll:onScroll,children:/*#__PURE__*/(0,jsx_runtime.jsx)("div",{className:"".concat(prefixCls,"-text"),children:renderTextarea?/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().cloneElement(renderTextarea(_objectSpread2(_objectSpread2({},otherProps),{},{value:markdown,autoComplete:'off',autoCorrect:'off',spellCheck:'false',autoCapitalize:'off',className:"".concat(prefixCls,"-text-input"),style:{WebkitTextFillColor:'inherit',overflow:'auto'}}),{dispatch:dispatch,onChange:otherProps.onChange,shortcuts:shortcutsHandle,useContext:{commands:commands,extraCommands:extraCommands,commandOrchestrator:executeRef.current}}),{ref:textRef}):/*#__PURE__*/(0,jsx_runtime.jsxs)(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Markdown,{prefixCls:prefixCls}),/*#__PURE__*/(0,jsx_runtime.jsx)(Textarea,_objectSpread2({prefixCls:prefixCls},otherProps))]})})});}
75566
+ },[]);// @ts-ignore
75567
+ var textStyle=highlightEnable?{}:{'-webkit-text-fill-color':'inherit'};return/*#__PURE__*/(0,jsx_runtime.jsx)("div",{ref:warp,className:"".concat(prefixCls,"-aree ").concat(className||''),onScroll:onScroll,children:/*#__PURE__*/(0,jsx_runtime.jsx)("div",{className:"".concat(prefixCls,"-text"),children:renderTextarea?/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().cloneElement(renderTextarea(_objectSpread2(_objectSpread2({},otherProps),{},{value:markdown,autoComplete:'off',autoCorrect:'off',spellCheck:'false',autoCapitalize:'off',className:"".concat(prefixCls,"-text-input"),style:{WebkitTextFillColor:'inherit',overflow:'auto'}}),{dispatch:dispatch,onChange:otherProps.onChange,shortcuts:shortcutsHandle,useContext:{commands:commands,extraCommands:extraCommands,commandOrchestrator:executeRef.current}}),{ref:textRef}):/*#__PURE__*/(0,jsx_runtime.jsxs)(external_root_React_commonjs2_react_commonjs_react_amd_react_.Fragment,{children:[highlightEnable&&/*#__PURE__*/(0,jsx_runtime.jsx)(Markdown,{prefixCls:prefixCls}),/*#__PURE__*/(0,jsx_runtime.jsx)(Textarea,_objectSpread2(_objectSpread2({prefixCls:prefixCls},otherProps),{},{style:textStyle}))]})})});}
75567
75568
  ;// CONCATENATED MODULE: ./src/components/Toolbar/Child.less
75568
75569
  // extracted by mini-css-extract-plugin
75569
75570
  /* harmony default export */ const Child = ({});