@uiw/react-md-editor 3.18.3 → 3.19.1

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.
Files changed (140) hide show
  1. package/dist/mdeditor.js +1564 -1583
  2. package/dist/mdeditor.min.js +1 -1
  3. package/esm/Context.js.map +1 -1
  4. package/esm/Editor.js +43 -67
  5. package/esm/Editor.js.map +1 -1
  6. package/esm/commands/bold.js +4 -4
  7. package/esm/commands/bold.js.map +1 -1
  8. package/esm/commands/code.js +8 -10
  9. package/esm/commands/code.js.map +2 -2
  10. package/esm/commands/comment.js +27 -16
  11. package/esm/commands/comment.js.map +2 -2
  12. package/esm/commands/divider.js.map +1 -1
  13. package/esm/commands/fullscreen.js +3 -4
  14. package/esm/commands/fullscreen.js.map +2 -2
  15. package/esm/commands/group.js +2 -4
  16. package/esm/commands/group.js.map +1 -1
  17. package/esm/commands/hr.js.map +1 -1
  18. package/esm/commands/image.js +6 -6
  19. package/esm/commands/image.js.map +2 -2
  20. package/esm/commands/index.d.ts +2 -2
  21. package/esm/commands/index.js +12 -23
  22. package/esm/commands/index.js.map +3 -2
  23. package/esm/commands/italic.js +4 -4
  24. package/esm/commands/italic.js.map +1 -1
  25. package/esm/commands/link.js +4 -4
  26. package/esm/commands/link.js.map +1 -1
  27. package/esm/commands/list.js +4 -4
  28. package/esm/commands/list.js.map +1 -1
  29. package/esm/commands/preview.js +21 -3
  30. package/esm/commands/preview.js.map +7 -2
  31. package/esm/commands/quote.js +2 -1
  32. package/esm/commands/quote.js.map +1 -1
  33. package/esm/commands/strikeThrough.js +4 -4
  34. package/esm/commands/strikeThrough.js.map +1 -1
  35. package/esm/commands/title.js.map +1 -1
  36. package/esm/commands/title1.js.map +1 -1
  37. package/esm/commands/title2.js.map +1 -1
  38. package/esm/commands/title3.js.map +1 -1
  39. package/esm/commands/title4.js.map +1 -1
  40. package/esm/commands/title5.js.map +1 -1
  41. package/esm/commands/title6.js.map +1 -1
  42. package/esm/components/DragBar/index.js +2 -9
  43. package/esm/components/DragBar/index.js.map +1 -1
  44. package/esm/components/TextArea/Markdown.js +2 -7
  45. package/esm/components/TextArea/Markdown.js.map +1 -1
  46. package/esm/components/TextArea/Textarea.js +8 -11
  47. package/esm/components/TextArea/Textarea.js.map +1 -1
  48. package/esm/components/TextArea/handleKeyDown.js +2 -16
  49. package/esm/components/TextArea/handleKeyDown.js.map +1 -1
  50. package/esm/components/TextArea/index.js +11 -15
  51. package/esm/components/TextArea/index.js.map +1 -1
  52. package/esm/components/TextArea/shortcuts.js +1 -17
  53. package/esm/components/TextArea/shortcuts.js.map +2 -2
  54. package/esm/components/Toolbar/Child.js +2 -1
  55. package/esm/components/Toolbar/Child.js.map +1 -1
  56. package/esm/components/Toolbar/index.js +2 -12
  57. package/esm/components/Toolbar/index.js.map +1 -1
  58. package/esm/index.js.map +1 -1
  59. package/esm/utils/InsertTextAtPosition.js +28 -34
  60. package/esm/utils/InsertTextAtPosition.js.map +1 -1
  61. package/esm/utils/markdownUtils.js +14 -23
  62. package/esm/utils/markdownUtils.js.map +1 -1
  63. package/lib/Context.js +0 -6
  64. package/lib/Context.js.map +1 -1
  65. package/lib/Editor.js +74 -114
  66. package/lib/Editor.js.map +1 -1
  67. package/lib/commands/bold.js +4 -9
  68. package/lib/commands/bold.js.map +1 -1
  69. package/lib/commands/code.js +8 -15
  70. package/lib/commands/code.js.map +2 -2
  71. package/lib/commands/comment.js +27 -19
  72. package/lib/commands/comment.js.map +2 -2
  73. package/lib/commands/divider.js.map +1 -1
  74. package/lib/commands/fullscreen.js +3 -8
  75. package/lib/commands/fullscreen.js.map +2 -2
  76. package/lib/commands/group.js +2 -10
  77. package/lib/commands/group.js.map +1 -1
  78. package/lib/commands/hr.js +0 -4
  79. package/lib/commands/hr.js.map +1 -1
  80. package/lib/commands/image.js +6 -11
  81. package/lib/commands/image.js.map +2 -2
  82. package/lib/commands/index.d.ts +2 -2
  83. package/lib/commands/index.js +10 -47
  84. package/lib/commands/index.js.map +4 -3
  85. package/lib/commands/italic.js +4 -9
  86. package/lib/commands/italic.js.map +1 -1
  87. package/lib/commands/link.js +4 -9
  88. package/lib/commands/link.js.map +1 -1
  89. package/lib/commands/list.js +4 -10
  90. package/lib/commands/list.js.map +1 -1
  91. package/lib/commands/preview.js +21 -7
  92. package/lib/commands/preview.js.map +7 -2
  93. package/lib/commands/quote.js +2 -6
  94. package/lib/commands/quote.js.map +1 -1
  95. package/lib/commands/strikeThrough.js +4 -9
  96. package/lib/commands/strikeThrough.js.map +1 -1
  97. package/lib/commands/title.js +0 -6
  98. package/lib/commands/title.js.map +1 -1
  99. package/lib/commands/title1.js +0 -5
  100. package/lib/commands/title1.js.map +1 -1
  101. package/lib/commands/title2.js +0 -5
  102. package/lib/commands/title2.js.map +1 -1
  103. package/lib/commands/title3.js +0 -5
  104. package/lib/commands/title3.js.map +1 -1
  105. package/lib/commands/title4.js +0 -5
  106. package/lib/commands/title4.js.map +1 -1
  107. package/lib/commands/title5.js +0 -5
  108. package/lib/commands/title5.js.map +1 -1
  109. package/lib/commands/title6.js +0 -5
  110. package/lib/commands/title6.js.map +1 -1
  111. package/lib/components/DragBar/index.js +4 -15
  112. package/lib/components/DragBar/index.js.map +1 -1
  113. package/lib/components/TextArea/Markdown.js +6 -22
  114. package/lib/components/TextArea/Markdown.js.map +1 -1
  115. package/lib/components/TextArea/Textarea.js +15 -36
  116. package/lib/components/TextArea/Textarea.js.map +1 -1
  117. package/lib/components/TextArea/handleKeyDown.js +1 -18
  118. package/lib/components/TextArea/handleKeyDown.js.map +1 -1
  119. package/lib/components/TextArea/index.js +15 -37
  120. package/lib/components/TextArea/index.js.map +1 -1
  121. package/lib/components/TextArea/shortcuts.js +1 -17
  122. package/lib/components/TextArea/shortcuts.js.map +2 -2
  123. package/lib/components/Toolbar/Child.js +8 -18
  124. package/lib/components/Toolbar/Child.js.map +1 -1
  125. package/lib/components/Toolbar/index.js +14 -36
  126. package/lib/components/Toolbar/index.js.map +1 -1
  127. package/lib/index.js +0 -9
  128. package/lib/index.js.map +1 -1
  129. package/lib/utils/InsertTextAtPosition.js +28 -37
  130. package/lib/utils/InsertTextAtPosition.js.map +1 -1
  131. package/lib/utils/markdownUtils.js +17 -28
  132. package/lib/utils/markdownUtils.js.map +1 -1
  133. package/package.json +1 -1
  134. package/src/commands/code.tsx +2 -2
  135. package/src/commands/comment.tsx +19 -4
  136. package/src/commands/fullscreen.tsx +3 -2
  137. package/src/commands/image.tsx +1 -1
  138. package/src/commands/index.ts +8 -7
  139. package/src/commands/preview.tsx +35 -4
  140. package/src/components/TextArea/shortcuts.ts +2 -2
