@uiw/react-md-editor 3.19.4 → 3.19.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.
@@ -23,6 +23,7 @@ export var codePreview = {
23
23
  })]
24
24
  }),
25
25
  execute: (state, api, dispatch, executeCommandState, shortcuts) => {
26
+ api.textArea.focus();
26
27
  if (shortcuts && dispatch && executeCommandState) {
27
28
  dispatch({
28
29
  preview: 'preview'
@@ -52,6 +53,7 @@ export var codeEdit = {
52
53
  })]
53
54
  }),
54
55
  execute: (state, api, dispatch, executeCommandState, shortcuts) => {
56
+ api.textArea.focus();
55
57
  if (shortcuts && dispatch && executeCommandState) {
56
58
  dispatch({
57
59
  preview: 'edit'
@@ -81,6 +83,7 @@ export var codeLive = {
81
83
  })]
82
84
  }),
83
85
  execute: (state, api, dispatch, executeCommandState, shortcuts) => {
86
+ api.textArea.focus();
84
87
  if (shortcuts && dispatch && executeCommandState) {
85
88
  dispatch({
86
89
  preview: 'live'
@@ -15,6 +15,8 @@
15
15
  "api",
16
16
  "dispatch",
17
17
  "executeCommandState",
18
+ "textArea",
19
+ "focus",
18
20
  "preview",
19
21
  "codeEdit",
20
22
  "codeLive"
@@ -23,7 +25,7 @@
23
25
  "../../src/commands/preview.tsx"
24
26
  ],
25
27
  "sourcesContent": [
26
- "import * as React from 'react';\nimport { ICommand, TextState, TextAreaTextApi } from './';\nimport { ContextStore, ExecuteCommandState } from '../Context';\n\nexport const codePreview: ICommand = {\n name: 'preview',\n keyCommand: 'preview',\n value: 'preview',\n shortcuts: 'ctrlcmd+9',\n buttonProps: { 'aria-label': 'Preview code (ctrl + 9)', title: 'Preview code (ctrl + 9)' },\n icon: (\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 520 520\">\n <polygon\n fill=\"currentColor\"\n points=\"0 71.293 0 122 38.023 123 38.023 398 0 397 0 449.707 91.023 450.413 91.023 72.293\"\n />\n <polygon\n fill=\"currentColor\"\n points=\"148.023 72.293 520 71.293 520 122 200.023 124 200.023 397 520 396 520 449.707 148.023 450.413\"\n />\n </svg>\n ),\n execute: (\n state: TextState,\n api: TextAreaTextApi,\n dispatch?: React.Dispatch<ContextStore>,\n executeCommandState?: ExecuteCommandState,\n shortcuts?: string[],\n ) => {\n if (shortcuts && dispatch && executeCommandState) {\n dispatch({ preview: 'preview' });\n }\n },\n};\n\nexport const codeEdit: ICommand = {\n name: 'edit',\n keyCommand: 'preview',\n value: 'edit',\n shortcuts: 'ctrlcmd+7',\n buttonProps: { 'aria-label': 'Edit code (ctrl + 7)', title: 'Edit code (ctrl + 7)' },\n icon: (\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 520 520\">\n <polygon fill=\"currentColor\" points=\"0 71.293 0 122 319 122 319 397 0 397 0 449.707 372 449.413 372 71.293\" />\n <polygon\n fill=\"currentColor\"\n points=\"429 71.293 520 71.293 520 122 481 123 481 396 520 396 520 449.707 429 449.413\"\n />\n </svg>\n ),\n execute: (\n state: TextState,\n api: TextAreaTextApi,\n dispatch?: React.Dispatch<ContextStore>,\n executeCommandState?: ExecuteCommandState,\n shortcuts?: string[],\n ) => {\n if (shortcuts && dispatch && executeCommandState) {\n dispatch({ preview: 'edit' });\n }\n },\n};\n\nexport const codeLive: ICommand = {\n name: 'live',\n keyCommand: 'preview',\n value: 'live',\n shortcuts: 'ctrlcmd+8',\n buttonProps: { 'aria-label': 'Live code (ctrl + 8)', title: 'Live code (ctrl + 8)' },\n icon: (\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 520 520\">\n <polygon fill=\"currentColor\" points=\"0 71.293 0 122 179 122 179 397 0 397 0 449.707 232 449.413 232 71.293\" />\n <polygon\n fill=\"currentColor\"\n points=\"289 71.293 520 71.293 520 122 341 123 341 396 520 396 520 449.707 289 449.413\"\n />\n </svg>\n ),\n execute: (\n state: TextState,\n api: TextAreaTextApi,\n dispatch?: React.Dispatch<ContextStore>,\n executeCommandState?: ExecuteCommandState,\n shortcuts?: string[],\n ) => {\n if (shortcuts && dispatch && executeCommandState) {\n dispatch({ preview: 'live' });\n }\n },\n};\n"
28
+ "import * as React from 'react';\nimport { ICommand, TextState, TextAreaTextApi } from './';\nimport { ContextStore, ExecuteCommandState } from '../Context';\n\nexport const codePreview: ICommand = {\n name: 'preview',\n keyCommand: 'preview',\n value: 'preview',\n shortcuts: 'ctrlcmd+9',\n buttonProps: { 'aria-label': 'Preview code (ctrl + 9)', title: 'Preview code (ctrl + 9)' },\n icon: (\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 520 520\">\n <polygon\n fill=\"currentColor\"\n points=\"0 71.293 0 122 38.023 123 38.023 398 0 397 0 449.707 91.023 450.413 91.023 72.293\"\n />\n <polygon\n fill=\"currentColor\"\n points=\"148.023 72.293 520 71.293 520 122 200.023 124 200.023 397 520 396 520 449.707 148.023 450.413\"\n />\n </svg>\n ),\n execute: (\n state: TextState,\n api: TextAreaTextApi,\n dispatch?: React.Dispatch<ContextStore>,\n executeCommandState?: ExecuteCommandState,\n shortcuts?: string[],\n ) => {\n api.textArea.focus();\n if (shortcuts && dispatch && executeCommandState) {\n dispatch({ preview: 'preview' });\n }\n },\n};\n\nexport const codeEdit: ICommand = {\n name: 'edit',\n keyCommand: 'preview',\n value: 'edit',\n shortcuts: 'ctrlcmd+7',\n buttonProps: { 'aria-label': 'Edit code (ctrl + 7)', title: 'Edit code (ctrl + 7)' },\n icon: (\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 520 520\">\n <polygon fill=\"currentColor\" points=\"0 71.293 0 122 319 122 319 397 0 397 0 449.707 372 449.413 372 71.293\" />\n <polygon\n fill=\"currentColor\"\n points=\"429 71.293 520 71.293 520 122 481 123 481 396 520 396 520 449.707 429 449.413\"\n />\n </svg>\n ),\n execute: (\n state: TextState,\n api: TextAreaTextApi,\n dispatch?: React.Dispatch<ContextStore>,\n executeCommandState?: ExecuteCommandState,\n shortcuts?: string[],\n ) => {\n api.textArea.focus();\n if (shortcuts && dispatch && executeCommandState) {\n dispatch({ preview: 'edit' });\n }\n },\n};\n\nexport const codeLive: ICommand = {\n name: 'live',\n keyCommand: 'preview',\n value: 'live',\n shortcuts: 'ctrlcmd+8',\n buttonProps: { 'aria-label': 'Live code (ctrl + 8)', title: 'Live code (ctrl + 8)' },\n icon: (\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 520 520\">\n <polygon fill=\"currentColor\" points=\"0 71.293 0 122 179 122 179 397 0 397 0 449.707 232 449.413 232 71.293\" />\n <polygon\n fill=\"currentColor\"\n points=\"289 71.293 520 71.293 520 122 341 123 341 396 520 396 520 449.707 289 449.413\"\n />\n </svg>\n ),\n execute: (\n state: TextState,\n api: TextAreaTextApi,\n dispatch?: React.Dispatch<ContextStore>,\n executeCommandState?: ExecuteCommandState,\n shortcuts?: string[],\n ) => {\n api.textArea.focus();\n if (shortcuts && dispatch && executeCommandState) {\n dispatch({ preview: 'live' });\n }\n },\n};\n"
27
29
  ],
28
- "mappings": "AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAAC;AAAA;AAI/B,OAAO,IAAMC,WAAqB,GAAG;EACnCC,IAAI,EAAE,SAAS;EACfC,UAAU,EAAE,SAAS;EACrBC,KAAK,EAAE,SAAS;EAChBC,SAAS,EAAE,WAAW;EACtBC,WAAW,EAAE;IAAE,YAAY,EAAE,yBAAyB;IAAEC,KAAK,EAAE;EAA0B,CAAC;EAC1FC,IAAI,eACF;IAAK,KAAK,EAAC,IAAI;IAAC,MAAM,EAAC,IAAI;IAAC,OAAO,EAAC,aAAa;IAAA,wBAC/C;MACE,IAAI,EAAC,cAAc;MACnB,MAAM,EAAC;IAAmF,EAC1F,eACF;MACE,IAAI,EAAC,cAAc;MACnB,MAAM,EAAC;IAA+F,EACtG;EAAA,EAEL;EACDC,OAAO,EAAE,CACPC,KAAgB,EAChBC,GAAoB,EACpBC,QAAuC,EACvCC,mBAAyC,EACzCR,SAAoB,KACjB;IACH,IAAIA,SAAS,IAAIO,QAAQ,IAAIC,mBAAmB,EAAE;MACh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Change
8
8
  } = props || {};
9
+ var $dom = useRef(null);
9
10
  var dragRef = useRef();
10
11
  function handleMouseMove(event) {
11
12
  if (dragRef.current) {
12
- var newHeight = dragRef.current.height + event.clientY - dragRef.current.dragY;
13
+ var _changedTouches$;
14
+ var clientY = event.clientY || ((_changedTouches$ = event.changedTouches[0]) == null ? void 0 : _changedTouches$.clientY);
15
+ var newHeight = dragRef.current.height + clientY - dragRef.current.dragY;
13
16
  if (newHeight >= props.minHeight && newHeight <= props.maxHeight) {
14
- onChange && onChange(dragRef.current.height + (event.clientY - dragRef.current.dragY));
17
+ onChange && onChange(dragRef.current.height + (clientY - dragRef.current.dragY));
15
18
  }
16
19
  }
17
20
  }
18
21
  function handleMouseUp() {
22
+ var _$dom$current, _$dom$current2;
19
23
  dragRef.current = undefined;
24
+ document.removeEventListener('mousemove', handleMouseMove);
25
+ document.removeEventListener('mouseup', handleMouseUp);
26
+ (_$dom$current = $dom.current) == null ? void 0 : _$dom$current.removeEventListener('touchmove', handleMouseMove);
27
+ (_$dom$current2 = $dom.current) == null ? void 0 : _$dom$current2.removeEventListener('touchend', handleMouseUp);
20
28
  }
21
29
  function handleMouseDown(event) {
30
+ var _changedTouches$2, _$dom$current3, _$dom$current4;
31
+ event.preventDefault();
32
+ var clientY = event.clientY || ((_changedTouches$2 = event.changedTouches[0]) == null ? void 0 : _changedTouches$2.clientY);
22
33
  dragRef.current = {
23
34
  height: props.height,
24
- dragY: event.clientY
35
+ dragY: clientY
25
36
  };
37
+ document.addEventListener('mousemove', handleMouseMove);
38
+ document.addEventListener('mouseup', handleMouseUp);
39
+ (_$dom$current3 = $dom.current) == null ? void 0 : _$dom$current3.addEventListener('touchmove', handleMouseMove, {
40
+ passive: false
41
+ });
42
+ (_$dom$current4 = $dom.current) == null ? void 0 : _$dom$current4.addEventListener('touchend', handleMouseUp, {
43
+ passive: false
44
+ });
26
45
  }
27
46
  useEffect(() => {
28
47
  if (document) {
29
- document.addEventListener('mousemove', handleMouseMove);
30
- document.addEventListener('mouseup', handleMouseUp);
48
+ var _$dom$current5, _$dom$current6;
49
+ (_$dom$current5 = $dom.current) == null ? void 0 : _$dom$current5.addEventListener('touchstart', handleMouseDown, {
50
+ passive: false
51
+ });
52
+ (_$dom$current6 = $dom.current) == null ? void 0 : _$dom$current6.addEventListener('mousedown', handleMouseDown);
31
53
  }
32
54
  return () => {
33
55
  if (document) {
56
+ var _$dom$current7;
57
+ (_$dom$current7 = $dom.current) == null ? void 0 : _$dom$current7.removeEventListener('touchstart', handleMouseDown);
34
58
  document.removeEventListener('mousemove', handleMouseMove);
35
- document.removeEventListener('mouseup', handleMouseUp);
36
59
  }
37
60
  };
38
61
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -47,7 +70,7 @@ var DragBar = props => {
47
70
  }), []);
48
71
  return /*#__PURE__*/_jsx("div", {
49
72
  className: prefixCls + "-bar",
50
- onMouseDown: handleMouseDown,
73
+ ref: $dom,
51
74
  children: svg
52
75
  });
53
76
  };
@@ -9,29 +9,33 @@
9
9
  "props",
10
10
  "prefixCls",
11
11
  "onChange",
12
+ "$dom",
12
13
  "dragRef",
13
14
  "handleMouseMove",
14
15
  "event",
15
16
  "current",
17
+ "clientY",
18
+ "changedTouches",
16
19
  "newHeight",
17
20
  "height",
18
- "clientY",
19
21
  "dragY",
20
22
  "minHeight",
21
23
  "maxHeight",
22
24
  "handleMouseUp",
23
25
  "undefined",
24
- "handleMouseDown",
25
26
  "document",
26
- "addEventListener",
27
27
  "removeEventListener",
28
+ "handleMouseDown",
29
+ "preventDefault",
30
+ "addEventListener",
31
+ "passive",
28
32
  "svg"
29
33
  ],
