@uiw/react-md-editor 3.23.4 → 3.23.6

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/README.md CHANGED
@@ -16,7 +16,7 @@
16
16
  <img alt="npm bundle size" src="https://img.shields.io/bundlephobia/minzip/@uiw/react-md-editor">
17
17
  </a>
18
18
  <a href="https://uiwjs.github.io/react-md-editor/coverage/lcov-report" target="__blank">
19
- <img alt="Coverage Status" src="https://uiwjs.github.io/react-md-editor/coverage/badges.svg" />
19
+ <img alt="Coverage Status" src="https://uiwjs.github.io/react-md-editor/badges.svg" />
20
20
  </a>
21
21
  <br />
22
22
  <a href="https://github.com/uiwjs/react-md-editor/actions" target="__blank">
@@ -471,7 +471,6 @@ export default function App() {
471
471
 
472
472
  ```jsx mdx:preview
473
473
  import React from "react";
474
- import ReactDOM from "react-dom";
475
474
  import MDEditor from '@uiw/react-md-editor';
476
475
 
477
476
  export default function App() {
@@ -499,7 +498,6 @@ npm install katex
499
498
 
500
499
  ```jsx mdx:preview
501
500
  import React from "react";
502
- import ReactDOM from "react-dom";
503
501
  import MDEditor from '@uiw/react-md-editor';
504
502
  import { getCodeString } from 'rehype-rewrite';
505
503
  import katex from 'katex';
@@ -515,9 +513,11 @@ c = \\pm\\sqrt{a^2 + b^2}
515
513
  `;
516
514
 
517
515
  export default function App() {
516
+ const [value, setValue] = React.useState(mdKaTeX);
518
517
  return (
519
518
  <MDEditor
520
- value={mdKaTeX}
519
+ value={value}
520
+ onChange={(val) => setValue(val)}
521
521
  previewOptions={{
522
522
  components: {
523
523
  code: ({ inline, children = [], className, ...props }) => {
@@ -612,9 +612,9 @@ npm install mermaid
612
612
  ```
613
613
 
614
614
  ```jsx mdx:preview
615
- import React, { useState, useRef, useEffect } from "react";
616
- import ReactDOM from "react-dom";
615
+ import React, { useState, useRef, useEffect, Fragment, useCallback } from "react";
617
616
  import MDEditor from "@uiw/react-md-editor";
617
+ import { getCodeString } from 'rehype-rewrite';
618
618
  import mermaid from "mermaid";
619
619
 
620
620
  const mdMermaid = `The following are some examples of the diagrams, charts and graphs that can be made using Mermaid and the Markdown-inspired text specific to it.
@@ -643,44 +643,37 @@ Bob-->>John: Jolly good!
643
643
  const randomid = () => parseInt(String(Math.random() * 1e15), 10).toString(36);
644
644
  const Code = ({ inline, children = [], className, ...props }) => {
645
645
  const demoid = useRef(`dome${randomid()}`);
646
- const code = getCode(children);
647
- const demo = useRef(null);
646
+ const [container, setContainer] = useState(null);
647
+ const isMermaid = className && /^language-mermaid/.test(className.toLocaleLowerCase());
648
+ const code = props.node && props.node.children ? getCodeString(props.node.children) : children[0] || '';
648
649
  useEffect(() => {
649
- if (demo.current) {
650
+ if (container && isMermaid) {
650
651
  try {
651
- const str = mermaid.render(demoid.current, code, () => null, demo.current);
652
- // @ts-ignore
653
- demo.current.innerHTML = str;
652
+ const str = mermaid.render(demoid.current, code);
653
+ container.innerHTML = str;
654
654
  } catch (error) {
655
- // @ts-ignore
656
- demo.current.innerHTML = error;
655
+ container.innerHTML = error;
657
656
  }
658
657
  }
659
- }, [code, demo]);
658
+ }, [container, isMermaid, code, demoid]);
659
+
660
+ const refElement = useCallback((node) => {
661
+ if (node !== null) {
662
+ setContainer(node);
663
+ }
664
+ }, []);
660
665
 
661
- if (
662
- typeof code === "string" && typeof className === "string" &&
663
- /^language-mermaid/.test(className.toLocaleLowerCase())
664
- ) {
666
+ if (isMermaid) {
665
667
  return (
666
- <code ref={demo}>
668
+ <Fragment>
667
669
  <code id={demoid.current} style={{ display: "none" }} />
668
- </code>
670
+ <code ref={refElement} data-name="mermaid" />
671
+ </Fragment>
669
672
  );
670
673
  }
671
- return <code className={String(className)}>{children}</code>;
674
+ return <code>{children}</code>;
672
675
  };
673
676
 
674
- const getCode = (arr = []) => arr.map((dt) => {
675
- if (typeof dt === "string") {
676
- return dt;
677
- }
678
- if (dt.props && dt.props.children) {
679
- return getCode(dt.props.children);
680
- }
681
- return false;
682
- }).filter(Boolean).join("");
683
-
684
677
  export default function App() {
685
678
  const [value, setValue] = useState(mdMermaid);
686
679
  return (
@@ -828,8 +821,8 @@ As always, thanks to our amazing contributors!
828
821
  <a href="https://github.com/avalero" title="Alberto Valero Gómez">
829
822
  <img src="https://avatars.githubusercontent.com/u/1442682?v=4" width="42;" alt="Alberto Valero Gómez"/>
830
823
  </a>
831
- <a href="https://github.com/alphacoma18" title="Alpha Coma">
832
- <img src="https://avatars.githubusercontent.com/u/108984668?v=4" width="42;" alt="Alpha Coma"/>
824
+ <a href="https://github.com/alphacoma18" title="Alpha Romer Coma">
825
+ <img src="https://avatars.githubusercontent.com/u/108984668?v=4" width="42;" alt="Alpha Romer Coma"/>
833
826
  </a>
834
827
  <a href="https://github.com/Exmirai" title="UniqueUlysees">
835
828
  <img src="https://avatars.githubusercontent.com/u/6436703?v=4" width="42;" alt="UniqueUlysees"/>
package/dist/mdeditor.js CHANGED
@@ -17485,14 +17485,14 @@ __webpack_require__.d(commands_namespaceObject, {
17485
17485
  });
17486
17486
 
17487
17487
  ;// CONCATENATED MODULE: ../node_modules/@babel/runtime/helpers/esm/typeof.js
17488
- function _typeof(obj) {
17488
+ function _typeof(o) {
17489
17489
  "@babel/helpers - typeof";
17490
17490
 
17491
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
17492
- return typeof obj;
17493
- } : function (obj) {
17494
- return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
17495
- }, _typeof(obj);
17491
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
17492
+ return typeof o;
17493
+ } : function (o) {
17494
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
17495
+ }, _typeof(o);
17496
17496
  }
17497
17497
  ;// CONCATENATED MODULE: ../node_modules/@babel/runtime/helpers/esm/toPrimitive.js
17498
17498
 
@@ -17531,57 +17531,57 @@ function _defineProperty(obj, key, value) {
17531
17531
  }
17532
17532
  ;// CONCATENATED MODULE: ../node_modules/@babel/runtime/helpers/esm/objectSpread2.js
17533
17533
 
17534
- function ownKeys(object, enumerableOnly) {
17535
- var keys = Object.keys(object);
17534
+ function ownKeys(e, r) {
17535
+ var t = Object.keys(e);
17536
17536
  if (Object.getOwnPropertySymbols) {
17537
- var symbols = Object.getOwnPropertySymbols(object);
17538
- enumerableOnly && (symbols = symbols.filter(function (sym) {
17539
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
17540
- })), keys.push.apply(keys, symbols);
17541
- }
17542
- return keys;
17543
- }
17544
- function _objectSpread2(target) {
17545
- for (var i = 1; i < arguments.length; i++) {
17546
- var source = null != arguments[i] ? arguments[i] : {};
17547
- i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
17548
- _defineProperty(target, key, source[key]);
17549
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
17550
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
17537
+ var o = Object.getOwnPropertySymbols(e);
17538
+ r && (o = o.filter(function (r) {
17539
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
17540
+ })), t.push.apply(t, o);
17541
+ }
17542
+ return t;
17543
+ }
17544
+ function _objectSpread2(e) {
17545
+ for (var r = 1; r < arguments.length; r++) {
17546
+ var t = null != arguments[r] ? arguments[r] : {};
17547
+ r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
17548
+ _defineProperty(e, r, t[r]);
17549
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
17550
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
17551
17551
  });
17552
17552
  }
17553
- return target;
17553
+ return e;
17554
17554
  }
17555
17555
  ;// CONCATENATED MODULE: ../node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js
17556
17556
  function _arrayWithHoles(arr) {
17557
17557
  if (Array.isArray(arr)) return arr;
17558
17558
  }
17559
17559
  ;// CONCATENATED MODULE: ../node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js
17560
- function _iterableToArrayLimit(arr, i) {
17561
- var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
17562
- if (null != _i) {
17563
- var _s,
17564
- _e,
17565
- _x,
17566
- _r,
17567
- _arr = [],
17568
- _n = !0,
17569
- _d = !1;
17560
+ function _iterableToArrayLimit(r, l) {
17561
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
17562
+ if (null != t) {
17563
+ var e,
17564
+ n,
17565
+ i,
17566
+ u,
17567
+ a = [],
17568
+ f = !0,
17569
+ o = !1;
17570
17570
  try {
17571
- if (_x = (_i = _i.call(arr)).next, 0 === i) {
17572
- if (Object(_i) !== _i) return;
17573
- _n = !1;
17574
- } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
17575
- } catch (err) {
17576
- _d = !0, _e = err;
17571
+ if (i = (t = t.call(r)).next, 0 === l) {
17572
+ if (Object(t) !== t) return;
17573
+ f = !1;
17574
+ } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
17575
+ } catch (r) {
17576
+ o = !0, n = r;
17577
17577
  } finally {
17578
17578
  try {
17579
- if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
17579
+ if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
17580
17580
  } finally {
17581
- if (_d) throw _e;
17581
+ if (o) throw n;
17582
17582
  }
17583
17583
  }
17584
- return _arr;
17584
+ return a;
17585
17585
  }
17586
17586
  }
17587
17587
  ;// CONCATENATED MODULE: ../node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
@@ -33733,6 +33733,7 @@ const html_html = create({
33733
33733
  autoComplete: spaceSeparated,
33734
33734
  autoFocus: types_boolean,
33735
33735
  autoPlay: types_boolean,
33736
+ blocking: spaceSeparated,
33736
33737
  capture: types_boolean,
33737
33738
  charSet: null,
33738
33739
  checked: types_boolean,
@@ -33758,6 +33759,7 @@ const html_html = create({
33758
33759
  draggable: booleanish,
33759
33760
  encType: null,
33760
33761
  enterKeyHint: null,
33762
+ fetchPriority: null,
33761
33763
  form: null,
33762
33764
  formAction: null,
33763
33765
  formEncType: null,
@@ -33775,6 +33777,7 @@ const html_html = create({
33775
33777
  id: null,
33776
33778
  imageSizes: null,
33777
33779
  imageSrcSet: null,
33780
+ inert: types_boolean,
33778
33781
  inputMode: null,
33779
33782
  integrity: null,
33780
33783
  is: null,
@@ -33898,6 +33901,9 @@ const html_html = create({
33898
33901
  ping: spaceSeparated,
33899
33902
  placeholder: null,
33900
33903
  playsInline: types_boolean,
33904
+ popover: null,
33905
+ popoverTarget: null,
33906
+ popoverTargetAction: null,
33901
33907
  poster: null,
33902
33908
  preload: null,
33903
33909
  readOnly: types_boolean,
@@ -34166,6 +34172,7 @@ const svg = create({
34166
34172
  textAnchor: 'text-anchor',
34167
34173
  textDecoration: 'text-decoration',
34168
34174
  textRendering: 'text-rendering',
34175
+ transformOrigin: 'transform-origin',
34169
34176
  typeOf: 'typeof',
34170
34177
  underlinePosition: 'underline-position',
34171
34178
  underlineThickness: 'underline-thickness',
@@ -34528,6 +34535,7 @@ const svg = create({
34528
34535
  typeOf: commaOrSpaceSeparated,
34529
34536
  to: null,
34530
34537
  transform: null,
34538
+ transformOrigin: null,
34531
34539
  u1: null,
34532
34540
  u2: null,
34533
34541
  underlinePosition: number,
@@ -71212,9 +71220,9 @@ refractor.register(zig)
71212
71220
 
71213
71221
 
71214
71222
 
71215
- ;// CONCATENATED MODULE: ../node_modules/@uiw/react-markdown-preview/node_modules/rehype-prism-plus/dist/rehype-prism-plus.es.js
71216
- function l(){l=function(e,r){return new t(e,void 0,r)};var e=RegExp.prototype,r=new WeakMap;function t(e,n,i){var o=new RegExp(e,n);return r.set(o,i||r.get(e)),a(o,t.prototype)}function n(e,t){var n=r.get(t);return Object.keys(n).reduce(function(r,t){return r[t]=e[n[t]],r},Object.create(null))}return rehype_prism_plus_es_s(t,RegExp),t.prototype.exec=function(r){var t=e.exec.call(this,r);return t&&(t.groups=n(t,this)),t},t.prototype[Symbol.replace]=function(t,i){if("string"==typeof i){var o=r.get(this);return e[Symbol.replace].call(this,t,i.replace(/\$<([^>]+)>/g,function(e,r){return"$"+o[r]}))}if("function"==typeof i){var l=this;return e[Symbol.replace].call(this,t,function(){var e=arguments;return"object"!=typeof e[e.length-1]&&(e=[].slice.call(e)).push(n(e,l)),i.apply(this,e)})}return e[Symbol.replace].call(this,t,i)},l.apply(this,arguments)}function rehype_prism_plus_es_s(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),r&&a(e,r)}function a(e,r){return a=Object.setPrototypeOf||function(e,r){return e.__proto__=r,e},a(e,r)}function u(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function rehype_prism_plus_es_c(e,r){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(t)return(t=t.call(e)).next.bind(t);if(Array.isArray(e)||(t=function(e,r){if(e){if("string"==typeof e)return u(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(e,r):void 0}}(e))||r&&e&&"number"==typeof e.length){t&&(e=t);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var p=function(i){return function(o){return void 0===o&&(o={}),function(r){visit(r,"element",s)};function s(e,s,a){var u,p;if(a&&"pre"===a.tagName&&"code"===e.tagName){var f=(null==e||null==(u=e.data)?void 0:u.meta)||(null==e||null==(p=e.properties)?void 0:p.metastring)||"";e.properties.className?"boolean"==typeof e.properties.className?e.properties.className=[]:Array.isArray(e.properties.className)||(e.properties.className=[e.properties.className]):e.properties.className=[],e.properties.className.push("code-highlight");var m,h,d=function(e){for(var r,t=rehype_prism_plus_es_c(e.properties.className);!(r=t()).done;){var n=r.value;if("language-"===n.slice(0,9))return n.slice(9).toLowerCase()}return null}(e);if(d)try{var g;g=null!=d&&d.includes("diff-")?d.split("-")[1]:d,m=i.highlight(hast_util_to_string_toString(e),g),a.properties.className=(a.properties.className||[]).concat("language-"+g)}catch(r){if(!o.ignoreMissing||!/Unknown language/.test(r.message))throw r;m=e}else m=e;m.children=(h=1,function e(r){return r.reduce(function(r,t){if("text"===t.type){var n=t.value,i=(n.match(/\n/g)||"").length;if(0===i)t.position={start:{line:h,column:1},end:{line:h,column:1}},r.push(t);else for(var o,l=n.split("\n"),s=rehype_prism_plus_es_c(l.entries());!(o=s()).done;){var a=o.value,u=a[0],p=a[1];r.push({type:"text",value:u===l.length-1?p:p+"\n",position:{start:{line:h+u,column:1},end:{line:h+u,column:1}}})}return h+=i,r}if(Object.prototype.hasOwnProperty.call(t,"children")){var f=h;return t.children=e(t.children),r.push(t),t.position={start:{line:f,column:1},end:{line:h,column:1}},r}return r.push(t),r},[])})(m.children),m.position=m.children.length>0?{start:{line:m.children[0].position.start.line,column:0},end:{line:m.children[m.children.length-1].position.end.line,column:0}}:{start:{line:0,column:0},end:{line:0,column:0}};for(var v,y=function(e){var r=/{([\d,-]+)}/,t=e.split(",").map(function(e){return e.trim()}).join();if(r.test(t)){var i=r.exec(t)[1],o=parse_numeric_range(i);return function(e){return o.includes(e+1)}}return function(){return!1}}(f),b=function(e){var r=/*#__PURE__*/l(/showLineNumbers=([0-9]+)/i,{lines:1});if(r.test(e)){var t=r.exec(e);return Number(t.groups.lines)}return 1}(f),w=function(e){for(var r=new Array(e),t=0;t<e;t++)r[t]={type:"element",tagName:"span",properties:{className:[]},children:[]};return r}(m.position.end.line),N=["showlinenumbers=false",'showlinenumbers="false"',"showlinenumbers={false}"],j=function(){var e=v.value,n=e[0],i=e[1];i.properties.className=["code-line"];var l=filter(m,function(e){return e.position.start.line<=n+1&&e.position.end.line>=n+1});i.children=l.children,!f.toLowerCase().includes("showLineNumbers".toLowerCase())&&!o.showLineNumbers||N.some(function(e){return f.toLowerCase().includes(e)})||(i.properties.line=[(n+b).toString()],i.properties.className.push("line-number")),y(n)&&i.properties.className.push("highlight-line"),("diff"===d||null!=d&&d.includes("diff-"))&&"-"===hast_util_to_string_toString(i).substring(0,1)?i.properties.className.push("deleted"):("diff"===d||null!=d&&d.includes("diff-"))&&"+"===hast_util_to_string_toString(i).substring(0,1)&&i.properties.className.push("inserted")},x=rehype_prism_plus_es_c(w.entries());!(v=x()).done;)j();w.length>0&&""===hast_util_to_string_toString(w[w.length-1]).trim()&&w.pop(),e.children=w}}}},f=p(refractor),m=p(refractor);
71217
- //# sourceMappingURL=rehype-prism-plus.es.js.map
71223
+ ;// CONCATENATED MODULE: ../node_modules/rehype-prism-plus/dist/index.es.js
71224
+ function a(){a=function(e,r){return new t(e,void 0,r)};var e=RegExp.prototype,r=new WeakMap;function t(e,n,i){var o=new RegExp(e,n);return r.set(o,i||r.get(e)),l(o,t.prototype)}function n(e,t){var n=r.get(t);return Object.keys(n).reduce(function(r,t){var i=n[t];if("number"==typeof i)r[t]=e[i];else{for(var o=0;void 0===e[i[o]]&&o+1<i.length;)o++;r[t]=e[i[o]]}return r},Object.create(null))}return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),r&&l(e,r)}(t,RegExp),t.prototype.exec=function(r){var t=e.exec.call(this,r);if(t){t.groups=n(t,this);var i=t.indices;i&&(i.groups=n(i,this))}return t},t.prototype[Symbol.replace]=function(t,i){if("string"==typeof i){var o=r.get(this);return e[Symbol.replace].call(this,t,i.replace(/\$<([^>]+)>/g,function(e,r){var t=o[r];return"$"+(Array.isArray(t)?t.join("$"):t)}))}if("function"==typeof i){var a=this;return e[Symbol.replace].call(this,t,function(){var e=arguments;return"object"!=typeof e[e.length-1]&&(e=[].slice.call(e)).push(n(e,a)),i.apply(this,e)})}return e[Symbol.replace].call(this,t,i)},a.apply(this,arguments)}function l(e,r){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,r){return e.__proto__=r,e},l(e,r)}function index_es_s(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function u(e,r){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(t)return(t=t.call(e)).next.bind(t);if(Array.isArray(e)||(t=function(e,r){if(e){if("string"==typeof e)return index_es_s(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?index_es_s(e,r):void 0}}(e))||r&&e&&"number"==typeof e.length){t&&(e=t);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var index_es_c=function(i){return function(o){return void 0===o&&(o={}),function(e,r){if(r&&!e.registered(r))throw new Error('The default language "'+r+'" is not registered with refractor.')}(i,o.defaultLanguage),function(r){visit(r,"element",l)};function l(e,l,s){var c,p;if(s&&"pre"===s.tagName&&"code"===e.tagName){var f=(null==e||null==(c=e.data)?void 0:c.meta)||(null==e||null==(p=e.properties)?void 0:p.metastring)||"";e.properties.className?"boolean"==typeof e.properties.className?e.properties.className=[]:Array.isArray(e.properties.className)||(e.properties.className=[e.properties.className]):e.properties.className=[];var m,h,d=function(e){for(var r,t=u(e.properties.className);!(r=t()).done;){var n=r.value;if("language-"===n.slice(0,9))return n.slice(9).toLowerCase()}return null}(e);if(!d&&o.defaultLanguage&&e.properties.className.push("language-"+(d=o.defaultLanguage)),e.properties.className.push("code-highlight"),d)try{var g,v;v=null!=(g=d)&&g.includes("diff-")?d.split("-")[1]:d,m=i.highlight(hast_util_to_string_toString(e),v),s.properties.className=(s.properties.className||[]).concat("language-"+v)}catch(r){if(!o.ignoreMissing||!/Unknown language/.test(r.message))throw r;m=e}else m=e;m.children=(h=1,function e(r){return r.reduce(function(r,t){if("text"===t.type){var n=t.value,i=(n.match(/\n/g)||"").length;if(0===i)t.position={start:{line:h,column:1},end:{line:h,column:1}},r.push(t);else for(var o,a=n.split("\n"),l=u(a.entries());!(o=l()).done;){var s=o.value,c=s[0],p=s[1];r.push({type:"text",value:c===a.length-1?p:p+"\n",position:{start:{line:h+c,column:1},end:{line:h+c,column:1}}})}return h+=i,r}if(Object.prototype.hasOwnProperty.call(t,"children")){var f=h;return t.children=e(t.children),r.push(t),t.position={start:{line:f,column:1},end:{line:h,column:1}},r}return r.push(t),r},[])})(m.children),m.position=m.children.length>0?{start:{line:m.children[0].position.start.line,column:0},end:{line:m.children[m.children.length-1].position.end.line,column:0}}:{start:{line:0,column:0},end:{line:0,column:0}};for(var y,b=function(e){var r=/{([\d,-]+)}/,t=e.split(",").map(function(e){return e.trim()}).join();if(r.test(t)){var i=r.exec(t)[1],o=parse_numeric_range(i);return function(e){return o.includes(e+1)}}return function(){return!1}}(f),w=function(e){var r=/*#__PURE__*/a(/showLineNumbers=(\d+)/i,{lines:1});if(r.test(e)){var t=r.exec(e);return Number(t.groups.lines)}return 1}(f),N=function(e){for(var r=new Array(e),t=0;t<e;t++)r[t]={type:"element",tagName:"span",properties:{className:[]},children:[]};return r}(m.position.end.line),j=["showlinenumbers=false",'showlinenumbers="false"',"showlinenumbers={false}"],x=function(){var e,n,i=y.value,a=i[0],l=i[1];l.properties.className=["code-line"];var s=filter(m,function(e){return e.position.start.line<=a+1&&e.position.end.line>=a+1});l.children=s.children,!f.toLowerCase().includes("showLineNumbers".toLowerCase())&&!o.showLineNumbers||j.some(function(e){return f.toLowerCase().includes(e)})||(l.properties.line=[(a+w).toString()],l.properties.className.push("line-number")),b(a)&&l.properties.className.push("highlight-line"),("diff"===d||null!=(e=d)&&e.includes("diff-"))&&"-"===hast_util_to_string_toString(l).substring(0,1)?l.properties.className.push("deleted"):("diff"===d||null!=(n=d)&&n.includes("diff-"))&&"+"===hast_util_to_string_toString(l).substring(0,1)&&l.properties.className.push("inserted")},O=u(N.entries());!(y=O()).done;)x();N.length>0&&""===hast_util_to_string_toString(N[N.length-1]).trim()&&N.pop(),e.children=N}}}},p=index_es_c(refractor),f=index_es_c(refractor);
71225
+ //# sourceMappingURL=index.es.js.map
71218
71226
 
71219
71227
  ;// CONCATENATED MODULE: ../node_modules/direction/index.js
71220
71228
  const rtlRange = '\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC'
@@ -73446,11 +73454,11 @@ function useCopied(container) {
73446
73454
  };
73447
73455
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
73448
73456
  var _container$current, _container$current2;
73449
- (_container$current = container.current) == null ? void 0 : _container$current.removeEventListener('click', handle, false);
73450
- (_container$current2 = container.current) == null ? void 0 : _container$current2.addEventListener('click', handle, false);
73457
+ (_container$current = container.current) == null || _container$current.removeEventListener('click', handle, false);
73458
+ (_container$current2 = container.current) == null || _container$current2.addEventListener('click', handle, false);
73451
73459
  return () => {
73452
73460
  var _container$current3;
73453
- (_container$current3 = container.current) == null ? void 0 : _container$current3.removeEventListener('click', handle, false);
73461
+ (_container$current3 = container.current) == null || _container$current3.removeEventListener('click', handle, false);
73454
73462
  };
73455
73463
  // eslint-disable-next-line react-hooks/exhaustive-deps
73456
73464
  }, [container]);
@@ -73535,7 +73543,7 @@ var _excluded = ["prefixCls", "className", "source", "style", "disableCopy", "sk
73535
73543
  }
73536
73544
  rewrite && rewrite(node, index, parent);
73537
73545
  };
73538
- var rehypePlugins = [reservedMeta, [m, {
73546
+ var rehypePlugins = [reservedMeta, [f, {
73539
73547
  ignoreMissing: true
73540
73548
  }], rehypeSlug, rehypeAutolinkHeadings, rehype_ignore_lib, [rehype_rewrite_lib, {
73541
73549
  rewrite: rehypeRewriteHandle
@@ -73906,7 +73914,10 @@ const lib_base = 'https://html.spec.whatwg.org/multipage/parsing.html#parse-erro
73906
73914
 
73907
73915
  const fatalities = {2: true, 1: false, 0: null}
73908
73916
 
73909
- /** @type {import('unified').Plugin<[Options?] | Array<void>, string, Root>} */
73917
+ /**
73918
+ * @this {import('unified').Processor}
73919
+ * @type {import('unified').Plugin<[Options?] | Array<void>, string, Root>}
73920
+ */
73910
73921
  function rehypeParse(options) {
73911
73922
  const processorSettings = /** @type {Options} */ (this.data('settings'))
73912
73923
  const settings = Object.assign({}, processorSettings, options)
@@ -75778,7 +75789,10 @@ function hast_util_to_html_lib_all(parent) {
75778
75789
 
75779
75790
 
75780
75791
 
75781
- /** @type {import('unified').Plugin<[Options?]|Array<void>, Node, string>} */
75792
+ /**
75793
+ * @this {import('unified').Processor}
75794
+ * @type {import('unified').Plugin<[Options?]|Array<void>, Node, string>}
75795
+ */
75782
75796
  function rehypeStringify(config) {
75783
75797
  const processorSettings = /** @type {Options} */ (this.data('settings'))
75784
75798
  const settings = Object.assign({}, processorSettings, config)
@@ -75800,10 +75814,6 @@ function rehypeStringify(config) {
75800
75814
 
75801
75815
  const rehype = unified().use(rehypeParse).use(rehypeStringify).freeze()
75802
75816
 
75803
- ;// CONCATENATED MODULE: ../node_modules/rehype-prism-plus/dist/rehype-prism-plus.es.js
75804
- function rehype_prism_plus_es_a(){rehype_prism_plus_es_a=function(e,r){return new t(e,void 0,r)};var e=RegExp.prototype,r=new WeakMap;function t(e,n,i){var o=new RegExp(e,n);return r.set(o,i||r.get(e)),rehype_prism_plus_es_l(o,t.prototype)}function n(e,t){var n=r.get(t);return Object.keys(n).reduce(function(r,t){var i=n[t];if("number"==typeof i)r[t]=e[i];else{for(var o=0;void 0===e[i[o]]&&o+1<i.length;)o++;r[t]=e[i[o]]}return r},Object.create(null))}return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),r&&rehype_prism_plus_es_l(e,r)}(t,RegExp),t.prototype.exec=function(r){var t=e.exec.call(this,r);if(t){t.groups=n(t,this);var i=t.indices;i&&(i.groups=n(i,this))}return t},t.prototype[Symbol.replace]=function(t,i){if("string"==typeof i){var o=r.get(this);return e[Symbol.replace].call(this,t,i.replace(/\$<([^>]+)>/g,function(e,r){var t=o[r];return"$"+(Array.isArray(t)?t.join("$"):t)}))}if("function"==typeof i){var a=this;return e[Symbol.replace].call(this,t,function(){var e=arguments;return"object"!=typeof e[e.length-1]&&(e=[].slice.call(e)).push(n(e,a)),i.apply(this,e)})}return e[Symbol.replace].call(this,t,i)},rehype_prism_plus_es_a.apply(this,arguments)}function rehype_prism_plus_es_l(e,r){return rehype_prism_plus_es_l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,r){return e.__proto__=r,e},rehype_prism_plus_es_l(e,r)}function dist_rehype_prism_plus_es_s(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function rehype_prism_plus_es_u(e,r){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(t)return(t=t.call(e)).next.bind(t);if(Array.isArray(e)||(t=function(e,r){if(e){if("string"==typeof e)return dist_rehype_prism_plus_es_s(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?dist_rehype_prism_plus_es_s(e,r):void 0}}(e))||r&&e&&"number"==typeof e.length){t&&(e=t);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var dist_rehype_prism_plus_es_c=function(i){return function(o){return void 0===o&&(o={}),function(e,r){if(r&&!e.registered(r))throw new Error('The default language "'+r+'" is not registered with refractor.')}(i,o.defaultLanguage),function(r){visit(r,"element",l)};function l(e,l,s){var c,p;if(s&&"pre"===s.tagName&&"code"===e.tagName){var f=(null==e||null==(c=e.data)?void 0:c.meta)||(null==e||null==(p=e.properties)?void 0:p.metastring)||"";e.properties.className?"boolean"==typeof e.properties.className?e.properties.className=[]:Array.isArray(e.properties.className)||(e.properties.className=[e.properties.className]):e.properties.className=[];var m,h,d=function(e){for(var r,t=rehype_prism_plus_es_u(e.properties.className);!(r=t()).done;){var n=r.value;if("language-"===n.slice(0,9))return n.slice(9).toLowerCase()}return null}(e);if(!d&&o.defaultLanguage&&e.properties.className.push("language-"+(d=o.defaultLanguage)),e.properties.className.push("code-highlight"),d)try{var g,v;v=null!=(g=d)&&g.includes("diff-")?d.split("-")[1]:d,m=i.highlight(hast_util_to_string_toString(e),v),s.properties.className=(s.properties.className||[]).concat("language-"+v)}catch(r){if(!o.ignoreMissing||!/Unknown language/.test(r.message))throw r;m=e}else m=e;m.children=(h=1,function e(r){return r.reduce(function(r,t){if("text"===t.type){var n=t.value,i=(n.match(/\n/g)||"").length;if(0===i)t.position={start:{line:h,column:1},end:{line:h,column:1}},r.push(t);else for(var o,a=n.split("\n"),l=rehype_prism_plus_es_u(a.entries());!(o=l()).done;){var s=o.value,c=s[0],p=s[1];r.push({type:"text",value:c===a.length-1?p:p+"\n",position:{start:{line:h+c,column:1},end:{line:h+c,column:1}}})}return h+=i,r}if(Object.prototype.hasOwnProperty.call(t,"children")){var f=h;return t.children=e(t.children),r.push(t),t.position={start:{line:f,column:1},end:{line:h,column:1}},r}return r.push(t),r},[])})(m.children),m.position=m.children.length>0?{start:{line:m.children[0].position.start.line,column:0},end:{line:m.children[m.children.length-1].position.end.line,column:0}}:{start:{line:0,column:0},end:{line:0,column:0}};for(var y,b=function(e){var r=/{([\d,-]+)}/,t=e.split(",").map(function(e){return e.trim()}).join();if(r.test(t)){var i=r.exec(t)[1],o=parse_numeric_range(i);return function(e){return o.includes(e+1)}}return function(){return!1}}(f),w=function(e){var r=/*#__PURE__*/rehype_prism_plus_es_a(/showLineNumbers=(\d+)/i,{lines:1});if(r.test(e)){var t=r.exec(e);return Number(t.groups.lines)}return 1}(f),N=function(e){for(var r=new Array(e),t=0;t<e;t++)r[t]={type:"element",tagName:"span",properties:{className:[]},children:[]};return r}(m.position.end.line),j=["showlinenumbers=false",'showlinenumbers="false"',"showlinenumbers={false}"],x=function(){var e,n,i=y.value,a=i[0],l=i[1];l.properties.className=["code-line"];var s=filter(m,function(e){return e.position.start.line<=a+1&&e.position.end.line>=a+1});l.children=s.children,!f.toLowerCase().includes("showLineNumbers".toLowerCase())&&!o.showLineNumbers||j.some(function(e){return f.toLowerCase().includes(e)})||(l.properties.line=[(a+w).toString()],l.properties.className.push("line-number")),b(a)&&l.properties.className.push("highlight-line"),("diff"===d||null!=(e=d)&&e.includes("diff-"))&&"-"===hast_util_to_string_toString(l).substring(0,1)?l.properties.className.push("deleted"):("diff"===d||null!=(n=d)&&n.includes("diff-"))&&"+"===hast_util_to_string_toString(l).substring(0,1)&&l.properties.className.push("inserted")},O=rehype_prism_plus_es_u(N.entries());!(y=O()).done;)x();N.length>0&&""===hast_util_to_string_toString(N[N.length-1]).trim()&&N.pop(),e.children=N}}}},rehype_prism_plus_es_p=dist_rehype_prism_plus_es_c(refractor),rehype_prism_plus_es_f=dist_rehype_prism_plus_es_c(refractor);
75805
- //# sourceMappingURL=rehype-prism-plus.es.js.map
75806
-
75807
75817
  ;// CONCATENATED MODULE: ./src/components/TextArea/Markdown.tsx
75808
75818
  var _templateObject;function html2Escape(sHtml){return sHtml// .replace(/```(\w+)?([\s\S]*?)(\s.+)?```/g, (str: string) => {
75809
75819
  // return str.replace(
@@ -75812,7 +75822,7 @@ var _templateObject;function html2Escape(sHtml){return sHtml// .replace(/```(\w+
75812
75822
  // );
75813
75823
  // })
75814
75824
  .replace(/[<&"]/g,function(c){return{'<':'&lt;','>':'&gt;','&':'&amp;','"':'&quot;'}[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
75815
- },[]);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(rehype_prism_plus_es_f,{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||''}});}
75825
+ },[]);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(f,{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||''}});}
75816
75826
  ;// CONCATENATED MODULE: ../node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
75817
75827
 
75818
75828
  function _arrayWithoutHoles(arr) {