@@ -1,80 +1,59 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
4
-
5
4
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];
6
-
7
5
  Object.defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
10
8
  exports["default"] = TextArea;
11
-
12
9
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
13
-
14
10
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
15
-
16
11
  var _react = _interopRequireWildcard(require("react"));
17
-
18
12
  var _Context = require("../../Context");
19
-
20
13
  var _shortcuts = _interopRequireDefault(require("./shortcuts"));
21
-
22
14
  var _Markdown = _interopRequireDefault(require("./Markdown"));
23
-
24
15
  var _Textarea = _interopRequireDefault(require("./Textarea"));
25
-
26
16
  var _commands = require("../../commands");
27
-
28
17
  var _jsxRuntime = require("react/jsx-runtime");
29
-
30
18
  var _excluded = ["prefixCls", "className", "onScroll", "renderTextarea"];
31
-
32
19
  function TextArea(props) {
33
20
  var _ref = props || {},
34
- prefixCls = _ref.prefixCls,
35
- className = _ref.className,
36
- onScroll = _ref.onScroll,
37
- renderTextarea = _ref.renderTextarea,
38
- otherProps = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
39
-
21
+ prefixCls = _ref.prefixCls,
22
+ className = _ref.className,
23
+ onScroll = _ref.onScroll,
24
+ renderTextarea = _ref.renderTextarea,
25
+ otherProps = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
40
26
  var _useContext = (0, _react.useContext)(_Context.EditorContext),
41
- markdown = _useContext.markdown,
42
- scrollTop = _useContext.scrollTop,
43
- commands = _useContext.commands,
44
- highlightEnable = _useContext.highlightEnable,
45
- extraCommands = _useContext.extraCommands,
46
- dispatch = _useContext.dispatch;
47
-
27
+ markdown = _useContext.markdown,
28
+ scrollTop = _useContext.scrollTop,
29
+ commands = _useContext.commands,
30
+ highlightEnable = _useContext.highlightEnable,
31
+ extraCommands = _useContext.extraCommands,
32
+ dispatch = _useContext.dispatch;
48
33
  var textRef = _react["default"].useRef(null);
49
-
50
34
  var executeRef = _react["default"].useRef();
51
-
52
35
  var warp = /*#__PURE__*/_react["default"].createRef();
53
-
54
36
  (0, _react.useEffect)(function () {
55
37
  var state = {};
56
-
57
38
  if (warp.current) {
58
39
  state.textareaWarp = warp.current || undefined;
59
40
  warp.current.scrollTop = scrollTop || 0;
60
41
  }
61
-
62
42
  if (dispatch) {
63
43
  dispatch((0, _objectSpread2["default"])({}, state));
64
- } // eslint-disable-next-line react-hooks/exhaustive-deps
65
-
44
+ }
45
+ // eslint-disable-next-line react-hooks/exhaustive-deps
66
46
  }, []);
67
47
  (0, _react.useEffect)(function () {
68
48
  if (textRef.current && dispatch) {
69
49
  var _commandOrchestrator = new _commands.TextAreaCommandOrchestrator(textRef.current);
70
-
71
50
  executeRef.current = _commandOrchestrator;
72
51
  dispatch({
73
52
  textarea: textRef.current,
74
53
  commandOrchestrator: _commandOrchestrator
75
54
  });
76
- } // eslint-disable-next-line react-hooks/exhaustive-deps
77
-
55
+ }
56
+ // eslint-disable-next-line react-hooks/exhaustive-deps
78
57
  }, []);