30
34
  "sources": [
31
35
  "../../../src/components/DragBar/index.tsx"
32
36
  ],
33
37
  "sourcesContent": [
34
- "import React, { useEffect, useMemo, useRef } from 'react';\nimport { IProps } from '../../Editor';\nimport './index.less';\n\nexport interface IDragBarProps extends IProps {\n height: number;\n maxHeight: number;\n minHeight: number;\n onChange: (value: number) => void;\n}\n\nconst DragBar: React.FC<IDragBarProps> = (props) => {\n const { prefixCls, onChange } = props || {};\n const dragRef = useRef<{ height: number; dragY: number }>();\n function handleMouseMove(event: MouseEvent) {\n if (dragRef.current) {\n const newHeight = dragRef.current.height + event.clientY - dragRef.current.dragY;\n if (newHeight >= props.minHeight && newHeight <= props.maxHeight) {\n onChange && onChange(dragRef.current.height + (event.clientY - dragRef.current.dragY));\n }\n }\n }\n function handleMouseUp() {\n dragRef.current = undefined;\n }\n function handleMouseDown(event: React.MouseEvent<HTMLDivElement, MouseEvent>) {\n dragRef.current = {\n height: props.height,\n dragY: event.clientY,\n };\n }\n\n useEffect(() => {\n if (document) {\n document.addEventListener('mousemove', handleMouseMove);\n document.addEventListener('mouseup', handleMouseUp);\n }\n return () => {\n if (document) {\n document.removeEventListener('mousemove', handleMouseMove);\n document.removeEventListener('mouseup', handleMouseUp);\n }\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n const svg = useMemo(\n () => (\n <svg viewBox=\"0 0 512 512\" height=\"100%\">\n <path\n fill=\"currentColor\"\n 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\"\n />\n </svg>\n ),\n [],\n );\n return (\n <div className={`${prefixCls}-bar`} onMouseDown={handleMouseDown}>\n {svg}\n </div>\n );\n};\n\nexport default DragBar;\n"
38
+ "import React, { useEffect, useMemo, useRef } from 'react';\nimport { IProps } from '../../Editor';\nimport './index.less';\n\nexport interface IDragBarProps extends IProps {\n height: number;\n maxHeight: number;\n minHeight: number;\n onChange: (value: number) => void;\n}\n\nconst DragBar: React.FC<IDragBarProps> = (props) => {\n const { prefixCls, onChange } = props || {};\n const $dom = useRef<HTMLDivElement>(null);\n const dragRef = useRef<{ height: number; dragY: number }>();\n function handleMouseMove(event: Event) {\n if (dragRef.current) {\n const clientY =\n (event as unknown as MouseEvent).clientY || (event as unknown as TouchEvent).changedTouches[0]?.clientY;\n const newHeight = dragRef.current.height + clientY - dragRef.current.dragY;\n if (newHeight >= props.minHeight && newHeight <= props.maxHeight) {\n onChange && onChange(dragRef.current.height + (clientY - dragRef.current.dragY));\n }\n }\n }\n function handleMouseUp() {\n dragRef.current = undefined;\n document.removeEventListener('mousemove', handleMouseMove);\n document.removeEventListener('mouseup', handleMouseUp);\n $dom.current?.removeEventListener('touchmove', handleMouseMove);\n $dom.current?.removeEventListener('touchend', handleMouseUp);\n }\n function handleMouseDown(event: Event) {\n event.preventDefault();\n const clientY =\n (event as unknown as MouseEvent).clientY || (event as unknown as TouchEvent).changedTouches[0]?.clientY;\n dragRef.current = {\n height: props.height,\n dragY: clientY,\n };\n document.addEventListener('mousemove', handleMouseMove);\n document.addEventListener('mouseup', handleMouseUp);\n $dom.current?.addEventListener('touchmove', handleMouseMove, { passive: false });\n $dom.current?.addEventListener('touchend', handleMouseUp, { passive: false });\n }\n\n useEffect(() => {\n if (document) {\n $dom.current?.addEventListener('touchstart', handleMouseDown, { passive: false });\n $dom.current?.addEventListener('mousedown', handleMouseDown);\n }\n return () => {\n if (document) {\n $dom.current?.removeEventListener('touchstart', handleMouseDown);\n document.removeEventListener('mousemove', handleMouseMove);\n }\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n const svg = useMemo(\n () => (\n <svg viewBox=\"0 0 512 512\" height=\"100%\">\n <path\n fill=\"currentColor\"\n 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\"\n />\n </svg>\n ),\n [],\n );\n return (\n <div className={`${prefixCls}-bar`} ref={$dom}>\n {svg}\n </div>\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AAE;QAAEG,OAAO,EAAE;MAAM,CAAC,CAAC;MACjF,kBAAAnB,IAAI,CAACI,OAAO,qBAAZ,eAAcc,gBAAgB,CAAC,WAAW,EAAEF,eAAe,CAAC;IAC9D;IACA,OAAO,MAAM;MACX,IAAIF,QAAQ,EAAE;QAAA;QACZ,kBAAAd,IAAI,CAACI,OAAO,qBAAZ,eAAcW,mBAAmB,CAAC,YAAY,EAAEC,eAAe,CAAC;QAChEF,QAAQ,CAACC,mBAAmB,CAAC,WAAW,EAAEb,eAAe,CAAC;MAC5D;IACF,CAAC;IACD;EACF,CAAC,EAAE,EAAE,CAAC;EACN,IAAMkB,GAAG,GAAG1B,OAAO,CACjB,mBACE;IAAK,OAAO,EAAC,aAAa;IAAC,MAAM,EAAC,MAAM;IAAA,uBACtC;MACE,IAAI,EAAC,cAAc;MACnB,CAAC,EAAC;IAA2N;EAC7N,EAEL,EACD,EAAE,CACH;EACD,oBACE;IAAK,SAAS,EAAKI,SAAS,SAAO;IAAC,GAAG,EAAEE,IAAK;IAAA,UAC3CoB;EAAG,EACA;AAEV,CAAC;AAED,eAAexB,OAAO"
37
41
  }
@@ -1,10 +1,12 @@
1
- import React, { useContext, useEffect, useMemo } from 'react';
1
+ import _taggedTemplateLiteralLoose from "@babel/runtime/helpers/taggedTemplateLiteralLoose";
2
+ var _templateObject;
3
+ import React, { useContext, useEffect } from 'react';
2
4
  import { rehype } from 'rehype';
3
5
  import rehypePrism from 'rehype-prism-plus';
4
6
  import { EditorContext } from '../../Context';
5
7
  import { jsx as _jsx } from "react/jsx-runtime";
6
8
  function html2Escape(sHtml) {
7
- return sHtml.replace(/```(tsx?|jsx?|html|xml)(.*)\s+([\s\S]*?)(\s.+)?```/g, str => {
9
+ return sHtml.replace(/```(\w+)?([\s\S]*?)(\s.+)?```/g, str => {
8
10
  return str.replace(/[<&"]/g, c => ({
9
11
  '<': '&lt;',
10
12
  '>': '&gt;',
@@ -36,29 +38,28 @@ export default function Markdown(props) {
36
38
  }
37
39
  // eslint-disable-next-line react-hooks/exhaustive-deps
38
40
  }, []);
39
- return useMemo(() => {
40
- if (!markdown) {
41
- return /*#__PURE__*/_jsx("pre", {
42
- ref: preRef,
43
- className: prefixCls + "-text-pre wmde-markdown-color"
44
- });
45
- }
46
- var mdStr = "<pre class=\"language-markdown " + prefixCls + "-text-pre wmde-markdown-color\"><code class=\"language-markdown\">" + html2Escape(markdown) + "\n</code></pre>";
47
- if (highlightEnable) {
48
- try {
49
- mdStr = rehype().data('settings', {
50
- fragment: true
51
- }).use(rehypePrism, {
52
- ignoreMissing: true
53
- }).processSync(mdStr).toString();
54
- } catch (error) {}
55
- }
56
- return /*#__PURE__*/React.createElement('div', {
57
- className: 'wmde-markdown-color',
58
- dangerouslySetInnerHTML: {
59
- __html: mdStr || ''
60
- }
41
+ if (!markdown) {
42
+ return /*#__PURE__*/_jsx("pre", {
43
+ ref: preRef,
44
+ className: prefixCls + "-text-pre wmde-markdown-color"
61
45
  });
62
- }, [markdown, preRef, prefixCls]);
46
+ }
47
+ var mdStr = "<pre class=\"language-markdown " + prefixCls + "-text-pre wmde-markdown-color\"><code class=\"language-markdown\">" + html2Escape(String.raw(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["", ""])), markdown)) + "\n</code></pre>";
48
+ console.log('markdown::', markdown);
49
+ if (highlightEnable) {
50
+ try {
51
+ mdStr = rehype().data('settings', {
52
+ fragment: true
53
+ }).use(rehypePrism, {
54
+ ignoreMissing: true
55
+ }).processSync(mdStr).toString();
56
+ } catch (error) {}
57
+ }
58
+ return /*#__PURE__*/React.createElement('div', {
59
+ className: 'wmde-markdown-color',
60
+ dangerouslySetInnerHTML: {
61
+ __html: mdStr || ''
62
+ }
63
+ });
63
64
  }
64
65
  //# sourceMappingURL=Markdown.js.map
@@ -4,7 +4,6 @@
4
4
  "React",
5
5
  "useContext",
6
6
  "useEffect",
7
- "useMemo",
8
7
  "rehype",
9
8
  "rehypePrism",
10
9
  "EditorContext",
@@ -24,6 +23,10 @@
24
23
  "current",
25
24
  "textareaPre",
26
25
  "mdStr",
26
+ "String",
27
+ "raw",
28
+ "console",
29
+ "log",
27
30
  "data",
28
31
  "fragment",
29
32
  "use",
@@ -40,7 +43,7 @@
40
43
  "../../../src/components/TextArea/Markdown.tsx"
41
44
  ],
42
45
  "sourcesContent": [
43
- "import React, { useContext, useEffect, useMemo } from 'react';\nimport { rehype } from 'rehype';\nimport rehypePrism from 'rehype-prism-plus';\nimport { IProps } from '../../Editor';\nimport { EditorContext } from '../../Context';\n\nfunction html2Escape(sHtml: string) {\n return sHtml\n .replace(/```(tsx?|jsx?|html|xml)(.*)\\s+([\\s\\S]*?)(\\s.+)?```/g, (str: string) => {\n return str.replace(\n /[<&\"]/g,\n (c: string) => (({ '<': '&lt;', '>': '&gt;', '&': '&amp;', '\"': '&quot;' } as Record<string, string>)[c]),\n );\n })\n .replace(\n /[<&\"]/g,\n (c: string) => (({ '<': '&lt;', '>': '&gt;', '&': '&amp;', '\"': '&quot;' } as Record<string, string>)[c]),\n );\n}\n\nexport interface MarkdownProps extends IProps, React.HTMLAttributes<HTMLPreElement> {}\n\nexport default function Markdown(props: MarkdownProps) {\n const { prefixCls } = props;\n const { markdown = '', highlightEnable, dispatch } = useContext(EditorContext);\n const preRef = React.createRef<HTMLPreElement>();\n useEffect(() => {\n if (preRef.current && dispatch) {\n dispatch({ textareaPre: preRef.current });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return useMemo(() => {\n if (!markdown) {\n return <pre ref={preRef} className={`${prefixCls}-text-pre wmde-markdown-color`} />;\n }\n let mdStr = `<pre class=\"language-markdown ${prefixCls}-text-pre wmde-markdown-color\"><code class=\"language-markdown\">${html2Escape(\n markdown,\n )}\\n</code></pre>`;\n\n if (highlightEnable) {\n try {\n mdStr = rehype()\n .data('settings', { fragment: true })\n .use(rehypePrism, { ignoreMissing: true })\n .processSync(mdStr)\n .toString();\n } catch (error) {}\n }\n\n return React.createElement('div', {\n className: 'wmde-markdown-color',\n dangerouslySetInnerHTML: { __html: mdStr || '' },\n });\n }, [markdown, preRef, prefixCls]);\n}\n"
46
+ "import React, { useContext, useEffect, useMemo } from 'react';\nimport { rehype } from 'rehype';\nimport rehypePrism from 'rehype-prism-plus';\nimport { IProps } from '../../Editor';\nimport { EditorContext } from '../../Context';\n\nfunction html2Escape(sHtml: string) {\n return sHtml\n .replace(/```(\\w+)?([\\s\\S]*?)(\\s.+)?```/g, (str: string) => {\n return str.replace(\n /[<&\"]/g,\n (c: string) => (({ '<': '&lt;', '>': '&gt;', '&': '&amp;', '\"': '&quot;' } as Record<string, string>)[c]),\n );\n })\n .replace(\n /[<&\"]/g,\n (c: string) => (({ '<': '&lt;', '>': '&gt;', '&': '&amp;', '\"': '&quot;' } as Record<string, string>)[c]),\n );\n}\n\nexport interface MarkdownProps extends IProps, React.HTMLAttributes<HTMLPreElement> {}\n\nexport default function Markdown(props: MarkdownProps) {\n const { prefixCls } = props;\n const { markdown = '', highlightEnable, dispatch } = useContext(EditorContext);\n const preRef = React.createRef<HTMLPreElement>();\n useEffect(() => {\n if (preRef.current && dispatch) {\n dispatch({ textareaPre: preRef.current });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n if (!markdown) {\n return <pre ref={preRef} className={`${prefixCls}-text-pre wmde-markdown-color`} />;\n }\n let mdStr = `<pre class=\"language-markdown ${prefixCls}-text-pre wmde-markdown-color\"><code class=\"language-markdown\">${html2Escape(\n String.raw`${markdown}`,\n )}\\n</code></pre>`;\n\n console.log('markdown::', markdown);\n\n if (highlightEnable) {\n try {\n mdStr = rehype()\n .data('settings', { fragment: true })\n .use(rehypePrism, { ignoreMissing: true })\n .processSync(mdStr)\n .toString();\n } catch (error) {}\n }\n\n return React.createElement('div', {\n className: 'wmde-markdown-color',\n dangerouslySetInnerHTML: { __html: mdStr || '' },\n });\n}\n"
44
47
  ],
45
- "mappings": "AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,SAAS,EAAEC,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G;EACjD,CAAC,CAAC;AACJ"
46
49
  }
@@ -29,6 +29,7 @@ var codePreview = {
29
29
  })]