79
58
  var textStyle = highlightEnable ? {} : {
80
59
  WebkitTextFillColor: 'initial',
@@ -120,6 +99,5 @@ function TextArea(props) {
120
99
  })
121
100
  });
122
101
  }
123
-
124
102
  module.exports = exports.default;
125
103
  //# sourceMappingURL=index.js.map
@@ -50,5 +50,5 @@
50
50
  "sourcesContent": [
51
51
  "import React, { useEffect, Fragment, useContext } from 'react';\nimport { EditorContext, ContextStore, ExecuteCommandState } from '../../Context';\nimport shortcuts from './shortcuts';\nimport Markdown from './Markdown';\nimport Textarea, { TextAreaProps } from './Textarea';\nimport { IProps } from '../../Editor';\nimport { TextAreaCommandOrchestrator, ICommand } from '../../commands';\nimport './index.less';\n\ntype RenderTextareaHandle = {\n dispatch: ContextStore['dispatch'];\n onChange?: TextAreaProps['onChange'];\n useContext?: {\n commands: ContextStore['commands'];\n extraCommands: ContextStore['extraCommands'];\n commandOrchestrator?: TextAreaCommandOrchestrator;\n };\n shortcuts?: (\n e: KeyboardEvent | React.KeyboardEvent<HTMLTextAreaElement>,\n commands: ICommand[],\n commandOrchestrator?: TextAreaCommandOrchestrator,\n dispatch?: React.Dispatch<ContextStore>,\n state?: ExecuteCommandState,\n ) => void;\n};\n\nexport interface ITextAreaProps\n extends Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'value' | 'onScroll'>,\n IProps {\n value?: string;\n onScroll?: (e: React.UIEvent<HTMLDivElement>) => void;\n renderTextarea?: (\n props: React.TextareaHTMLAttributes<HTMLTextAreaElement> | React.HTMLAttributes<HTMLDivElement>,\n opts: RenderTextareaHandle,\n ) => JSX.Element;\n}\n\nexport type TextAreaRef = {\n text?: HTMLTextAreaElement;\n warp?: HTMLDivElement;\n};\n\nexport default function TextArea(props: ITextAreaProps) {\n const { prefixCls, className, onScroll, renderTextarea, ...otherProps } = props || {};\n const { markdown, scrollTop, commands, highlightEnable, extraCommands, dispatch } = useContext(EditorContext);\n const textRef = React.useRef<HTMLTextAreaElement>(null);\n const executeRef = React.useRef<TextAreaCommandOrchestrator>();\n const warp = React.createRef<HTMLDivElement>();\n useEffect(() => {\n const state: ContextStore = {};\n if (warp.current) {\n state.textareaWarp = warp.current || undefined;\n warp.current.scrollTop = scrollTop || 0;\n }\n if (dispatch) {\n dispatch({ ...state });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useEffect(() => {\n if (textRef.current && dispatch) {\n const commandOrchestrator = new TextAreaCommandOrchestrator(textRef.current);\n executeRef.current = commandOrchestrator;\n dispatch({ textarea: textRef.current, commandOrchestrator });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const textStyle: React.CSSProperties = highlightEnable ? {} : { WebkitTextFillColor: 'initial', overflow: 'auto' };\n\n return (\n <div ref={warp} className={`${prefixCls}-aree ${className || ''}`} onScroll={onScroll}>\n <div className={`${prefixCls}-text`}>\n {renderTextarea ? (\n React.cloneElement(\n renderTextarea(\n {\n ...otherProps,\n value: markdown,\n autoComplete: 'off',\n autoCorrect: 'off',\n spellCheck: 'false',\n autoCapitalize: 'off',\n className: `${prefixCls}-text-input`,\n style: {\n WebkitTextFillColor: 'inherit',\n overflow: 'auto',\n },\n },\n {\n dispatch,\n onChange: otherProps.onChange,\n shortcuts,\n useContext: { commands, extraCommands, commandOrchestrator: executeRef.current },\n },\n ),\n {\n ref: textRef,\n },\n )\n ) : (\n <Fragment>\n {highlightEnable && <Markdown prefixCls={prefixCls} />}\n <Textarea prefixCls={prefixCls} {...otherProps} style={textStyle} />\n </Fragment>\n )}\n </div>\n </div>\n );\n}\n"
52
52
  ],
53
- "mappings": ";;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;AAoCe,SAASA,QAAT,CAAkBC,KAAlB,EAAyC;EACtD,WAA0EA,KAAK,IAAI,EAAnF;EAAA,IAAQC,SAAR,QAAQA,SAAR;EAAA,IAAmBC,SAAnB,QAAmBA,SAAnB;EAAA,IAA8BC,QAA9B,QAA8BA,QAA9B;EAAA,IAAwCC,cAAxC,QAAwCA,cAAxC;EAAA,IAA2DC,UAA3D;;EACA,kBAAoF,IAAAC,iBAAA,EAA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AAG,EAAEZ,IAAK;IAAC,SAAS,YAAKjB,SAAS,mBAASC,SAAS,IAAI,EAAE,CAAG;IAAC,QAAQ,EAAEC,QAAS;IAAA,uBACpF;MAAK,SAAS,YAAKF,SAAS,UAAQ;MAAA,UACjCG,cAAc,gBACbW,iBAAK,CAACgB,YAAY,CAChB3B,cAAc,mEAEPC,UAAU;QACb2B,KAAK,EAAExB,QAAQ;QACfyB,YAAY,EAAE,KAAK;QACnBC,WAAW,EAAE,KAAK;QAClBC,UAAU,EAAE,OAAO;QACnBC,cAAc,EAAE,KAAK;QACrBlC,SAAS,YAAKD,SAAS,gBAAa;QACpCoC,KAAK,EAAE;UACLR,mBAAmB,EAAE,SAAS;UAC9BC,QAAQ,EAAE;QACZ;MAAC,IAEH;QACEjB,QAAQ,EAARA,QAAQ;QACRyB,QAAQ,EAAEjC,UAAU,CAACiC,QAAQ;QAC7BC,SAAS,EAATA,qBAAS;QACTjC,UAAU,EAAE;UAAEI,QAAQ,EAARA,QAAQ;UAAEE,aAAa,EAAbA,aAAa;UAAEa,mBAAmB,EAAER,UAAU,CAACK;QAAQ;MACjF,CAAC,CACF,EACD;QACEkB,GAAG,EAAE1B;MACP,CAAC,CACF,gBAED,sBAAC,eAAQ;QAAA,WACNH,eAAe,iBAAI,qBAAC,oBAAQ;UAAC,SAAS,EAAEV;QAAU,EAAG,eACtD,qBAAC,oBAAQ;UAAC,SAAS,EAAEA;QAAU,GAAKI,UAAU;UAAE,KAAK,EAAEuB;QAAU,GAAG;MAAA;IAEvE;EACG,EACF;AAEV;AAAC"
54
54
  }
@@ -1,14 +1,11 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports["default"] = shortcutsHandle;
9
-
10
8
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
-
12
9
  function getCommands() {
13
10
  var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
14
11
  var resulte = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
@@ -21,7 +18,6 @@ function getCommands() {
21
18
  });
22
19
  return resulte;
23
20
  }
24
-
25
21
  function shortcutsHandle(e) {
26
22
  var commands = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
27
23
  var commandOrchestrator = arguments.length > 2 ? arguments[2] : undefined;
@@ -29,35 +25,27 @@ function shortcutsHandle(e) {
29
25
  var state = arguments.length > 4 ? arguments[4] : undefined;
30
26
  var data = getCommands(commands || []);
31
27
  var shortcuts = [];
32
-
33
28
  if (e.altKey) {
34
29
  shortcuts.push('alt');
35
30
  }
36
-
37
31
  if (e.shiftKey) {
38
32
  shortcuts.push('shift');
39
33
  }
40
-
41
34
  if (e.metaKey) {
42
35
  shortcuts.push('cmd');
43
36
  }
44
-
45
37
  if (e.ctrlKey) {
46
38
  shortcuts.push('ctrl');
47
39
  }
48
-
49
40
  if (shortcuts.length > 0 && !/(control|alt|meta|shift)/.test(e.key.toLocaleLowerCase())) {
50
41
  shortcuts.push(e.key.toLocaleLowerCase());
51
42
  }
52
-
53
43
  if (/escape/.test(e.key.toLocaleLowerCase())) {
54
44
  shortcuts.push('escape');
55
45
  }
56
-
57
46
  if (shortcuts.length < 1) {
58
47
  return;
59
48
  }
60
-
61
49
  var equal = !!data[shortcuts.join('+')];
62
50
  var command = equal ? data[shortcuts.join('+')] : undefined;
63
51
  Object.keys(data).forEach(function (item) {
@@ -65,22 +53,18 @@ function shortcutsHandle(e) {
65
53
  if (/ctrlcmd/.test(v)) {
66
54
  return shortcuts.includes('ctrl') || shortcuts.includes('cmd');
67
55
  }
68
-
69
56
  return shortcuts.includes(v);
70
57
  });
71
-
72
58
  if (isequal) {
73
59
  command = data[item];
74
60
  }
75
61
  });
76
-
77
62
  if (command && commandOrchestrator) {
78
63
  e.stopPropagation();
79
64
  e.preventDefault();
80
- commandOrchestrator.executeCommand(command, dispatch, state);
65
+ commandOrchestrator.executeCommand(command, dispatch, state, shortcuts);
81
66
  return;
82
67
  }
83
68
  }
84
-
85
69
  module.exports = exports.default;
86
70
  //# sourceMappingURL=shortcuts.js.map
@@ -46,7 +46,7 @@
46
46
  "../../../src/components/TextArea/shortcuts.ts"
47
47
  ],