30
30
  }),
31
31
  execute: function execute(state, api, dispatch, executeCommandState, shortcuts) {
32
+ api.textArea.focus();
32
33
  if (shortcuts && dispatch && executeCommandState) {
33
34
  dispatch({
34
35
  preview: 'preview'
@@ -59,6 +60,7 @@ var codeEdit = {
59
60
  })]
60
61
  }),
61
62
  execute: function execute(state, api, dispatch, executeCommandState, shortcuts) {
63
+ api.textArea.focus();
62
64
  if (shortcuts && dispatch && executeCommandState) {
63
65
  dispatch({
64
66
  preview: 'edit'
@@ -89,6 +91,7 @@ var codeLive = {
89
91
  })]
90
92
  }),
91
93
  execute: function execute(state, api, dispatch, executeCommandState, shortcuts) {
94
+ api.textArea.focus();
92
95
  if (shortcuts && dispatch && executeCommandState) {
93
96
  dispatch({
94
97
  preview: 'live'
@@ -14,6 +14,8 @@
14
14
  "api",
15
15
  "dispatch",
16
16
  "executeCommandState",
17
+ "textArea",
18
+ "focus",
17
19
  "preview",
18
20
  "codeEdit",
19
21
  "codeLive"
@@ -22,7 +24,7 @@
22
24
  "../../src/commands/preview.tsx"
23
25
  ],
24
26
  "sourcesContent": [
25
- "import * as React from 'react';\nimport { ICommand, TextState, TextAreaTextApi } from './';\nimport { ContextStore, ExecuteCommandState } from '../Context';\n\nexport const codePreview: ICommand = {\n name: 'preview',\n keyCommand: 'preview',\n value: 'preview',\n shortcuts: 'ctrlcmd+9',\n buttonProps: { 'aria-label': 'Preview code (ctrl + 9)', title: 'Preview code (ctrl + 9)' },\n icon: (\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 520 520\">\n <polygon\n fill=\"currentColor\"\n points=\"0 71.293 0 122 38.023 123 38.023 398 0 397 0 449.707 91.023 450.413 91.023 72.293\"\n />\n <polygon\n fill=\"currentColor\"\n points=\"148.023 72.293 520 71.293 520 122 200.023 124 200.023 397 520 396 520 449.707 148.023 450.413\"\n />\n </svg>\n ),\n execute: (\n state: TextState,\n api: TextAreaTextApi,\n dispatch?: React.Dispatch<ContextStore>,\n executeCommandState?: ExecuteCommandState,\n shortcuts?: string[],\n ) => {\n if (shortcuts && dispatch && executeCommandState) {\n dispatch({ preview: 'preview' });\n }\n },\n};\n\nexport const codeEdit: ICommand = {\n name: 'edit',\n keyCommand: 'preview',\n value: 'edit',\n shortcuts: 'ctrlcmd+7',\n buttonProps: { 'aria-label': 'Edit code (ctrl + 7)', title: 'Edit code (ctrl + 7)' },\n icon: (\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 520 520\">\n <polygon fill=\"currentColor\" points=\"0 71.293 0 122 319 122 319 397 0 397 0 449.707 372 449.413 372 71.293\" />\n <polygon\n fill=\"currentColor\"\n points=\"429 71.293 520 71.293 520 122 481 123 481 396 520 396 520 449.707 429 449.413\"\n />\n </svg>\n ),\n execute: (\n state: TextState,\n api: TextAreaTextApi,\n dispatch?: React.Dispatch<ContextStore>,\n executeCommandState?: ExecuteCommandState,\n shortcuts?: string[],\n ) => {\n if (shortcuts && dispatch && executeCommandState) {\n dispatch({ preview: 'edit' });\n }\n },\n};\n\nexport const codeLive: ICommand = {\n name: 'live',\n keyCommand: 'preview',\n value: 'live',\n shortcuts: 'ctrlcmd+8',\n buttonProps: { 'aria-label': 'Live code (ctrl + 8)', title: 'Live code (ctrl + 8)' },\n icon: (\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 520 520\">\n <polygon fill=\"currentColor\" points=\"0 71.293 0 122 179 122 179 397 0 397 0 449.707 232 449.413 232 71.293\" />\n <polygon\n fill=\"currentColor\"\n points=\"289 71.293 520 71.293 520 122 341 123 341 396 520 396 520 449.707 289 449.413\"\n />\n </svg>\n ),\n execute: (\n state: TextState,\n api: TextAreaTextApi,\n dispatch?: React.Dispatch<ContextStore>,\n executeCommandState?: ExecuteCommandState,\n shortcuts?: string[],\n ) => {\n if (shortcuts && dispatch && executeCommandState) {\n dispatch({ preview: 'live' });\n }\n },\n};\n"
27
+ "import * as React from 'react';\nimport { ICommand, TextState, TextAreaTextApi } from './';\nimport { ContextStore, ExecuteCommandState } from '../Context';\n\nexport const codePreview: ICommand = {\n name: 'preview',\n keyCommand: 'preview',\n value: 'preview',\n shortcuts: 'ctrlcmd+9',\n buttonProps: { 'aria-label': 'Preview code (ctrl + 9)', title: 'Preview code (ctrl + 9)' },\n icon: (\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 520 520\">\n <polygon\n fill=\"currentColor\"\n points=\"0 71.293 0 122 38.023 123 38.023 398 0 397 0 449.707 91.023 450.413 91.023 72.293\"\n />\n <polygon\n fill=\"currentColor\"\n points=\"148.023 72.293 520 71.293 520 122 200.023 124 200.023 397 520 396 520 449.707 148.023 450.413\"\n />\n </svg>\n ),\n execute: (\n state: TextState,\n api: TextAreaTextApi,\n dispatch?: React.Dispatch<ContextStore>,\n executeCommandState?: ExecuteCommandState,\n shortcuts?: string[],\n ) => {\n api.textArea.focus();\n if (shortcuts && dispatch && executeCommandState) {\n dispatch({ preview: 'preview' });\n }\n },\n};\n\nexport const codeEdit: ICommand = {\n name: 'edit',\n keyCommand: 'preview',\n value: 'edit',\n shortcuts: 'ctrlcmd+7',\n buttonProps: { 'aria-label': 'Edit code (ctrl + 7)', title: 'Edit code (ctrl + 7)' },\n icon: (\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 520 520\">\n <polygon fill=\"currentColor\" points=\"0 71.293 0 122 319 122 319 397 0 397 0 449.707 372 449.413 372 71.293\" />\n <polygon\n fill=\"currentColor\"\n points=\"429 71.293 520 71.293 520 122 481 123 481 396 520 396 520 449.707 429 449.413\"\n />\n </svg>\n ),\n execute: (\n state: TextState,\n api: TextAreaTextApi,\n dispatch?: React.Dispatch<ContextStore>,\n executeCommandState?: ExecuteCommandState,\n shortcuts?: string[],\n ) => {\n api.textArea.focus();\n if (shortcuts && dispatch && executeCommandState) {\n dispatch({ preview: 'edit' });\n }\n },\n};\n\nexport const codeLive: ICommand = {\n name: 'live',\n keyCommand: 'preview',\n value: 'live',\n shortcuts: 'ctrlcmd+8',\n buttonProps: { 'aria-label': 'Live code (ctrl + 8)', title: 'Live code (ctrl + 8)' },\n icon: (\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 520 520\">\n <polygon fill=\"currentColor\" points=\"0 71.293 0 122 179 122 179 397 0 397 0 449.707 232 449.413 232 71.293\" />\n <polygon\n fill=\"currentColor\"\n points=\"289 71.293 520 71.293 520 122 341 123 341 396 520 396 520 449.707 289 449.413\"\n />\n </svg>\n ),\n execute: (\n state: TextState,\n api: TextAreaTextApi,\n dispatch?: React.Dispatch<ContextStore>,\n executeCommandState?: ExecuteCommandState,\n shortcuts?: string[],\n ) => {\n api.textArea.focus();\n if (shortcuts && dispatch && executeCommandState) {\n dispatch({ preview: 'live' });\n }\n },\n};\n"
26
28
  ],
27
- "mappings": ";;;;;;;AAAA;AAA+B;AAIxB,IAAMA,WAAqB,GAAG;EACnCC,IAAI,EAAE,SAAS;EACfC,UAAU,EAAE,SAAS;EACrBC,KAAK,EAAE,SAAS;EAChBC,SAAS,EAAE,WAAW;EACtBC,WAAW,EAAE;IAAE,YAAY,EAAE,yBAAyB;IAAEC,KAAK,EAAE;EAA0B,CAAC;EAC1FC,IAAI,eACF;IAAK,KAAK,EAAC,IAAI;IAAC,MAAM,EAAC,IAAI;IAAC,OAAO,EAAC,aAAa;IAAA,wBAC/C;MACE,IAAI,EAAC,cAAc;MACnB,MAAM,EAAC;IAAmF,EAC1F,eACF;MACE,IAAI,EAAC,cAAc;MACnB,MAAM,EAAC;IAA+F,EACtG;EAAA,EAEL;EACDC,OAAO,EAAE,iBACPC,KAAgB,EAChBC,GAAoB,EACpBC,QAAuC,EACvCC,mBAAyC,EACzCR,SAAoB,EACjB;IACH,IAAIA,SAAS,IAAIO,QAAQ,IAAIC,mBAAmB,EAAE;MAChDD,QAAQ,CAAC;QAAEE,OAAO,EAAE;MAAU,CAAC,CAAC;IAClC;EACF;AACF,CAAC;AAAC;AAEK,IAAMC,QAAkB,GAAG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,cAAc;MACnB,MAAM,EAAC;IAA+E,EACtF;EAAA,EAEL;EACDC,OAAO,EAAE,iBACPC,KAAgB,EAChBC,GAAoB,EACpBC,QAAuC,EACvCC,mBAAyC,EACzCR,SAAoB,EACjB;IACHM,GAAG,CAACG,QAAQ,CAACC,KAAK,EAAE;IACpB,IAAIV,SAAS,IAAIO,QAAQ,IAAIC,mBAAmB,EAAE;MAChDD,QAAQ,CAAC;QAAEI,OAAO,EAAE;MAAO,CAAC,CAAC;IAC/B;EACF;AACF,CAAC;AAAC;AAEK,IAAME,QAAkB,GAAG;EAChChB,IAAI,EAAE,MAAM;EACZC,UAAU,EAAE,SAAS;EACrBC,KAAK,EAAE,MAAM;EACbC,SAAS,EAAE,WAAW;EACtBC,WAAW,EAAE;IAAE,YAAY,EAAE,sBAAsB;IAAEC,KAAK,EAAE;EAAuB,CAAC;EACpFC,IAAI,eACF;IAAK,KAAK,EAAC,IAAI;IAAC,MAAM,EAAC,IAAI;IAAC,OAAO,EAAC,aAAa;IAAA,wBAC/C;MAAS,IAAI,EAAC,cAAc;MAAC,MAAM,EAAC;IAAuE,EAAG,eAC9G;MACE,IAAI,EAAC,cAAc;MACnB,MAAM,EAAC;IAA+E,EACtF;EAAA,EAEL;EACDC,OAAO,EAAE,iBACPC,KAAgB,EAChBC,GAAoB,EACpBC,QAAuC,EACvCC,mBAAyC,EACzCR,SAAoB,EACjB;IACHM,GAAG,CAACG,QAAQ,CAACC,KAAK,EAAE;IACpB,IAAIV,SAAS,IAAIO,QAAQ,IAAIC,mBAAmB,EAAE;MAChDD,QAAQ,CAAC;QAAEI,OAAO,EAAE;MAAO,CAAC,CAAC;IAC/B;EACF;AACF,CAAC;AAAC"
28
30
  }
@@ -11,33 +11,56 @@ var DragBar = function DragBar(props) {
11
11
  var _ref = props || {},
12
12
  prefixCls = _ref.prefixCls,
13
13
  onChange = _ref.onChange;
14
+ var $dom = (0, _react.useRef)(null);
14
15
  var dragRef = (0, _react.useRef)();
15
16
  function handleMouseMove(event) {
16
17
  if (dragRef.current) {
17
- var newHeight = dragRef.current.height + event.clientY - dragRef.current.dragY;
18
+ var _changedTouches$;
19
+ var clientY = event.clientY || ((_changedTouches$ = event.changedTouches[0]) === null || _changedTouches$ === void 0 ? void 0 : _changedTouches$.clientY);
20
+ var newHeight = dragRef.current.height + clientY - dragRef.current.dragY;
18
21
  if (newHeight >= props.minHeight && newHeight <= props.maxHeight) {
19
- onChange && onChange(dragRef.current.height + (event.clientY - dragRef.current.dragY));
22
+ onChange && onChange(dragRef.current.height + (clientY - dragRef.current.dragY));
20
23
  }
21
24
  }
22
25
  }
23
26
  function handleMouseUp() {
27
+ var _$dom$current, _$dom$current2;
24
28
  dragRef.current = undefined;
29
+ document.removeEventListener('mousemove', handleMouseMove);
30
+ document.removeEventListener('mouseup', handleMouseUp);
31
+ (_$dom$current = $dom.current) === null || _$dom$current === void 0 ? void 0 : _$dom$current.removeEventListener('touchmove', handleMouseMove);
32
+ (_$dom$current2 = $dom.current) === null || _$dom$current2 === void 0 ? void 0 : _$dom$current2.removeEventListener('touchend', handleMouseUp);
25
33
  }
26
34
  function handleMouseDown(event) {
35
+ var _changedTouches$2, _$dom$current3, _$dom$current4;
36
+ event.preventDefault();
37
+ var clientY = event.clientY || ((_changedTouches$2 = event.changedTouches[0]) === null || _changedTouches$2 === void 0 ? void 0 : _changedTouches$2.clientY);
27
38
  dragRef.current = {
28
39
  height: props.height,
29
- dragY: event.clientY
40
+ dragY: clientY
30
41
  };
42
+ document.addEventListener('mousemove', handleMouseMove);
43
+ document.addEventListener('mouseup', handleMouseUp);
44
+ (_$dom$current3 = $dom.current) === null || _$dom$current3 === void 0 ? void 0 : _$dom$current3.addEventListener('touchmove', handleMouseMove, {
45
+ passive: false
46
+ });
47
+ (_$dom$current4 = $dom.current) === null || _$dom$current4 === void 0 ? void 0 : _$dom$current4.addEventListener('touchend', handleMouseUp, {
48
+ passive: false
49
+ });
31
50
  }
32
51
  (0, _react.useEffect)(function () {
33
52
  if (document) {
34
- document.addEventListener('mousemove', handleMouseMove);
35
- document.addEventListener('mouseup', handleMouseUp);
53
+ var _$dom$current5, _$dom$current6;
54
+ (_$dom$current5 = $dom.current) === null || _$dom$current5 === void 0 ? void 0 : _$dom$current5.addEventListener('touchstart', handleMouseDown, {
55
+ passive: false
56
+ });
57
+ (_$dom$current6 = $dom.current) === null || _$dom$current6 === void 0 ? void 0 : _$dom$current6.addEventListener('mousedown', handleMouseDown);
36
58
  }
37
59
  return function () {
38
60
  if (document) {
61
+ var _$dom$current7;
62
+ (_$dom$current7 = $dom.current) === null || _$dom$current7 === void 0 ? void 0 : _$dom$current7.removeEventListener('touchstart', handleMouseDown);
39
63
  document.removeEventListener('mousemove', handleMouseMove);
40
- document.removeEventListener('mouseup', handleMouseUp);
41
64
  }
42
65
  };
43
66
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -54,7 +77,7 @@ var DragBar = function DragBar(props) {
54
77
  }, []);
55
78
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
56
79
  className: "".concat(prefixCls, "-bar"),
57
- onMouseDown: handleMouseDown,
80
+ ref: $dom,
58
81
  children: svg
59
82
  });
60
83
  };
@@ -5,24 +5,28 @@
5
5
  "props",
6
6
  "prefixCls",
7
7
  "onChange",
8
- "dragRef",
8
+ "$dom",
9
9
  "useRef",
10
+ "dragRef",
10
11
  "handleMouseMove",
11
12
  "event",
12
13
  "current",
14
+ "clientY",
15
+ "changedTouches",
13
16
  "newHeight",
14
17
  "height",
15
- "clientY",
16
18
  "dragY",
17
19
  "minHeight",
18
20
  "maxHeight",
19
21
  "handleMouseUp",
20
22
  "undefined",
21
- "handleMouseDown",
22
- "useEffect",
23
23
  "document",
24
- "addEventListener",
25
24
  "removeEventListener",
25
+ "handleMouseDown",
26
+ "preventDefault",
27
+ "addEventListener",
28
+ "passive",
29
+ "useEffect",
26
30
  "svg",
27
31
  "useMemo"
28
32
  ],
@@ -30,7 +34,7 @@
30
34
  "../../../src/components/DragBar/index.tsx"
31
35
  ],
32
36
  "sourcesContent": [
33
- "import React, { useEffect, useMemo, useRef } from 'react';\nimport { IProps } from '../../Editor';\nimport './index.less';\n\nexport interface IDragBarProps extends IProps {\n height: number;\n maxHeight: number;\n minHeight: number;\n onChange: (value: number) => void;\n}\n\nconst DragBar: React.FC<IDragBarProps> = (props) => {\n const { prefixCls, onChange } = props || {};\n const dragRef = useRef<{ height: number; dragY: number }>();\n function handleMouseMove(event: MouseEvent) {\n if (dragRef.current) {\n const newHeight = dragRef.current.height + event.clientY - dragRef.current.dragY;\n if (newHeight >= props.minHeight && newHeight <= props.maxHeight) {\n onChange && onChange(dragRef.current.height + (event.clientY - dragRef.current.dragY));\n }\n }\n }\n function handleMouseUp() {\n dragRef.current = undefined;\n }\n function handleMouseDown(event: React.MouseEvent<HTMLDivElement, MouseEvent>) {\n dragRef.current = {\n height: props.height,\n dragY: event.clientY,\n };\n }\n\n useEffect(() => {\n if (document) {\n document.addEventListener('mousemove', handleMouseMove);\n document.addEventListener('mouseup', handleMouseUp);\n }\n return () => {\n if (document) {\n document.removeEventListener('mousemove', handleMouseMove);\n document.removeEventListener('mouseup', handleMouseUp);\n }\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n const svg = useMemo(\n () => (\n <svg viewBox=\"0 0 512 512\" height=\"100%\">\n <path\n fill=\"currentColor\"\n 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\"\n />\n </svg>\n ),\n [],\n );\n return (\n <div className={`${prefixCls}-bar`} onMouseDown={handleMouseDown}>\n {svg}\n </div>\n );\n};\n\nexport default DragBar;\n"
37
+ "import React, { useEffect, useMemo, useRef } from 'react';\nimport { IProps } from '../../Editor';\nimport './index.less';\n\nexport interface IDragBarProps extends IProps {\n height: number;\n maxHeight: number;\n minHeight: number;\n onChange: (value: number) => void;\n}\n\nconst DragBar: React.FC<IDragBarProps> = (props) => {\n const { prefixCls, onChange } = props || {};\n const $dom = useRef<HTMLDivElement>(null);\n const dragRef = useRef<{ height: number; dragY: number }>();\n function handleMouseMove(event: Event) {\n if (dragRef.current) {\n const clientY =\n (event as unknown as MouseEvent).clientY || (event as unknown as TouchEvent).changedTouches[0]?.clientY;\n const newHeight = dragRef.current.height + clientY - dragRef.current.dragY;\n if (newHeight >= props.minHeight && newHeight <= props.maxHeight) {\n onChange && onChange(dragRef.current.height + (clientY - dragRef.current.dragY));\n }\n }\n }\n function handleMouseUp() {\n dragRef.current = undefined;\n document.removeEventListener('mousemove', handleMouseMove);\n document.removeEventListener('mouseup', handleMouseUp);\n $dom.current?.removeEventListener('touchmove', handleMouseMove);\n $dom.current?.removeEventListener('touchend', handleMouseUp);\n }\n function handleMouseDown(event: Event) {\n event.preventDefault();\n const clientY =\n (event as unknown as MouseEvent).clientY || (event as unknown as TouchEvent).changedTouches[0]?.clientY;\n dragRef.current = {\n height: props.height,\n dragY: clientY,\n };\n document.addEventListener('mousemove', handleMouseMove);\n document.addEventListener('mouseup', handleMouseUp);\n $dom.current?.addEventListener('touchmove', handleMouseMove, { passive: false });\n $dom.current?.addEventListener('touchend', handleMouseUp, { passive: false });\n }\n\n useEffect(() => {\n if (document) {\n $dom.current?.addEventListener('touchstart', handleMouseDown, { passive: false });\n $dom.current?.addEventListener('mousedown', handleMouseDown);\n }\n return () => {\n if (document) {\n $dom.current?.removeEventListener('touchstart', handleMouseDown);\n document.removeEventListener('mousemove', handleMouseMove);\n }\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n const svg = useMemo(\n () => (\n <svg viewBox=\"0 0 512 512\" height=\"100%\">\n <path\n fill=\"currentColor\"\n 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\"\n />\n </svg>\n ),\n [],\n );\n return (\n <div className={`${prefixCls}-bar`} ref={$dom}>\n {svg}\n </div>\n );\n};\n\nexport default DragBar;\n"
34
38
  ],