48
48
  "sourcesContent": [
49
- "import { ICommand, TextAreaCommandOrchestrator } from '../../commands';\nimport { ContextStore, ExecuteCommandState } from '../../Context';\n\nfunction getCommands(data: ICommand[] = [], resulte: Record<string, ICommand> = {}): Record<string, ICommand> {\n data.forEach((item) => {\n if (item.children && Array.isArray(item.children)) {\n resulte = { ...resulte, ...getCommands(item.children || []) };\n } else if (item.keyCommand && item.shortcuts && item.execute) {\n resulte[item.shortcuts.toLocaleLowerCase()] = item;\n }\n });\n return resulte;\n}\n\nexport default function shortcutsHandle(\n e: KeyboardEvent | React.KeyboardEvent<HTMLTextAreaElement>,\n commands: ICommand[] = [],\n commandOrchestrator?: TextAreaCommandOrchestrator,\n dispatch?: React.Dispatch<ContextStore>,\n state?: ExecuteCommandState,\n) {\n const data = getCommands(commands || []);\n const shortcuts: (string | number)[] = [];\n if (e.altKey) {\n shortcuts.push('alt');\n }\n if (e.shiftKey) {\n shortcuts.push('shift');\n }\n if (e.metaKey) {\n shortcuts.push('cmd');\n }\n if (e.ctrlKey) {\n shortcuts.push('ctrl');\n }\n if (shortcuts.length > 0 && !/(control|alt|meta|shift)/.test(e.key.toLocaleLowerCase())) {\n shortcuts.push(e.key.toLocaleLowerCase());\n }\n if (/escape/.test(e.key.toLocaleLowerCase())) {\n shortcuts.push('escape');\n }\n if (shortcuts.length < 1) {\n return;\n }\n\n let equal = !!data[shortcuts.join('+')];\n let command = equal ? data[shortcuts.join('+')] : undefined;\n\n Object.keys(data).forEach((item) => {\n const isequal = item.split('+').every((v) => {\n if (/ctrlcmd/.test(v)) {\n return shortcuts.includes('ctrl') || shortcuts.includes('cmd');\n }\n return shortcuts.includes(v);\n });\n if (isequal) {\n command = data[item];\n }\n });\n if (command && commandOrchestrator) {\n e.stopPropagation();\n e.preventDefault();\n commandOrchestrator.executeCommand(command, dispatch, state);\n return;\n }\n}\n"
49
+ "import { ICommand, TextAreaCommandOrchestrator } from '../../commands';\nimport { ContextStore, ExecuteCommandState } from '../../Context';\n\nfunction getCommands(data: ICommand[] = [], resulte: Record<string, ICommand> = {}): Record<string, ICommand> {\n data.forEach((item) => {\n if (item.children && Array.isArray(item.children)) {\n resulte = { ...resulte, ...getCommands(item.children || []) };\n } else if (item.keyCommand && item.shortcuts && item.execute) {\n resulte[item.shortcuts.toLocaleLowerCase()] = item;\n }\n });\n return resulte;\n}\n\nexport default function shortcutsHandle(\n e: KeyboardEvent | React.KeyboardEvent<HTMLTextAreaElement>,\n commands: ICommand[] = [],\n commandOrchestrator?: TextAreaCommandOrchestrator,\n dispatch?: React.Dispatch<ContextStore>,\n state?: ExecuteCommandState,\n) {\n const data = getCommands(commands || []);\n const shortcuts: string[] = [];\n if (e.altKey) {\n shortcuts.push('alt');\n }\n if (e.shiftKey) {\n shortcuts.push('shift');\n }\n if (e.metaKey) {\n shortcuts.push('cmd');\n }\n if (e.ctrlKey) {\n shortcuts.push('ctrl');\n }\n if (shortcuts.length > 0 && !/(control|alt|meta|shift)/.test(e.key.toLocaleLowerCase())) {\n shortcuts.push(e.key.toLocaleLowerCase());\n }\n if (/escape/.test(e.key.toLocaleLowerCase())) {\n shortcuts.push('escape');\n }\n if (shortcuts.length < 1) {\n return;\n }\n\n let equal = !!data[shortcuts.join('+')];\n let command = equal ? data[shortcuts.join('+')] : undefined;\n\n Object.keys(data).forEach((item) => {\n const isequal = item.split('+').every((v) => {\n if (/ctrlcmd/.test(v)) {\n return shortcuts.includes('ctrl') || shortcuts.includes('cmd');\n }\n return shortcuts.includes(v);\n });\n if (isequal) {\n command = data[item];\n }\n });\n if (command && commandOrchestrator) {\n e.stopPropagation();\n e.preventDefault();\n commandOrchestrator.executeCommand(command, dispatch, state,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AEC,KAAK,EAAER,SAAS,CAAC;IACvE;EACF;AACF;AAAC"
52
52
  }
@@ -1,35 +1,25 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];
4
-
5
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
6
-
7
5
  Object.defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
10
8
  exports["default"] = Child;
11
-
12
9
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
13
-
14
10
  var _react = _interopRequireWildcard(require("react"));
15
-
16
11
  var _ = _interopRequireDefault(require("./"));
17
-
18
12
  var _Context = require("../../Context");
19
-
20
13
  var _jsxRuntime = require("react/jsx-runtime");
21
-
22
14
  function Child(props) {
23
15
  var _ref = props || {},
24
- prefixCls = _ref.prefixCls,
25
- groupName = _ref.groupName,
26
- commands = _ref.commands,
27
- children = _ref.children;
28
-
16
+ prefixCls = _ref.prefixCls,
17
+ groupName = _ref.groupName,
18
+ commands = _ref.commands,
19
+ children = _ref.children;
29
20
  var _useContext = (0, _react.useContext)(_Context.EditorContext),
30
- _useContext$barPopup = _useContext.barPopup,
31
- barPopup = _useContext$barPopup === void 0 ? {} : _useContext$barPopup;
32
-
21
+ _useContext$barPopup = _useContext.barPopup,
22
+ barPopup = _useContext$barPopup === void 0 ? {} : _useContext$barPopup;
33
23
  return (0, _react.useMemo)(function () {
34
24
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
35
25
  className: "".concat(prefixCls, "-toolbar-child ").concat(groupName && barPopup[groupName] ? 'active' : ''),
@@ -42,9 +32,9 @@ function Child(props) {
42
32
  isChild: true
43
33
  })) : children
44
34
  });
45
- }, // eslint-disable-next-line react-hooks/exhaustive-deps
35
+ },
36
+ // eslint-disable-next-line react-hooks/exhaustive-deps
46
37
  [commands, barPopup, groupName, prefixCls]);
47
38
  }
48
-
49
39
  module.exports = exports.default;
50
40
  //# sourceMappingURL=Child.js.map
@@ -22,5 +22,5 @@
22
22
  "sourcesContent": [
23
23
  "import React, { useContext, useMemo } from 'react';\nimport './Child.less';\nimport Toolbar, { IToolbarProps } from './';\nimport { EditorContext } from '../../Context';\n\nexport type ChildProps = IToolbarProps & {\n children?: JSX.Element;\n groupName?: string;\n};\n\nexport default function Child(props: ChildProps) {\n const { prefixCls, groupName, commands, children } = props || {};\n const { barPopup = {} } = useContext(EditorContext);\n return useMemo(\n () => (\n <div\n className={`${prefixCls}-toolbar-child ${groupName && barPopup[groupName] ? 'active' : ''}`}\n onClick={(e) => e.stopPropagation()}\n >\n {Array.isArray(commands) ? <Toolbar commands={commands} {...props} isChild /> : children}\n </div>\n ),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [commands, barPopup, groupName, prefixCls],\n );\n}\n"
24
24
  ],