35
- "mappings": ";;;;;;;AAAA;AAA0D;AAW1D,IAAMA,OAAgC,GAAG,SAAnCA,OAAgC,CAAIC,KAAK,EAAK;EAClD,WAAgCA,KAAK,IAAI,CAAC,CAAC;IAAnCC,SAAS,QAATA,SAAS;IAAEC,QAAQ,QAARA,QAAQ;EAC3B,IAAMC,OAAO,GAAG,IAAAC,aAAM,GAAqC;EAC3D,SAASC,eAAe,CAACC,KAAiB,EAAE;IAC1C,IAAIH,OAAO,CAACI,OAAO,EAAE;MACnB,IAAMC,SAAS,GAAGL,OAAO,CAACI,OAAO,CAACE,MAAM,GAAGH,KAAK,CAACI,OAAO,GAAGP,OAAO,CAACI,OAAO,CAACI,KAAK;MAChF,IAAIH,SAAS,IAAIR,KAAK,CAACY,SAAS,IAAIJ,SAAS,IAAIR,KAAK,CAACa,SAAS,EAAE;QAChEX,QAAQ,IAAIA,QAAQ,CAACC,OAAO,CAACI,OAAO,CAACE,MAAM,IAAIH,KAAK,CAACI,OAAO,GAAGP,OAAO,CAACI,OAAO,CAACI,KAAK,CAAC,CAAC;MACxF;IACF;EACF;EACA,SAASG,aAAa,GAAG;IACvBX,OAAO,CAACI,OAAO,GAAGQ,SAAS;EAC7B;EACA,SAASC,eAAe,CAACV,KAAmD,EAAE;IAC5EH,OAAO,CAACI,OAAO,GAAG;MAChBE,MAAM,EAAET,KAAK,CAACS,MAAM;MACpBE,KAAK,EAAEL,KAAK,CAACI;IACf,CAAC;EACH;EAEA,IAAAO,gBAAS,EAAC,YAAM;IACd,IAAIC,QAAQ,EAAE;MACZA,QAAQ,CAACC,gBAAgB,CAAC,WAAW,EAAEd,eA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AE;MAAEO,OAAO,EAAE;IAAM,CAAC,CAAC;EAC/E;EAEA,IAAAC,gBAAS,EAAC,YAAM;IACd,IAAIN,QAAQ,EAAE;MAAA;MACZ,kBAAAf,IAAI,CAACK,OAAO,mDAAZ,eAAcc,gBAAgB,CAAC,YAAY,EAAEF,eAAe,EAAE;QAAEG,OAAO,EAAE;MAAM,CAAC,CAAC;MACjF,kBAAApB,IAAI,CAACK,OAAO,mDAAZ,eAAcc,gBAAgB,CAAC,WAAW,EAAEF,eAAe,CAAC;IAC9D;IACA,OAAO,YAAM;MACX,IAAIF,QAAQ,EAAE;QAAA;QACZ,kBAAAf,IAAI,CAACK,OAAO,mDAAZ,eAAcW,mBAAmB,CAAC,YAAY,EAAEC,eAAe,CAAC;QAChEF,QAAQ,CAACC,mBAAmB,CAAC,WAAW,EAAEb,eAAe,CAAC;MAC5D;IACF,CAAC;IACD;EACF,CAAC,EAAE,EAAE,CAAC;EACN,IAAMmB,GAAG,GAAG,IAAAC,cAAO,EACjB;IAAA,oBACE;MAAK,OAAO,EAAC,aAAa;MAAC,MAAM,EAAC,MAAM;MAAA,uBACtC;QACE,IAAI,EAAC,cAAc;QACnB,CAAC,EAAC;MAA2N;IAC7N,EACE;EAAA,CACP,EACD,EAAE,CACH;EACD,oBACE;IAAK,SAAS,YAAKzB,SAAS,SAAO;IAAC,GAAG,EAAEE,IAAK;IAAA,UAC3CsB;EAAG,EACA;AAEV,CAAC;AAAC,eAEa1B,OAAO;AAAA;AAAA"
36
40
  }