25
- "mappings": ";;;;;;;;;;;;;AAAA;;AAEA;;AACA;;;;AAOe,SAASA,KAAT,CAAeC,KAAf,EAAkC;EAC/C,WAAqDA,KAAK,IAAI,EAA9D;EAAA,IAAQC,SAAR,QAAQA,SAAR;EAAA,IAAmBC,SAAnB,QAAmBA,SAAnB;EAAA,IAA8BC,QAA9B,QAA8BA,QAA9B;EAAA,IAAwCC,QAAxC,QAAwCA,QAAxC;;EACA,kBAA0B,IAAAC,iBAAA,EAAWC,sBAAX,CAA1B;EAAA,uCAAQC,QAAR;EAAA,IAAQA,QAAR,qCAAmB,EAAnB;;EACA,OAAO,IAAAC,cAAA,EACL;IAAA,oBACE;MACE,SAAS,YAAKP,SAAL,4BAAgCC,SAAS,IAAIK,QAAQ,CAACL,SAAD,CAArB,GAAmC,QAAnC,GAA8C,EAA9E,CADX;MAEE,OAAO,EAAE,iBAACO,CAAD;QAAA,OAAOA,CAAC,CAACC,eAAF,EAAP;MAAA,CAFX;MAAA,UAIGC,KAAK,CAACC,OAAN,CAAcT,QAAd,iBAA0B,qBAAC,YAAD;QAAS,QAAQ,EAAEA;MAAnB,GAAiCH,KAAjC;QAAwC,OAAO;MAA/C,GAA1B,GAA+EI;IAJlF,EADF;EAAA,CADK,EASL;EACA,CAACD,QAAD,EAAWI,QAAX,EAAqBL,SAArB,EAAgCD,SAAhC,CAVK,CAAP;AAYD"
25
+ "mappings": ";;;;;;;;;AAAA;AAEA;AACA;AAA8C;AAO/B,SAASA,KAAK,CAACC,KAAiB,EAAE;EAC/C,WAAqDA,KAAK,IAAI,CAAC,CAAC;IAAxDC,SAAS,QAATA,SAAS;IAAEC,SAAS,QAATA,SAAS;IAAEC,QAAQ,QAARA,QAAQ;IAAEC,QAAQ,QAARA,QAAQ;EAChD,kBAA0B,IAAAC,iBAAU,EAACC,sBAAa,CAAC;IAAA,mCAA3CC,QAAQ;IAARA,QAAQ,qCAAG,CAAC,CAAC;EACrB,OAAO,IAAAC,cAAO,EACZ;IAAA,oBACE;MACE,SAAS,YAAKP,SAAS,4BAAkBC,SAAS,IAAIK,QAAQ,CAACL,SAAS,CAAC,GAAG,QAAQ,GAAG,EAAE,CAAG;MAC5F,OAAO,EAAE,iBAACO,CAAC;QAAA,OAAKA,CAAC,CAACC,eAAe,EAAE;MAAA,CAAC;MAAA,UAEnCC,KAAK,CAACC,OAAO,CAACT,QAAQ,CAAC,gBAAG,qBAAC,YAAO;QAAC,QAAQ,EAAEA;MAAS,GAAKH,KAAK;QAAE,OAAO;MAAA,GAAG,GAAGI;IAAQ,EACpF;EAAA,CACP;EACD;EACA,CAACD,QAAQ,EAAEI,QAAQ,EAAEL,SAAS,EAAED,SAAS,CAAC,CAC3C;AACH;AAAC"
26
26
  }
@@ -1,54 +1,40 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];
4
-
5
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
6
-
7
5
  Object.defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
10
8
  exports.ToolbarItems = ToolbarItems;
11
9
  exports["default"] = Toolbar;
12
-
13
10
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
14
-
15
11
  var _react = _interopRequireWildcard(require("react"));
16
-
17
12
  var _Context = require("../../Context");
18
-
19
13
  var _Child = _interopRequireDefault(require("./Child"));
20
-
21
14
  var _jsxRuntime = require("react/jsx-runtime");
22
-
23
15
  function ToolbarItems(props) {
24
16
  var prefixCls = props.prefixCls,
25
- overflow = props.overflow;
26
-
17
+ overflow = props.overflow;
27
18
  var _useContext = (0, _react.useContext)(_Context.EditorContext),
28
- fullscreen = _useContext.fullscreen,
29
- preview = _useContext.preview,
30
- _useContext$barPopup = _useContext.barPopup,
31
- barPopup = _useContext$barPopup === void 0 ? {} : _useContext$barPopup,
32
- components = _useContext.components,
33
- commandOrchestrator = _useContext.commandOrchestrator,
34
- dispatch = _useContext.dispatch;
35
-
19
+ fullscreen = _useContext.fullscreen,
20
+ preview = _useContext.preview,
21
+ _useContext$barPopup = _useContext.barPopup,
22
+ barPopup = _useContext$barPopup === void 0 ? {} : _useContext$barPopup,
23
+ components = _useContext.components,
24
+ commandOrchestrator = _useContext.commandOrchestrator,
25
+ dispatch = _useContext.dispatch;
36
26
  var originalOverflow = (0, _react.useRef)('');
37
-
38
27
  function handleClick(command, name) {
39
28
  if (!dispatch) return;
40
29
  var state = {
41
30
  barPopup: (0, _objectSpread2["default"])({}, barPopup)
42
31
  };
43
-
44
32
  if (command.keyCommand === 'preview') {
45
33
  state.preview = command.value;
46
34
  }
47
-
48
35
  if (command.keyCommand === 'fullscreen') {
49
36
  state.fullscreen = !fullscreen;
50
37
  }
51
-
52
38
  if (props.commands && command.keyCommand === 'group') {
53
39
  props.commands.forEach(function (item) {
54
40
  if (name === item.groupName) {
@@ -62,14 +48,11 @@ function ToolbarItems(props) {
62
48
  state.barPopup[keyName] = false;
63
49
  });
64
50
  }
65
-
66
51
  if (Object.keys(state).length) {
67
52
  dispatch((0, _objectSpread2["default"])({}, state));
68
53
  }
69
-
70
54
  commandOrchestrator && commandOrchestrator.executeCommand(command);
71
55
  }
72
-
73
56
  (0, _react.useEffect)(function () {
74
57
  if (document && overflow) {
75
58
  if (fullscreen) {
@@ -79,9 +62,8 @@ function ToolbarItems(props) {
79
62
  // get the original overflow only the first time
80
63
  if (!originalOverflow.current) {
81
64
  originalOverflow.current = window.getComputedStyle(document.body, null).overflow;
82
- } // reset to the original overflow
83
-
84
-
65
+ }
66
+ // reset to the original overflow
85
67
  document.body.style.overflow = originalOverflow.current;
86
68
  }
87
69
  }
@@ -93,7 +75,6 @@ function ToolbarItems(props) {
93
75
  className: "".concat(prefixCls, "-toolbar-divider")
94
76
  }), idx);
95
77
  }
96
-
97
78
  if (!item.keyCommand) return /*#__PURE__*/(0, _jsxRuntime.jsx)(_react.Fragment, {}, idx);
98
79
  var activeBtn = fullscreen && item.keyCommand === 'fullscreen' || item.keyCommand === 'preview' && preview === item.value;
99
80
  var childNode = item.children && typeof item.children === 'function' ? item.children({
@@ -136,17 +117,14 @@ function ToolbarItems(props) {
136
117
  })
137
118
  });
138
119
  }
139
-
140
120
  function Toolbar() {
141
121
  var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
142
122
  var prefixCls = props.prefixCls,
143
- toolbarBottom = props.toolbarBottom,
144
- isChild = props.isChild;
145
-
123
+ toolbarBottom = props.toolbarBottom,
124
+ isChild = props.isChild;
146
125
  var _useContext2 = (0, _react.useContext)(_Context.EditorContext),
147
- commands = _useContext2.commands,
148
- extraCommands = _useContext2.extraCommands;
149
-
126
+ commands = _useContext2.commands,
127
+ extraCommands = _useContext2.extraCommands;
150
128
  var bottomClassName = toolbarBottom ? 'bottom' : '';
151
129
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
152
130
  className: "".concat(prefixCls, "-toolbar ").concat(bottomClassName),
@@ -78,5 +78,5 @@
78
78
  "sourcesContent": [
79
79
  "import React, { Fragment, useContext, useEffect, useRef } from 'react';\nimport { IProps } from '../../Editor';\nimport { EditorContext, PreviewType, ContextStore } from '../../Context';\nimport { ICommand } from '../../commands';\nimport Child from './Child';\nimport './index.less';\n\nexport interface IToolbarProps extends IProps {\n overflow?: boolean;\n toolbarBottom?: boolean;\n onCommand?: (command: ICommand<string>, groupName?: string) => void;\n commands?: ICommand<string>[];\n isChild?: boolean;\n}\n\nexport function ToolbarItems(props: IToolbarProps) {\n const { prefixCls, overflow } = props;\n const { fullscreen, preview, barPopup = {}, components, commandOrchestrator, dispatch } = useContext(EditorContext);\n const originalOverflow = useRef('');\n\n function handleClick(command: ICommand<string>, name?: string) {\n if (!dispatch) return;\n const state: ContextStore = { barPopup: { ...barPopup } };\n if (command.keyCommand === 'preview') {\n state.preview = command.value as PreviewType;\n }\n if (command.keyCommand === 'fullscreen') {\n state.fullscreen = !fullscreen;\n }\n if (props.commands && command.keyCommand === 'group') {\n props.commands.forEach((item) => {\n if (name === item.groupName) {\n state.barPopup![name!] = true;\n } else if (item.keyCommand) {\n state.barPopup![item.groupName!] = false;\n }\n });\n } else if (name || command.parent) {\n Object.keys(state.barPopup || {}).forEach((keyName) => {\n state.barPopup![keyName] = false;\n });\n }\n\n if (Object.keys(state).length) {\n dispatch({ ...state });\n }\n commandOrchestrator && commandOrchestrator.executeCommand(command);\n }\n\n useEffect(() => {\n if (document && overflow) {\n if (fullscreen) {\n // prevent scroll on fullscreen\n document.body.style.overflow = 'hidden';\n } else {\n // get the original overflow only the first time\n if (!originalOverflow.current) {\n originalOverflow.current = window.getComputedStyle(document.body, null).overflow;\n }\n // reset to the original overflow\n document.body.style.overflow = originalOverflow.current;\n }\n }\n }, [fullscreen, originalOverflow, overflow]);\n\n return (\n <ul>\n {(props.commands || []).map((item, idx) => {\n if (item.keyCommand === 'divider') {\n return <li key={idx} {...item.liProps} className={`${prefixCls}-toolbar-divider`} />;\n }\n if (!item.keyCommand) return <Fragment key={idx} />;\n const activeBtn =\n (fullscreen && item.keyCommand === 'fullscreen') || (item.keyCommand === 'preview' && preview === item.value);\n const childNode =\n item.children && typeof item.children === 'function'\n ? item.children({\n getState: () => commandOrchestrator!.getState(),\n textApi: commandOrchestrator ? commandOrchestrator!.textApi : undefined,\n close: () => handleClick({}, item.groupName),\n execute: () => handleClick({ execute: item.execute }),\n })\n : undefined;\n const disabled = barPopup && preview && preview === 'preview' && !/(preview|fullscreen)/.test(item.keyCommand);\n const render = components?.toolbar || item.render;\n const com = (\n render && typeof render === 'function' ? render(item, !!disabled, handleClick, idx) : null\n ) as React.ReactElement;\n return (\n <li key={idx} {...item.liProps} className={activeBtn ? `active` : ''}>\n {com && React.isValidElement(com) && com}\n {!com && !item.buttonProps && item.icon}\n {!com &&\n item.buttonProps &&\n React.createElement(\n 'button',\n {\n type: 'button',\n key: idx,\n disabled,\n 'data-name': item.name,\n ...item.buttonProps,\n onClick: (evn: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {\n evn.stopPropagation();\n handleClick(item, item.groupName);\n },\n },\n item.icon,\n )}\n {item.children && (\n <Child\n overflow={overflow}\n groupName={item.groupName}\n prefixCls={prefixCls}\n children={childNode}\n commands={Array.isArray(item.children) ? item.children : undefined}\n />\n )}\n </li>\n );\n })}\n </ul>\n );\n}\n\nexport default function Toolbar(props: IToolbarProps = {}) {\n const { prefixCls, toolbarBottom, isChild } = props;\n const { commands, extraCommands } = useContext(EditorContext);\n const bottomClassName = toolbarBottom ? 'bottom' : '';\n return (\n <div className={`${prefixCls}-toolbar ${bottomClassName}`}>\n <ToolbarItems {...props} commands={props.commands || commands || []} />\n {!isChild && <ToolbarItems {...props} commands={extraCommands || []} />}\n </div>\n );\n}\n"
80
80
  ],
81
- "mappings": ";;;;;;;;;;;;;;AAAA;;AAEA;;AAEA;;;;AAWO,SAASA,YAAT,CAAsBC,KAAtB,EAA4C;EACjD,IAAQC,SAAR,GAAgCD,KAAhC,CAAQC,SAAR;EAAA,IAAmBC,QAAnB,GAAgCF,KAAhC,CAAmBE,QAAnB;;EACA,kBAA0F,IAAAC,iBAAA,EAAWC,sBAAX,CAA1F;EAAA,IA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E,KAAoB,uEAAG,CAAC,CAAC;EACvD,IAAQC,SAAS,GAA6BD,KAAK,CAA3CC,SAAS;IAAEgE,aAAa,GAAcjE,KAAK,CAAhCiE,aAAa;IAAEC,OAAO,GAAKlE,KAAK,CAAjBkE,OAAO;EACzC,mBAAoC,IAAA/D,iBAAU,EAACC,sBAAa,CAAC;IAArDe,QAAQ,gBAARA,QAAQ;IAAEgD,aAAa,gBAAbA,aAAa;EAC/B,IAAMC,eAAe,GAAGH,aAAa,GAAG,QAAQ,GAAG,EAAE;EACrD,oBACE;IAAK,SAAS,YAAKhE,SAAS,sBAAYmE,eAAe,CAAG;IAAA,wBACxD,qBAAC,YAAY,oEAAKpE,KAAK;MAAE,QAAQ,EAAEA,KAAK,CAACmB,QAAQ,IAAIA,QAAQ,IAAI;IAAG,GAAG,EACtE,CAAC+C,OAAO,iBAAI,qBAAC,YAAY,oEAAKlE,KAAK;MAAE,QAAQ,EAAEmE,aAAa,IAAI;IAAG,GAAG;EAAA,EACnE;AAEV"
82
82
  }