@@ -6,13 +6,15 @@ Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports["default"] = Markdown;
9
+ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
9
10
  var _react = _interopRequireWildcard(require("react"));
10
11
  var _rehype = require("rehype");
11
12
  var _rehypePrismPlus = _interopRequireDefault(require("rehype-prism-plus"));
12
13
  var _Context = require("../../Context");
13
14
  var _jsxRuntime = require("react/jsx-runtime");
15
+ var _templateObject;
14
16
  function html2Escape(sHtml) {
15
- return sHtml.replace(/```(tsx?|jsx?|html|xml)(.*)\s+([\s\S]*?)(\s.+)?```/g, function (str) {
17
+ return sHtml.replace(/```(\w+)?([\s\S]*?)(\s.+)?```/g, function (str) {
16
18
  return str.replace(/[<&"]/g, function (c) {
17
19
  return {
18
20
  '<': '&lt;',
@@ -46,30 +48,29 @@ function Markdown(props) {
46
48
  }
47
49
  // eslint-disable-next-line react-hooks/exhaustive-deps
48
50
  }, []);
49
- return (0, _react.useMemo)(function () {
50
- if (!markdown) {
51
- return /*#__PURE__*/(0, _jsxRuntime.jsx)("pre", {
52
- ref: preRef,
53
- className: "".concat(prefixCls, "-text-pre wmde-markdown-color")
54
- });
55
- }
56
- var mdStr = "<pre class=\"language-markdown ".concat(prefixCls, "-text-pre wmde-markdown-color\"><code class=\"language-markdown\">").concat(html2Escape(markdown), "\n</code></pre>");
57
- if (highlightEnable) {
58
- try {
59
- mdStr = (0, _rehype.rehype)().data('settings', {
60
- fragment: true
61
- }).use(_rehypePrismPlus["default"], {
62
- ignoreMissing: true
63
- }).processSync(mdStr).toString();
64
- } catch (error) {}
65
- }
66
- return /*#__PURE__*/_react["default"].createElement('div', {
67
- className: 'wmde-markdown-color',
68
- dangerouslySetInnerHTML: {
69
- __html: mdStr || ''
70
- }
51
+ if (!markdown) {
52
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("pre", {
53
+ ref: preRef,
54
+ className: "".concat(prefixCls, "-text-pre wmde-markdown-color")
71
55
  });
72
- }, [markdown, preRef, prefixCls]);
56
+ }
57
+ var mdStr = "<pre class=\"language-markdown ".concat(prefixCls, "-text-pre wmde-markdown-color\"><code class=\"language-markdown\">").concat(html2Escape(String.raw(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["", ""])), markdown)), "\n</code></pre>");
58
+ console.log('markdown::', markdown);
59
+ if (highlightEnable) {
60
+ try {
61
+ mdStr = (0, _rehype.rehype)().data('settings', {
62
+ fragment: true
63
+ }).use(_rehypePrismPlus["default"], {
64
+ ignoreMissing: true
65
+ }).processSync(mdStr).toString();
66
+ } catch (error) {}
67
+ }
68
+ return /*#__PURE__*/_react["default"].createElement('div', {
69
+ className: 'wmde-markdown-color',
70
+ dangerouslySetInnerHTML: {
71
+ __html: mdStr || ''
72
+ }
73
+ });
73
74
  }
74
75
  module.exports = exports.default;
75
76
  //# sourceMappingURL=Markdown.js.map
@@ -20,8 +20,11 @@
20
20
  "useEffect",
21
21
  "current",
22
22
  "textareaPre",
23
- "useMemo",
24
23
  "mdStr",
24
+ "String",
25
+ "raw",
26
+ "console",
27
+ "log",
25
28
  "rehype",
26
29
  "data",
27
30
  "fragment",
@@ -40,7 +43,7 @@
40
43
  "../../../src/components/TextArea/Markdown.tsx"
41
44
  ],
42
45
  "sourcesContent": [
43
- "import React, { useContext, useEffect, useMemo } from 'react';\nimport { rehype } from 'rehype';\nimport rehypePrism from 'rehype-prism-plus';\nimport { IProps } from '../../Editor';\nimport { EditorContext } from '../../Context';\n\nfunction html2Escape(sHtml: string) {\n return sHtml\n .replace(/```(tsx?|jsx?|html|xml)(.*)\\s+([\\s\\S]*?)(\\s.+)?```/g, (str: string) => {\n return str.replace(\n /[<&\"]/g,\n (c: string) => (({ '<': '&lt;', '>': '&gt;', '&': '&amp;', '\"': '&quot;' } as Record<string, string>)[c]),\n );\n })\n .replace(\n /[<&\"]/g,\n (c: string) => (({ '<': '&lt;', '>': '&gt;', '&': '&amp;', '\"': '&quot;' } as Record<string, string>)[c]),\n );\n}\n\nexport interface MarkdownProps extends IProps, React.HTMLAttributes<HTMLPreElement> {}\n\nexport default function Markdown(props: MarkdownProps) {\n const { prefixCls } = props;\n const { markdown = '', highlightEnable, dispatch } = useContext(EditorContext);\n const preRef = React.createRef<HTMLPreElement>();\n useEffect(() => {\n if (preRef.current && dispatch) {\n dispatch({ textareaPre: preRef.current });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return useMemo(() => {\n if (!markdown) {\n return <pre ref={preRef} className={`${prefixCls}-text-pre wmde-markdown-color`} />;\n }\n let mdStr = `<pre class=\"language-markdown ${prefixCls}-text-pre wmde-markdown-color\"><code class=\"language-markdown\">${html2Escape(\n markdown,\n )}\\n</code></pre>`;\n\n if (highlightEnable) {\n try {\n mdStr = rehype()\n .data('settings', { fragment: true })\n .use(rehypePrism, { ignoreMissing: true })\n .processSync(mdStr)\n .toString();\n } catch (error) {}\n }\n\n return React.createElement('div', {\n className: 'wmde-markdown-color',\n dangerouslySetInnerHTML: { __html: mdStr || '' },\n });\n }, [markdown, preRef, prefixCls]);\n}\n"
46
+ "import React, { useContext, useEffect, useMemo } from 'react';\nimport { rehype } from 'rehype';\nimport rehypePrism from 'rehype-prism-plus';\nimport { IProps } from '../../Editor';\nimport { EditorContext } from '../../Context';\n\nfunction html2Escape(sHtml: string) {\n return sHtml\n .replace(/```(\\w+)?([\\s\\S]*?)(\\s.+)?```/g, (str: string) => {\n return str.replace(\n /[<&\"]/g,\n (c: string) => (({ '<': '&lt;', '>': '&gt;', '&': '&amp;', '\"': '&quot;' } as Record<string, string>)[c]),\n );\n })\n .replace(\n /[<&\"]/g,\n (c: string) => (({ '<': '&lt;', '>': '&gt;', '&': '&amp;', '\"': '&quot;' } as Record<string, string>)[c]),\n );\n}\n\nexport interface MarkdownProps extends IProps, React.HTMLAttributes<HTMLPreElement> {}\n\nexport default function Markdown(props: MarkdownProps) {\n const { prefixCls } = props;\n const { markdown = '', highlightEnable, dispatch } = useContext(EditorContext);\n const preRef = React.createRef<HTMLPreElement>();\n useEffect(() => {\n if (preRef.current && dispatch) {\n dispatch({ textareaPre: preRef.current });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n if (!markdown) {\n return <pre ref={preRef} className={`${prefixCls}-text-pre wmde-markdown-color`} />;\n }\n let mdStr = `<pre class=\"language-markdown ${prefixCls}-text-pre wmde-markdown-color\"><code class=\"language-markdown\">${html2Escape(\n String.raw`${markdown}`,\n )}\\n</code></pre>`;\n\n console.log('markdown::', markdown);\n\n if (highlightEnable) {\n try {\n mdStr = rehype()\n .data('settings', { fragment: true })\n .use(rehypePrism, { ignoreMissing: true })\n .processSync(mdStr)\n .toString();\n } catch (error) {}\n }\n\n return React.createElement('div', {\n className: 'wmde-markdown-color',\n dangerouslySetInnerHTML: { __html: mdStr || '' },\n });\n}\n"
44
47
  ],
45
- "mappings": ";;;;;;;;AAAA;AACA;AACA;AAEA;AAA8C;AAE9C,SAASA,WAAW,CAACC,KAAa,EAAE;EAClC,OAAOA,KAAK,CACTC,OAAO,CAAC,qDAAqD,EAAE,UAACC,GAAW,EAAK;IAC/E,OAAOA,GAAG,CAACD,OAAO,CAChB,QAAQ,EACR,UAACE,CAAS;MAAA,OAAO;QAAE,GAAG,EAAE,MAAM;QAAE,GAAG,EAAE,MAAM;QAAE,GAAG,EAAE,OAAO;QAAE,GAAG,EAAE;MAAS,CAAC,CAA4BA,CAAC,CAAC;IAAA,CAAC,CAC1G;EACH,CAAC,CAAC,CACDF,OAAO,CACN,QAAQ,EACR,UAACE,CAAS;IAAA,OAAO;MAAE,GAAG,EAAE,MAAM;MAAE,GAAG,EAAE,MAAM;MAAE,GAAG,EAAE,OAAO;MAAE,GAAG,EAAE;IAAS,CAAC,CAA4BA,CAAC,CAAC;EAAA,CAAC,CAC1G;AACL;AAIe,SAASC,QAAQ,CAACC,KAAoB,EAAE;EACrD,IAAQC,SAAS,GAAKD,KAAK,CAAnBC,SAAS;EACjB,kBAAqD,IAAAC,iBAAU,EAACC,sBAAa,CAAC;IAAA,mCAAtEC,QAAQ;IAARA,QAAQ,qCAAG,EAAE;IAAEC,eAAe,eAAfA,eAAe;IAAEC,QAAQ,eAARA,QAAQ;EAChD,IAAMC,MAAM,gBAAGC,iBAAK,CAACC,SAAS,EAAkB;EAChD,IAAAC,gBAAS,EAAC,YAAM;IACd,IAAIH,MAAM,CAACI,OAAO,IAAIL,QAAQ,EAAE;MAC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