package/lib/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
@@ -10,9 +9,7 @@ var _exportNames = {
10
9
  MarkdownUtil: true
11
10
  };
12
11
  exports["default"] = exports.commands = exports.MarkdownUtil = void 0;
13
-
14
12
  var _Editor = _interopRequireWildcard(require("./Editor"));
15
-
16
13
  Object.keys(_Editor).forEach(function (key) {
17
14
  if (key === "default" || key === "__esModule") return;
18
15
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -24,9 +21,7 @@ Object.keys(_Editor).forEach(function (key) {
24
21
  }
25
22
  });
26
23
  });
27
-
28
24
  var commands = _interopRequireWildcard(require("./commands"));
29
-
30
25
  exports.commands = commands;
31
26
  Object.keys(commands).forEach(function (key) {
32
27
  if (key === "default" || key === "__esModule") return;
@@ -39,9 +34,7 @@ Object.keys(commands).forEach(function (key) {
39
34
  }
40
35
  });
41
36
  });
42
-
43
37
  var MarkdownUtil = _interopRequireWildcard(require("./utils/markdownUtils"));
44
-
45
38
  exports.MarkdownUtil = MarkdownUtil;
46
39
  Object.keys(MarkdownUtil).forEach(function (key) {
47
40
  if (key === "default" || key === "__esModule") return;
@@ -54,9 +47,7 @@ Object.keys(MarkdownUtil).forEach(function (key) {
54
47
  }
55
48
  });
56
49
  });
57
-
58
50
  var _Context = require("./Context");
59
-
60
51
  Object.keys(_Context).forEach(function (key) {
61
52
  if (key === "default" || key === "__esModule") return;
62
53
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
package/lib/index.js.map CHANGED
@@ -9,5 +9,5 @@
9
9
  "sourcesContent": [
10
10
  "import MDEditor from './Editor';\nimport * as commands from './commands';\nimport * as MarkdownUtil from './utils/markdownUtils';\n\nexport * from './commands';\nexport * from './utils/markdownUtils';\nexport * from './Editor';\nexport * from './Context';\n\nexport { MarkdownUtil, commands };\n\nexport default MDEditor;\n"
11
11
  ],
12
- "mappings": ";;;;;;;;;;;;;AAAA;;AAMA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AALA;;;AAGA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AAFA;;;AAGA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AAEA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;eAIeA,kB"
12
+ "mappings": ";;;;;;;;;;;AAAA;AAMA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AALA;AAAuC;AAGvC;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AAFA;AAAsD;AAGtD;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AAEA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AAA0B,eAIXA,kBAAQ;AAAA"
13
13
  }