@uiw/react-md-editor 4.0.6 → 4.0.8

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 (69) hide show
  1. package/README.md +83 -2
  2. package/commands.d.ts +14 -7
  3. package/dist/mdeditor.js +61 -17
  4. package/dist/mdeditor.min.js +1 -1
  5. package/esm/Context.d.ts +2 -0
  6. package/esm/Editor.js +5 -1
  7. package/esm/Editor.nohighlight.js +5 -1
  8. package/esm/Types.d.ts +6 -2
  9. package/esm/commands/index.cn.js +4 -4
  10. package/esm/commands/index.d.ts +8 -8
  11. package/esm/commands/index.js +8 -8
  12. package/esm/commands/title.d.ts +7 -1
  13. package/esm/commands/title.js +11 -4
  14. package/esm/commands/title1.d.ts +6 -0
  15. package/esm/commands/title1.js +16 -9
  16. package/esm/commands/title2.d.ts +6 -0
  17. package/esm/commands/title2.js +16 -9
  18. package/esm/commands/title3.d.ts +6 -0
  19. package/esm/commands/title3.js +16 -9
  20. package/esm/commands/title4.d.ts +6 -0
  21. package/esm/commands/title4.js +16 -9
  22. package/esm/commands/title5.d.ts +6 -0
  23. package/esm/commands/title5.js +16 -9
  24. package/esm/commands/title6.d.ts +6 -0
  25. package/esm/commands/title6.js +16 -9
  26. package/esm/components/TextArea/Textarea.js +18 -1
  27. package/esm/index.d.ts +1 -0
  28. package/esm/index.js +1 -0
  29. package/lib/Context.d.ts +2 -0
  30. package/lib/Editor.js +8 -1
  31. package/lib/Editor.nohighlight.js +8 -1
  32. package/lib/Types.d.ts +6 -2
  33. package/lib/commands/index.cn.js +4 -4
  34. package/lib/commands/index.d.ts +8 -8
  35. package/lib/commands/index.js +42 -0
  36. package/lib/commands/title.d.ts +7 -1
  37. package/lib/commands/title.js +12 -4
  38. package/lib/commands/title1.d.ts +6 -0
  39. package/lib/commands/title1.js +16 -9
  40. package/lib/commands/title2.d.ts +6 -0
  41. package/lib/commands/title2.js +16 -9
  42. package/lib/commands/title3.d.ts +6 -0
  43. package/lib/commands/title3.js +16 -9
  44. package/lib/commands/title4.d.ts +6 -0
  45. package/lib/commands/title4.js +16 -9
  46. package/lib/commands/title5.d.ts +6 -0
  47. package/lib/commands/title5.js +16 -9
  48. package/lib/commands/title6.d.ts +6 -0
  49. package/lib/commands/title6.js +16 -9
  50. package/lib/components/TextArea/Textarea.js +18 -1
  51. package/lib/index.d.ts +1 -0
  52. package/lib/index.js +9 -1
  53. package/nohighlight.d.ts +2 -0
  54. package/package.json +1 -1
  55. package/src/Context.tsx +1 -0
  56. package/src/Editor.nohighlight.tsx +2 -0
  57. package/src/Editor.tsx +2 -0
  58. package/src/Types.ts +6 -2
  59. package/src/commands/index.cn.ts +3 -3
  60. package/src/commands/index.ts +14 -7
  61. package/src/commands/title.tsx +11 -4
  62. package/src/commands/title1.tsx +14 -7
  63. package/src/commands/title2.tsx +14 -7
  64. package/src/commands/title3.tsx +14 -7
  65. package/src/commands/title4.tsx +14 -7
  66. package/src/commands/title5.tsx +14 -7
  67. package/src/commands/title6.tsx +14 -7
  68. package/src/components/TextArea/Textarea.tsx +18 -0
  69. package/src/index.tsx +1 -0
package/README.md CHANGED
@@ -1,3 +1,37 @@
1
+ <div markdown="1">
2
+ <sup>Using <a href="https://wangchujiang.com/#/app" target="_blank">my app</a> is also a way to <a href="https://wangchujiang.com/#/sponsor" target="_blank">support</a> me:</sup>
3
+ <br>
4
+ <a target="_blank" href="https://apps.apple.com/app/Vidwall/6747587746" title="Vidwall for macOS"><img align="center" alt="Vidwall" height="52" width="52" src="https://github.com/user-attachments/assets/7b5df70a-ed91-4d4b-85be-f00e60a09ce9"></a>
5
+ <a target="_blank" href="https://wangchujiang.com/mousio-hint/" title="Mousio Hint for macOS"><img align="center" alt="Mousio Hint" height="52" width="52" src="https://github.com/user-attachments/assets/3c0af128-0cef-44e5-a8db-4741dc5a6690"></a>
6
+ <a target="_blank" href="https://apps.apple.com/app/6746747327" title="Mousio for macOS"><img align="center" alt="Mousio" height="52" width="52" src="https://github.com/user-attachments/assets/9edf61ff-5a6c-4676-9cc2-8fd3c1ad0dfb"></a>
7
+ <a target="_blank" href="https://apps.apple.com/app/6745227444" title="Musicer for macOS"><img align="center" alt="Musicer" height="52" width="52" src="https://github.com/user-attachments/assets/b7abfba8-88ff-4c86-a125-43073d5aef22"></a>
8
+ <a target="_blank" href="https://apps.apple.com/app/6743841447" title="Audioer for macOS"><img align="center" alt="Audioer" height="52" width="52" src="https://github.com/user-attachments/assets/7a836865-8c90-4119-87bc-19e06a76c957"></a>
9
+ <a target="_blank" href="https://apps.apple.com/app/6744690194" title="FileSentinel for macOS"><img align="center" alt="FileSentinel" height="52" width="52" src="https://github.com/user-attachments/assets/28bce2cc-290e-45bf-9068-585ff6ecafe9"></a>
10
+ <a target="_blank" href="https://apps.apple.com/app/6743495172" title="FocusCursor for macOS"><img align="center" alt="FocusCursor" height="52" width="52" src="https://github.com/user-attachments/assets/d543668a-737b-4853-a6bb-eaa269e69836"></a>
11
+ <a target="_blank" href="https://apps.apple.com/app/6742680573" title="Videoer for macOS"><img align="center" alt="Videoer" height="52" width="52" src="https://github.com/user-attachments/assets/10ffb0f1-0625-40d6-93f1-2c2496592595"></a>
12
+ <a target="_blank" href="https://apps.apple.com/app/6740425504" title="KeyClicker for macOS"><img align="center" alt="KeyClicker" height="52" width="52" src="https://github.com/user-attachments/assets/5a19fcb9-cb81-4855-b4ea-31c604d9612a"></a>
13
+ <a target="_blank" href="https://apps.apple.com/app/6739052447" title="DayBar for macOS"><img align="center" alt="DayBar" height="52" width="52" src="https://github.com/user-attachments/assets/771b608d-594c-492d-8532-d9231e383f5b"></a>
14
+ <a target="_blank" href="https://apps.apple.com/app/6739444407" title="Iconed for macOS"><img align="center" alt="Iconed" height="52" width="52" src="https://github.com/user-attachments/assets/8a35dc7b-4faf-4e2a-9311-f66d6844a896"></a>
15
+ <a target="_blank" href="https://apps.apple.com/app/6737160756" title="RightMenu Master for macOS"><img align="center" alt="RightMenu Master" height="52" width="52" src="https://github.com/user-attachments/assets/39a76541-71bf-4de7-a01c-c62f0557dff5"></a>
16
+ <a target="_blank" href="https://apps.apple.com/app/6723903021" title="Paste Quick for macOS"><img align="center" alt="Quick RSS" height="52" width="52" src="https://github.com/user-attachments/assets/bdaad5b7-9810-44ce-8f17-8410864465d2"></a>
17
+ <a target="_blank" href="https://apps.apple.com/app/6670696072" title="Quick RSS for macOS/iOS"><img align="center" alt="Quick RSS" height="52" width="52" src="https://github.com/user-attachments/assets/374106b5-a448-4d1d-9ccb-b04b6bc681ed"></a>
18
+ <a target="_blank" href="https://apps.apple.com/app/6670167443" title="Web Serve for macOS"><img align="center" alt="Web Serve" height="52" width="52" src="https://github.com/user-attachments/assets/e1d9f76f-0f3d-4ba5-8a15-253ee173bb1c"></a>
19
+ <a target="_blank" href="https://apps.apple.com/app/6503953628" title="Copybook Generator for macOS/iOS"><img align="center" alt="Copybook Generator" height="52" width="52" src="https://github.com/jaywcjlove/jaywcjlove/assets/1680273/b90e42ff-158b-4534-82ca-5898fd0e8d73"></a>
20
+ <a target="_blank" href="https://apps.apple.com/app/6471227008" title="DevTutor for macOS/iOS"><img align="center" alt="DevTutor for SwiftUI" height="52" width="52" src="https://github.com/jaywcjlove/jaywcjlove/assets/1680273/f15c154d-0192-48eb-8e0e-9e245ffd974a"></a>
21
+ <a target="_blank" href="https://apps.apple.com/app/6479819388" title="RegexMate for macOS/iOS"><img align="center" alt="RegexMate" height="52" width="52" src="https://github.com/jaywcjlove/jaywcjlove/assets/1680273/aabe5aa9-9a96-4390-8bed-c3e4023d0dea"></a>
22
+ <a target="_blank" href="https://apps.apple.com/app/6479194014" title="Time Passage for macOS/iOS"><img align="center" alt="Time Passage" height="52" width="52" src="https://github.com/jaywcjlove/time-passage/assets/1680273/6f30e429-e6f3-4dbe-9921-a5effe2a05e9"></a>
23
+ <a target="_blank" href="https://apps.apple.com/app/6478772538" title="IconizeFolder for macOS"><img align="center" alt="Iconize Folder" height="52" width="52" src="https://github.com/jaywcjlove/jaywcjlove/assets/1680273/fa9d8b9c-1e51-4ded-877c-fa5b21c47220"></a>
24
+ <a target="_blank" href="https://apps.apple.com/app/6478511402" title="Textsound Saver for macOS/iOS"><img align="center" alt="Textsound Saver" height="52" width="52" src="https://github.com/jaywcjlove/jaywcjlove/assets/1680273/0595e842-980b-4574-8891-a8ba853a08be"></a>
25
+ <a target="_blank" href="https://apps.apple.com/app/6476924627" title="Create Custom Symbols for macOS"><img align="center" alt="Create Custom Symbols" height="52" width="52" src="https://github.com/jaywcjlove/jaywcjlove/assets/1680273/8cd022ce-a3f1-4e89-b7c6-6fbd0d4db77c"></a>
26
+ <a target="_blank" href="https://apps.apple.com/app/6476452351" title="DevHub for macOS"><img align="center" alt="DevHub" height="52" width="52" src="https://github.com/user-attachments/assets/4a44a4fd-67ce-430b-af0a-72f18feaa47d"></a>
27
+ <a target="_blank" href="https://apps.apple.com/app/6476400184" title="Resume Revise for macOS"><img align="center" alt="Resume Revise" height="52" width="52" src="https://github.com/jaywcjlove/jaywcjlove/assets/1680273/c9954a20-1905-48de-bdf8-d71837974aa2"></a>
28
+ <a target="_blank" href="https://apps.apple.com/app/6472593276" title="Palette Genius for macOS"><img align="center" alt="Palette Genius" height="52" width="52" src="https://github.com/jaywcjlove/jaywcjlove/assets/1680273/27340413-d355-45b2-8f6f-6ac37682d957"></a>
29
+ <a target="_blank" href="https://apps.apple.com/app/6470879005" title="Symbol Scribe for macOS"><img align="center" alt="Symbol Scribe" height="52" width="52" src="https://github.com/jaywcjlove/jaywcjlove/assets/1680273/c7249f05-fa70-4def-a1e9-571d5f171fc9"></a>
30
+ <br><br>
31
+ </div>
32
+ <hr>
33
+
34
+
1
35
  <!--rehype:ignore:start-->
2
36
  <p align="center">
3
37
  <a href="https://uiwjs.github.io/npm-unpkg/#/pkg/@uiw/react-md-editor/file/README.md">
@@ -613,6 +647,51 @@ export default function App() {
613
647
  }
614
648
  ```
615
649
 
650
+ ### Place the cursor at the end of the text
651
+
652
+ ```jsx mdx:preview
653
+ import React from "react";
654
+ import MDEditor from '@uiw/react-md-editor';
655
+
656
+ const textSample = `# Welcome to the Markdown Editor!
657
+
658
+ This is a sample of the **React Markdown Editor**.
659
+
660
+ ## ✨ Features
661
+ - Real-time preview
662
+ - Custom styling support
663
+ - Code highlighting
664
+ - Auto focus at the end of the text
665
+
666
+ ## 📦 Sample Code
667
+
668
+ \`\`\`javascript
669
+ function hello() {
670
+ console.log("Hello, world!");
671
+ }
672
+ \`\`\`
673
+
674
+ ## 🔗 Links
675
+
676
+ Visit [uiwjs/react-md-editor](https://github.com/uiwjs/react-md-editor) for more information.
677
+ `;
678
+
679
+ export default function App() {
680
+ const [value, setValue] = React.useState(textSample);
681
+ return (
682
+ <div className="container">
683
+ <MDEditor
684
+ autoFocus={true}
685
+ value={value}
686
+ autoFocusEnd={true}
687
+ visibleDragbar={false}
688
+ onChange={setValue}
689
+ />
690
+ </div>
691
+ );
692
+ }
693
+ ```
694
+
616
695
  ### Preview Markdown
617
696
 
618
697
  [![Open in CodeSandbox](https://img.shields.io/badge/Open%20in-CodeSandbox-blue?logo=codesandbox)](https://codesandbox.io/embed/react-md-editor-preview-markdown-vrucl?fontsize=14&hidenavigation=1&theme=dark)
@@ -924,6 +1003,7 @@ Inherit custom color variables by adding [`.wmde-markdown-var`](https://github.c
924
1003
  - `commandsFilter?: (command: ICommand, isExtra: boolean) => false | ICommand`: Filter or modify your commands.
925
1004
  - `extraCommands?: ICommand[]`: Displayed on the right side of the toolbar.
926
1005
  - `autoFocus?: true`: Can be used to make `Markdown Editor` focus itself on initialization.
1006
+ - `autoFocusEnd?: false`: Can be used to make `Markdown Editor` focus on the end of text on initialization.
927
1007
  - `previewOptions?: ReactMarkdown.ReactMarkdownProps`: This is reset [@uiw/react-markdown-preview](https://github.com/uiwjs/react-markdown-preview/tree/0036dd51a25c00d5be6dc83aa978905c64750038?tab=readme-ov-file#options-props) settings.
928
1008
  - `textareaProps?: TextareaHTMLAttributes`: Set the `textarea` related props.
929
1009
  - ~~`renderTextarea?: (props, opts) => JSX.Element;`~~: `@deprecated` Please use ~~`renderTextarea`~~ -> `components`. Use div to replace TextArea or re-render TextArea. [#193](https://github.com/uiwjs/react-md-editor/issues/193)
@@ -984,8 +1064,8 @@ As always, thanks to our amazing contributors!
984
1064
  <!--AUTO_GENERATED_PLEASE_DONT_DELETE_IT--><a href="https://github.com/jaywcjlove" title="小弟调调"><img src="https://avatars.githubusercontent.com/u/1680273?v=4" width="42;" alt="小弟调调"/></a>
985
1065
  <a href="https://github.com/renovate-bot" title="Mend Renovate"><img src="https://avatars.githubusercontent.com/u/25180681?v=4" width="42;" alt="Mend Renovate"/></a>
986
1066
  <a href="https://github.com/stevemk14ebr" title="Stephen Eckels"><img src="https://avatars.githubusercontent.com/u/6619205?v=4" width="42;" alt="Stephen Eckels"/></a>
987
- <a href="https://github.com/alpharomercoma" title="Alpha Romer Coma"><img src="https://avatars.githubusercontent.com/u/108984668?v=4" width="42;" alt="Alpha Romer Coma"/></a>
988
1067
  <a href="https://github.com/RARgames" title="RAR"><img src="https://avatars.githubusercontent.com/u/13639766?v=4" width="42;" alt="RAR"/></a>
1068
+ <a href="https://github.com/alpharomercoma" title="Alpha Romer Coma"><img src="https://avatars.githubusercontent.com/u/108984668?v=4" width="42;" alt="Alpha Romer Coma"/></a>
989
1069
  <a href="https://github.com/Exmirai" title="UniqueUlysees"><img src="https://avatars.githubusercontent.com/u/6436703?v=4" width="42;" alt="UniqueUlysees"/></a>
990
1070
  <a href="https://github.com/sandiiarov" title="Alex Sandiiarov"><img src="https://avatars.githubusercontent.com/u/15861257?v=4" width="42;" alt="Alex Sandiiarov"/></a>
991
1071
  <a href="https://github.com/nuragic" title="Andrea Puddu"><img src="https://avatars.githubusercontent.com/u/1586378?v=4" width="42;" alt="Andrea Puddu"/></a>
@@ -1007,7 +1087,8 @@ As always, thanks to our amazing contributors!
1007
1087
  <a href="https://github.com/jmtes" title="juno tesoro"><img src="https://avatars.githubusercontent.com/u/38450133?v=4" width="42;" alt="juno tesoro"/></a>
1008
1088
  <a href="https://github.com/juspky" title="juspky"><img src="https://avatars.githubusercontent.com/u/11074890?v=4" width="42;" alt="juspky"/></a>
1009
1089
  <a href="https://github.com/ryicoh" title="ryicoh"><img src="https://avatars.githubusercontent.com/u/37844673?v=4" width="42;" alt="ryicoh"/></a>
1010
- <a href="https://github.com/wj0990" title="wangjie"><img src="https://avatars.githubusercontent.com/u/8792016?v=4" width="42;" alt="wangjie"/></a><!--AUTO_GENERATED_PLEASE_DONT_DELETE_IT-END-->
1090
+ <a href="https://github.com/wj0990" title="wangjie"><img src="https://avatars.githubusercontent.com/u/8792016?v=4" width="42;" alt="wangjie"/></a>
1091
+ <a href="https://github.com/xiaohuoni" title="聪小陈"><img src="https://avatars.githubusercontent.com/u/11746742?v=4" width="42;" alt="聪小陈"/></a><!--AUTO_GENERATED_PLEASE_DONT_DELETE_IT-END-->
1011
1092
 
1012
1093
  Made with [contributors](https://github.com/jaywcjlove/github-action-contributors).
1013
1094
 
package/commands.d.ts CHANGED
@@ -14,13 +14,13 @@ declare module '@uiw/react-md-editor/commands' {
14
14
  import { codeEdit, codeLive, codePreview } from '@uiw/react-md-editor/esm/commands/preview';
15
15
  import { quote } from '@uiw/react-md-editor/esm/commands/quote';
16
16
  import { strikethrough } from '@uiw/react-md-editor/esm/commands/strikeThrough';
17
- import { title } from '@uiw/react-md-editor/esm/commands/title';
18
- import { title1 } from '@uiw/react-md-editor/esm/commands/title1';
19
- import { title2 } from '@uiw/react-md-editor/esm/commands/title2';
20
- import { title3 } from '@uiw/react-md-editor/esm/commands/title3';
21
- import { title4 } from '@uiw/react-md-editor/esm/commands/title4';
22
- import { title5 } from '@uiw/react-md-editor/esm/commands/title5';
23
- import { title6 } from '@uiw/react-md-editor/esm/commands/title6';
17
+ import { title, heading } from '@uiw/react-md-editor/esm/commands/title';
18
+ import { title1, heading1 } from '@uiw/react-md-editor/esm/commands/title1';
19
+ import { title2, heading2 } from '@uiw/react-md-editor/esm/commands/title2';
20
+ import { title3, heading3 } from '@uiw/react-md-editor/esm/commands/title3';
21
+ import { title4, heading4 } from '@uiw/react-md-editor/esm/commands/title4';
22
+ import { title5, heading5 } from '@uiw/react-md-editor/esm/commands/title5';
23
+ import { title6, heading6 } from '@uiw/react-md-editor/esm/commands/title6';
24
24
  import { table } from '@uiw/react-md-editor/esm/commands/table';
25
25
  import { issue } from '@uiw/react-md-editor/esm/commands/issue';
26
26
  import { help } from '@uiw/react-md-editor/esm/commands/help';
@@ -117,6 +117,13 @@ declare module '@uiw/react-md-editor/commands' {
117
117
  title4,
118
118
  title5,
119
119
  title6,
120
+ heading,
121
+ heading1,
122
+ heading2,
123
+ heading3,
124
+ heading4,
125
+ heading5,
126
+ heading6,
120
127
  bold,
121
128
  codeBlock,
122
129
  comment,
package/dist/mdeditor.js CHANGED
@@ -78,7 +78,8 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__442__;
78
78
 
79
79
  if (true) {
80
80
  module.exports = __webpack_require__(192);
81
- } else {}
81
+ } else // removed by dead control flow
82
+ {}
82
83
 
83
84
 
84
85
  /***/ }),
@@ -819,6 +820,14 @@ __webpack_require__.d(__webpack_exports__, {
819
820
  getStateFromTextArea: () => (/* reexport */ getStateFromTextArea),
820
821
  getSurroundingWord: () => (/* reexport */ getSurroundingWord),
821
822
  group: () => (/* reexport */ group),
823
+ heading: () => (/* reexport */ title_heading),
824
+ heading1: () => (/* reexport */ heading1),
825
+ heading2: () => (/* reexport */ heading2),
826
+ heading3: () => (/* reexport */ heading3),
827
+ heading4: () => (/* reexport */ heading4),
828
+ heading5: () => (/* reexport */ heading5),
829
+ heading6: () => (/* reexport */ heading6),
830
+ headingExecute: () => (/* reexport */ headingExecute),
822
831
  help: () => (/* reexport */ help),
823
832
  hr: () => (/* reexport */ hr),
824
833
  image: () => (/* reexport */ commands_image_image),
@@ -931,6 +940,13 @@ __webpack_require__.d(commands_namespaceObject, {
931
940
  getExtraCommands: () => (getExtraCommands),
932
941
  getStateFromTextArea: () => (getStateFromTextArea),
933
942
  group: () => (group),
943
+ heading: () => (title_heading),
944
+ heading1: () => (heading1),
945
+ heading2: () => (heading2),
946
+ heading3: () => (heading3),
947
+ heading4: () => (heading4),
948
+ heading5: () => (heading5),
949
+ heading6: () => (heading6),
934
950
  help: () => (help),
935
951
  hr: () => (hr),
936
952
  image: () => (commands_image_image),
@@ -8878,7 +8894,7 @@ function isAlphanumerical(character) {
8878
8894
  ;// ../node_modules/decode-named-character-reference/index.dom.js
8879
8895
  /// <reference lib="dom" />
8880
8896
 
8881
- /* eslint-env browser */
8897
+ /* global document */
8882
8898
 
8883
8899
  const index_dom_element = document.createElement('i')
8884
8900
 
@@ -32364,7 +32380,7 @@ const html_html = create_create({
32364
32380
  formTarget: null,
32365
32381
  headers: types_spaceSeparated,
32366
32382
  height: types_number,
32367
- hidden: util_types_boolean,
32383
+ hidden: types_overloadedBoolean,
32368
32384
  high: types_number,
32369
32385
  href: null,
32370
32386
  hrefLang: null,
@@ -33587,8 +33603,7 @@ var selectors4SyntaxDefinition = extendSyntaxDefinition(selectors3SyntaxDefiniti
33587
33603
  },
33588
33604
  pseudoElements: {
33589
33605
  definitions: {
33590
- NoArgument: ['marker'],
33591
- Selector: ['part']
33606
+ NoArgument: ['marker']
33592
33607
  }
33593
33608
  }
33594
33609
  });
@@ -33673,7 +33688,7 @@ var cssModules = {
33673
33688
  latest: true,
33674
33689
  pseudoElements: {
33675
33690
  definitions: {
33676
- Selector: ['part']
33691
+ String: ['part']
33677
33692
  }
33678
33693
  }
33679
33694
  }
@@ -76208,6 +76223,7 @@ const remarkAlert = ({ legacyTitle = false, tagName = "div" } = {}) => {
76208
76223
  });
76209
76224
  };
76210
76225
  };
76226
+ /* harmony default export */ const remark_github_blockquote_alert_lib = ((/* unused pure expression or super */ null && (remarkAlert)));
76211
76227
  function getAlertIcon(type) {
76212
76228
  let pathD = pathData[type] ?? '';
76213
76229
  return {
@@ -80080,19 +80096,47 @@ var quote={name:'quote',keyCommand:'quote',shortcuts:'ctrlcmd+q',prefix:'> ',but
80080
80096
  ;// ./src/commands/strikeThrough.tsx
80081
80097
  var strikeThrough_strikethrough={name:'strikethrough',keyCommand:'strikethrough',shortcuts:'ctrl+shift+x',buttonProps:{'aria-label':'Add strikethrough text (ctrl + shift + x)',title:'Add strikethrough text (ctrl + shift + x)'},prefix:'~~',icon:/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{"data-name":"strikethrough",width:"12",height:"12",role:"img",viewBox:"0 0 512 512",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",d:"M496 288H16c-8.837 0-16-7.163-16-16v-32c0-8.837 7.163-16 16-16h480c8.837 0 16 7.163 16 16v32c0 8.837-7.163 16-16 16zm-214.666 16c27.258 12.937 46.524 28.683 46.524 56.243 0 33.108-28.977 53.676-75.621 53.676-32.325 0-76.874-12.08-76.874-44.271V368c0-8.837-7.164-16-16-16H113.75c-8.836 0-16 7.163-16 16v19.204c0 66.845 77.717 101.82 154.487 101.82 88.578 0 162.013-45.438 162.013-134.424 0-19.815-3.618-36.417-10.143-50.6H281.334zm-30.952-96c-32.422-13.505-56.836-28.946-56.836-59.683 0-33.92 30.901-47.406 64.962-47.406 42.647 0 64.962 16.593 64.962 32.985V136c0 8.837 7.164 16 16 16h45.613c8.836 0 16-7.163 16-16v-30.318c0-52.438-71.725-79.875-142.575-79.875-85.203 0-150.726 40.972-150.726 125.646 0 22.71 4.665 41.176 12.777 56.547h129.823z"})}),execute:function execute(state,api){var newSelectionRange=selectWord({text:state.text,selection:state.selection,prefix:state.command.prefix});var state1=api.setSelectionRange(newSelectionRange);executeCommand({api:api,selectedText:state1.selectedText,selection:state.selection,prefix:state.command.prefix});}};
80082
80098
  ;// ./src/commands/title1.tsx
80083
- var title1={name:'title1',keyCommand:'title1',shortcuts:'ctrlcmd+1',prefix:'# ',suffix:'',buttonProps:{'aria-label':'Insert title1 (ctrl + 1)',title:'Insert title1 (ctrl + 1)'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("div",{style:{fontSize:18,textAlign:'left'},children:"Title 1"}),execute:function execute(state,api){titleExecute({state:state,api:api,prefix:state.command.prefix,suffix:state.command.suffix});}};
80099
+ var heading1={name:'heading1',keyCommand:'heading1',shortcuts:'ctrlcmd+1',prefix:'# ',suffix:'',buttonProps:{'aria-label':'Insert Heading 1 (ctrl + 1)',title:'Insert Heading 1 (ctrl + 1)'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("div",{style:{fontSize:18,textAlign:'left'},children:"Heading 1"}),execute:function execute(state,api){headingExecute({state:state,api:api,prefix:state.command.prefix,suffix:state.command.suffix});}};/**
80100
+ * @deprecated Use `heading1` instead.
80101
+ * This command is now deprecated and will be removed in future versions.
80102
+ * Use `title1` for inserting Heading 1.
80103
+ */var title1=heading1;
80084
80104
  ;// ./src/commands/title.tsx
80085
- function titleExecute(_ref){var state=_ref.state,api=_ref.api,prefix=_ref.prefix,_ref$suffix=_ref.suffix,suffix=_ref$suffix===void 0?prefix:_ref$suffix;var newSelectionRange=selectLine({text:state.text,selection:state.selection});var state1=api.setSelectionRange(newSelectionRange);executeCommand({api:api,selectedText:state1.selectedText,selection:state.selection,prefix:prefix,suffix:suffix});}var title=_objectSpread2(_objectSpread2({},title1),{},{icon:/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 520 520",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",d:"M15.7083333,468 C7.03242448,468 0,462.030833 0,454.666667 L0,421.333333 C0,413.969167 7.03242448,408 15.7083333,408 L361.291667,408 C369.967576,408 377,413.969167 377,421.333333 L377,454.666667 C377,462.030833 369.967576,468 361.291667,468 L15.7083333,468 Z M21.6666667,366 C9.69989583,366 0,359.831861 0,352.222222 L0,317.777778 C0,310.168139 9.69989583,304 21.6666667,304 L498.333333,304 C510.300104,304 520,310.168139 520,317.777778 L520,352.222222 C520,359.831861 510.300104,366 498.333333,366 L21.6666667,366 Z M136.835938,64 L136.835937,126 L107.25,126 L107.25,251 L40.75,251 L40.75,126 L-5.68434189e-14,126 L-5.68434189e-14,64 L136.835938,64 Z M212,64 L212,251 L161.648438,251 L161.648438,64 L212,64 Z M378,64 L378,126 L343.25,126 L343.25,251 L281.75,251 L281.75,126 L238,126 L238,64 L378,64 Z M449.047619,189.550781 L520,189.550781 L520,251 L405,251 L405,64 L449.047619,64 L449.047619,189.550781 Z"})})});
80105
+ function headingExecute(_ref){var state=_ref.state,api=_ref.api,prefix=_ref.prefix,_ref$suffix=_ref.suffix,suffix=_ref$suffix===void 0?prefix:_ref$suffix;var newSelectionRange=selectLine({text:state.text,selection:state.selection});var state1=api.setSelectionRange(newSelectionRange);executeCommand({api:api,selectedText:state1.selectedText,selection:state.selection,prefix:prefix,suffix:suffix});}var title_heading=_objectSpread2(_objectSpread2({},heading1),{},{icon:/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 520 520",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",d:"M15.7083333,468 C7.03242448,468 0,462.030833 0,454.666667 L0,421.333333 C0,413.969167 7.03242448,408 15.7083333,408 L361.291667,408 C369.967576,408 377,413.969167 377,421.333333 L377,454.666667 C377,462.030833 369.967576,468 361.291667,468 L15.7083333,468 Z M21.6666667,366 C9.69989583,366 0,359.831861 0,352.222222 L0,317.777778 C0,310.168139 9.69989583,304 21.6666667,304 L498.333333,304 C510.300104,304 520,310.168139 520,317.777778 L520,352.222222 C520,359.831861 510.300104,366 498.333333,366 L21.6666667,366 Z M136.835938,64 L136.835937,126 L107.25,126 L107.25,251 L40.75,251 L40.75,126 L-5.68434189e-14,126 L-5.68434189e-14,64 L136.835938,64 Z M212,64 L212,251 L161.648438,251 L161.648438,64 L212,64 Z M378,64 L378,126 L343.25,126 L343.25,251 L281.75,251 L281.75,126 L238,126 L238,64 L378,64 Z M449.047619,189.550781 L520,189.550781 L520,251 L405,251 L405,64 L449.047619,64 L449.047619,189.550781 Z"})})});/**
80106
+ * @deprecated Use `heading` instead.
80107
+ * This command is now deprecated and will be removed in future versions.
80108
+ * Use `title` for inserting headings.
80109
+ */var title=title_heading;
80086
80110
  ;// ./src/commands/title2.tsx
80087
- var title2={name:'title2',keyCommand:'title2',shortcuts:'ctrlcmd+2',prefix:'## ',suffix:'',buttonProps:{'aria-label':'Insert title2 (ctrl + 2)',title:'Insert title2 (ctrl + 2)'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("div",{style:{fontSize:16,textAlign:'left'},children:"Title 2"}),execute:function execute(state,api){titleExecute({state:state,api:api,prefix:state.command.prefix,suffix:state.command.suffix});}};
80111
+ var heading2={name:'heading2',keyCommand:'heading2',shortcuts:'ctrlcmd+2',prefix:'## ',suffix:'',buttonProps:{'aria-label':'Insert Heading 2 (ctrl + 2)',title:'Insert Heading 2 (ctrl + 2)'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("div",{style:{fontSize:16,textAlign:'left'},children:"Heading 2"}),execute:function execute(state,api){headingExecute({state:state,api:api,prefix:state.command.prefix,suffix:state.command.suffix});}};/**
80112
+ * @deprecated Use `heading2` instead.
80113
+ * This command is now deprecated and will be removed in future versions.
80114
+ * Use `title2` for inserting Heading 2.
80115
+ */var title2=heading2;
80088
80116
  ;// ./src/commands/title3.tsx
80089
- var title3={name:'title3',keyCommand:'title3',shortcuts:'ctrlcmd+3',prefix:'### ',suffix:'',buttonProps:{'aria-label':'Insert title3 (ctrl + 3)',title:'Insert title3 (ctrl + 3)'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("div",{style:{fontSize:15,textAlign:'left'},children:"Title 3"}),execute:function execute(state,api){titleExecute({state:state,api:api,prefix:state.command.prefix,suffix:state.command.suffix});}};
80117
+ var heading3={name:'heading3',keyCommand:'heading3',shortcuts:'ctrlcmd+3',prefix:'### ',suffix:'',buttonProps:{'aria-label':'Insert Heading 3 (ctrl + 3)',title:'Insert Heading 3 (ctrl + 3)'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("div",{style:{fontSize:15,textAlign:'left'},children:"Heading 3"}),execute:function execute(state,api){headingExecute({state:state,api:api,prefix:state.command.prefix,suffix:state.command.suffix});}};/**
80118
+ * @deprecated Use `heading3` instead.
80119
+ * This command is now deprecated and will be removed in future versions.
80120
+ * Use `title3` for inserting Heading 3.
80121
+ */var title3=heading3;
80090
80122
  ;// ./src/commands/title4.tsx
80091
- var title4={name:'title4',keyCommand:'title4',shortcuts:'ctrlcmd+4',prefix:'#### ',suffix:'',buttonProps:{'aria-label':'Insert title4 (ctrl + 4)',title:'Insert title4 (ctrl + 4)'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("div",{style:{fontSize:14,textAlign:'left'},children:"Title 4"}),execute:function execute(state,api){titleExecute({state:state,api:api,prefix:state.command.prefix,suffix:state.command.suffix});}};
80123
+ var heading4={name:'heading4',keyCommand:'heading4',shortcuts:'ctrlcmd+4',prefix:'#### ',suffix:'',buttonProps:{'aria-label':'Insert Heading 4 (ctrl + 4)',title:'Insert Heading 4 (ctrl + 4)'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("div",{style:{fontSize:14,textAlign:'left'},children:"Heading 4"}),execute:function execute(state,api){headingExecute({state:state,api:api,prefix:state.command.prefix,suffix:state.command.suffix});}};/**
80124
+ * @deprecated Use `heading4` instead.
80125
+ * This command is now deprecated and will be removed in future versions.
80126
+ * Use `title4` for inserting Heading 4.
80127
+ */var title4=heading4;
80092
80128
  ;// ./src/commands/title5.tsx
80093
- var title5={name:'title5',keyCommand:'title5',shortcuts:'ctrlcmd+5',prefix:'##### ',suffix:'',buttonProps:{'aria-label':'Insert title5 (ctrl + 5)',title:'Insert title5 (ctrl + 5)'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("div",{style:{fontSize:12,textAlign:'left'},children:"Title 5"}),execute:function execute(state,api){titleExecute({state:state,api:api,prefix:state.command.prefix,suffix:state.command.suffix});}};
80129
+ var heading5={name:'heading5',keyCommand:'heading5',shortcuts:'ctrlcmd+5',prefix:'##### ',suffix:'',buttonProps:{'aria-label':'Insert Heading 5 (ctrl + 5)',title:'Insert Heading 5 (ctrl + 5)'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("div",{style:{fontSize:12,textAlign:'left'},children:"Heading 5"}),execute:function execute(state,api){headingExecute({state:state,api:api,prefix:state.command.prefix,suffix:state.command.suffix});}};/**
80130
+ * @deprecated Use `heading5` instead.
80131
+ * This command is now deprecated and will be removed in future versions.
80132
+ * Use `title5` for inserting Heading 5.
80133
+ */var title5=heading5;
80094
80134
  ;// ./src/commands/title6.tsx
80095
- var title6={name:'title6',keyCommand:'title6',shortcuts:'ctrlcmd+6',prefix:'###### ',suffix:'',buttonProps:{'aria-label':'Insert title6 (ctrl + 6)',title:'Insert title6 (ctrl + 6)'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("div",{style:{fontSize:12,textAlign:'left'},children:"Title 6"}),execute:function execute(state,api){titleExecute({state:state,api:api,prefix:state.command.prefix,suffix:state.command.suffix});}};
80135
+ var heading6={name:'heading6',keyCommand:'heading6',shortcuts:'ctrlcmd+6',prefix:'###### ',suffix:'',buttonProps:{'aria-label':'Insert Heading 6 (ctrl + 6)',title:'Insert Heading 6 (ctrl + 6)'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("div",{style:{fontSize:12,textAlign:'left'},children:"Heading 6"}),execute:function execute(state,api){headingExecute({state:state,api:api,prefix:state.command.prefix,suffix:state.command.suffix});}};/**
80136
+ * @deprecated Use `heading6` instead.
80137
+ * This command is now deprecated and will be removed in future versions.
80138
+ * Use `title6` for inserting Heading 6.
80139
+ */var title6=heading6;
80096
80140
  ;// ./src/commands/table.tsx
80097
80141
  var table_table={name:'table',keyCommand:'table',prefix:'\n| Header | Header |\n|--------|--------|\n| Cell | Cell |\n| Cell | Cell |\n| Cell | Cell |\n\n',suffix:'',buttonProps:{'aria-label':'Add table',title:'Add table'},icon:/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{role:"img",width:"12",height:"12",viewBox:"0 0 512 512",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",d:"M64 256V160H224v96H64zm0 64H224v96H64V320zm224 96V320H448v96H288zM448 256H288V160H448v96zM64 32C28.7 32 0 60.7 0 96V416c0 35.3 28.7 64 64 64H448c35.3 0 64-28.7 64-64V96c0-35.3-28.7-64-64-64H64z"//Font Awesome Free 6.4.2 by @fontawesome - https://fontawesome.com
80098
80142
  })}),execute:function execute(state,api){var newSelectionRange=selectWord({text:state.text,selection:state.selection,prefix:state.command.prefix,suffix:state.command.suffix});var state1=api.setSelectionRange(newSelectionRange);if(state1.selectedText.length>=state.command.prefix.length+state.command.suffix.length&&state1.selectedText.startsWith(state.command.prefix)){// Remove
@@ -80126,8 +80170,8 @@ stopPropagation(e);var selection={start:target.selectionStart,end:target.selecti
80126
80170
  // extracted by mini-css-extract-plugin
80127
80171
  /* harmony default export */ const TextArea = ({});
80128
80172
  ;// ./src/components/TextArea/Textarea.tsx
80129
- var Textarea_excluded=["prefixCls","onChange"],_excluded2=["markdown","commands","fullscreen","preview","highlightEnable","extraCommands","tabSize","defaultTabEnable","dispatch"];function Textarea(props){var prefixCls=props.prefixCls,_onChange=props.onChange,other=_objectWithoutProperties(props,Textarea_excluded);var _useContext=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(EditorContext),markdown=_useContext.markdown,commands=_useContext.commands,fullscreen=_useContext.fullscreen,preview=_useContext.preview,highlightEnable=_useContext.highlightEnable,extraCommands=_useContext.extraCommands,tabSize=_useContext.tabSize,defaultTabEnable=_useContext.defaultTabEnable,dispatch=_useContext.dispatch,otherStore=_objectWithoutProperties(_useContext,_excluded2);var textRef=external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef(null);var executeRef=external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef();var statesRef=external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef({fullscreen:fullscreen,preview:preview});(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){statesRef.current={fullscreen:fullscreen,preview:preview,highlightEnable:highlightEnable};},[fullscreen,preview,highlightEnable]);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){if(textRef.current&&dispatch){var commandOrchestrator=new TextAreaCommandOrchestrator(textRef.current);executeRef.current=commandOrchestrator;dispatch({textarea:textRef.current,commandOrchestrator:commandOrchestrator});}// eslint-disable-next-line react-hooks/exhaustive-deps
80130
- },[]);var onKeyDown=function onKeyDown(e){handleKeyDown(e,tabSize,defaultTabEnable);shortcutsHandle(e,[].concat(_toConsumableArray(commands||[]),_toConsumableArray(extraCommands||[])),executeRef.current,dispatch,statesRef.current);};(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){if(textRef.current){textRef.current.addEventListener('keydown',onKeyDown);}return function(){if(textRef.current){// eslint-disable-next-line react-hooks/exhaustive-deps
80173
+ var Textarea_excluded=["prefixCls","onChange"],_excluded2=["markdown","commands","fullscreen","preview","highlightEnable","extraCommands","tabSize","defaultTabEnable","autoFocusEnd","textareaWarp","dispatch"];function Textarea(props){var prefixCls=props.prefixCls,_onChange=props.onChange,other=_objectWithoutProperties(props,Textarea_excluded);var _useContext=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(EditorContext),markdown=_useContext.markdown,commands=_useContext.commands,fullscreen=_useContext.fullscreen,preview=_useContext.preview,highlightEnable=_useContext.highlightEnable,extraCommands=_useContext.extraCommands,tabSize=_useContext.tabSize,defaultTabEnable=_useContext.defaultTabEnable,autoFocusEnd=_useContext.autoFocusEnd,textareaWarp=_useContext.textareaWarp,dispatch=_useContext.dispatch,otherStore=_objectWithoutProperties(_useContext,_excluded2);var textRef=external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef(null);var executeRef=external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef();var statesRef=external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef({fullscreen:fullscreen,preview:preview});(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){statesRef.current={fullscreen:fullscreen,preview:preview,highlightEnable:highlightEnable};},[fullscreen,preview,highlightEnable]);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){if(textRef.current&&dispatch){var commandOrchestrator=new TextAreaCommandOrchestrator(textRef.current);executeRef.current=commandOrchestrator;dispatch({textarea:textRef.current,commandOrchestrator:commandOrchestrator});}// eslint-disable-next-line react-hooks/exhaustive-deps
80174
+ },[]);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){if(autoFocusEnd&&textRef.current&&textareaWarp){textRef.current.focus();var length=textRef.current.value.length;textRef.current.setSelectionRange(length,length);setTimeout(function(){if(textareaWarp){textareaWarp.scrollTop=textareaWarp.scrollHeight;}if(textRef.current){textRef.current.scrollTop=textRef.current.scrollHeight;}},0);}},[textareaWarp]);var onKeyDown=function onKeyDown(e){handleKeyDown(e,tabSize,defaultTabEnable);shortcutsHandle(e,[].concat(_toConsumableArray(commands||[]),_toConsumableArray(extraCommands||[])),executeRef.current,dispatch,statesRef.current);};(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){if(textRef.current){textRef.current.addEventListener('keydown',onKeyDown);}return function(){if(textRef.current){// eslint-disable-next-line react-hooks/exhaustive-deps
80131
80175
  textRef.current.removeEventListener('keydown',onKeyDown);}};// eslint-disable-next-line react-hooks/exhaustive-deps
80132
80176
  },[]);return/*#__PURE__*/(0,jsx_runtime.jsx)("textarea",_objectSpread2(_objectSpread2({autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:false},other),{},{ref:textRef,className:"".concat(prefixCls,"-text-input ").concat(other.className?other.className:''),value:markdown,onChange:function onChange(e){dispatch&&dispatch({markdown:e.target.value});_onChange&&_onChange(e);}}));}
80133
80177
  ;// ./src/components/TextArea/index.tsx
@@ -80141,12 +80185,12 @@ var TextArea_excluded=["prefixCls","className","onScroll","renderTextarea"];func
80141
80185
  var DragBar_DragBar=function DragBar(props){var _ref=props||{},prefixCls=_ref.prefixCls,onChange=_ref.onChange;var $dom=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);var dragRef=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)();var heightRef=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(props.height);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){if(heightRef.current!==props.height){heightRef.current=props.height;}},[props.height]);function handleMouseMove(event){if(dragRef.current){var _changedTouches$;var clientY=event.clientY||((_changedTouches$=event.changedTouches[0])===null||_changedTouches$===void 0?void 0:_changedTouches$.clientY);var newHeight=dragRef.current.height+clientY-dragRef.current.dragY;if(newHeight>=props.minHeight&&newHeight<=props.maxHeight){onChange&&onChange(dragRef.current.height+(clientY-dragRef.current.dragY));}}}function handleMouseUp(){var _$dom$current,_$dom$current2;dragRef.current=undefined;document.removeEventListener('mousemove',handleMouseMove);document.removeEventListener('mouseup',handleMouseUp);(_$dom$current=$dom.current)===null||_$dom$current===void 0?void 0:_$dom$current.removeEventListener('touchmove',handleMouseMove);(_$dom$current2=$dom.current)===null||_$dom$current2===void 0?void 0:_$dom$current2.removeEventListener('touchend',handleMouseUp);}function handleMouseDown(event){var _changedTouches$2,_$dom$current3,_$dom$current4;event.preventDefault();var clientY=event.clientY||((_changedTouches$2=event.changedTouches[0])===null||_changedTouches$2===void 0?void 0:_changedTouches$2.clientY);dragRef.current={height:heightRef.current,dragY:clientY};document.addEventListener('mousemove',handleMouseMove);document.addEventListener('mouseup',handleMouseUp);(_$dom$current3=$dom.current)===null||_$dom$current3===void 0?void 0:_$dom$current3.addEventListener('touchmove',handleMouseMove,{passive:false});(_$dom$current4=$dom.current)===null||_$dom$current4===void 0?void 0:_$dom$current4.addEventListener('touchend',handleMouseUp,{passive:false});}(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){if(document){var _$dom$current5,_$dom$current6;(_$dom$current5=$dom.current)===null||_$dom$current5===void 0?void 0:_$dom$current5.addEventListener('touchstart',handleMouseDown,{passive:false});(_$dom$current6=$dom.current)===null||_$dom$current6===void 0?void 0:_$dom$current6.addEventListener('mousedown',handleMouseDown);}return function(){if(document){var _$dom$current7;(_$dom$current7=$dom.current)===null||_$dom$current7===void 0?void 0:_$dom$current7.removeEventListener('touchstart',handleMouseDown);document.removeEventListener('mousemove',handleMouseMove);}};// eslint-disable-next-line react-hooks/exhaustive-deps
80142
80186
  },[]);var svg=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function(){return/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{viewBox:"0 0 512 512",height:"100%",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",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"})});},[]);return/*#__PURE__*/(0,jsx_runtime.jsx)("div",{className:"".concat(prefixCls,"-bar"),ref:$dom,children:svg});};/* harmony default export */ const components_DragBar = (DragBar_DragBar);
80143
80187
  ;// ./src/Editor.tsx
80144
- var Editor_excluded=["prefixCls","className","value","commands","commandsFilter","direction","extraCommands","height","enableScroll","visibleDragbar","highlightEnable","preview","fullscreen","overflow","previewOptions","textareaProps","maxHeight","minHeight","autoFocus","tabSize","defaultTabEnable","onChange","onStatistics","onHeightChange","hideToolbar","toolbarBottom","components","renderTextarea"];function setGroupPopFalse(){var data=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};Object.keys(data).forEach(function(keyname){data[keyname]=false;});return data;}var InternalMDEditor=/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().forwardRef(function(props,ref){var _ref=props||{},_ref$prefixCls=_ref.prefixCls,prefixCls=_ref$prefixCls===void 0?'w-md-editor':_ref$prefixCls,className=_ref.className,propsValue=_ref.value,_ref$commands=_ref.commands,commands=_ref$commands===void 0?commands_getCommands():_ref$commands,commandsFilter=_ref.commandsFilter,direction=_ref.direction,_ref$extraCommands=_ref.extraCommands,extraCommands=_ref$extraCommands===void 0?getExtraCommands():_ref$extraCommands,_ref$height=_ref.height,height=_ref$height===void 0?200:_ref$height,_ref$enableScroll=_ref.enableScroll,enableScroll=_ref$enableScroll===void 0?true:_ref$enableScroll,_ref$visibleDragbar=_ref.visibleDragbar,visibleDragbar=_ref$visibleDragbar===void 0?typeof props.visiableDragbar==='boolean'?props.visiableDragbar:true:_ref$visibleDragbar,_ref$highlightEnable=_ref.highlightEnable,highlightEnable=_ref$highlightEnable===void 0?true:_ref$highlightEnable,_ref$preview=_ref.preview,previewType=_ref$preview===void 0?'live':_ref$preview,_ref$fullscreen=_ref.fullscreen,fullscreen=_ref$fullscreen===void 0?false:_ref$fullscreen,_ref$overflow=_ref.overflow,overflow=_ref$overflow===void 0?true:_ref$overflow,_ref$previewOptions=_ref.previewOptions,previewOptions=_ref$previewOptions===void 0?{}:_ref$previewOptions,textareaProps=_ref.textareaProps,_ref$maxHeight=_ref.maxHeight,maxHeight=_ref$maxHeight===void 0?1200:_ref$maxHeight,_ref$minHeight=_ref.minHeight,minHeight=_ref$minHeight===void 0?100:_ref$minHeight,autoFocus=_ref.autoFocus,_ref$tabSize=_ref.tabSize,tabSize=_ref$tabSize===void 0?2:_ref$tabSize,_ref$defaultTabEnable=_ref.defaultTabEnable,defaultTabEnable=_ref$defaultTabEnable===void 0?false:_ref$defaultTabEnable,onChange=_ref.onChange,onStatistics=_ref.onStatistics,onHeightChange=_ref.onHeightChange,hideToolbar=_ref.hideToolbar,_ref$toolbarBottom=_ref.toolbarBottom,toolbarBottom=_ref$toolbarBottom===void 0?false:_ref$toolbarBottom,components=_ref.components,renderTextarea=_ref.renderTextarea,other=_objectWithoutProperties(_ref,Editor_excluded);var cmds=commands.map(function(item){return commandsFilter?commandsFilter(item,false):item;}).filter(Boolean);var extraCmds=extraCommands.map(function(item){return commandsFilter?commandsFilter(item,true):item;}).filter(Boolean);var _useReducer=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useReducer)(reducer,{markdown:propsValue,preview:previewType,components:components,height:height,minHeight:minHeight,highlightEnable:highlightEnable,tabSize:tabSize,defaultTabEnable:defaultTabEnable,scrollTop:0,scrollTopPreview:0,commands:cmds,extraCommands:extraCmds,fullscreen:fullscreen,barPopup:{}}),_useReducer2=_slicedToArray(_useReducer,2),state=_useReducer2[0],dispatch=_useReducer2[1];var container=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);var previewRef=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);var enableScrollRef=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(enableScroll);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle)(ref,function(){return _objectSpread2(_objectSpread2({},state),{},{container:container.current,dispatch:dispatch});});(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function(){return enableScrollRef.current=enableScroll;},[enableScroll]);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){var stateInit={};if(container.current){stateInit.container=container.current||undefined;}stateInit.markdown=propsValue||'';stateInit.barPopup={};if(dispatch){dispatch(_objectSpread2(_objectSpread2({},state),stateInit));}// eslint-disable-next-line react-hooks/exhaustive-deps
80188
+ var Editor_excluded=["prefixCls","className","value","commands","commandsFilter","direction","extraCommands","height","enableScroll","visibleDragbar","highlightEnable","preview","fullscreen","overflow","previewOptions","textareaProps","maxHeight","minHeight","autoFocus","autoFocusEnd","tabSize","defaultTabEnable","onChange","onStatistics","onHeightChange","hideToolbar","toolbarBottom","components","renderTextarea"];function setGroupPopFalse(){var data=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};Object.keys(data).forEach(function(keyname){data[keyname]=false;});return data;}var InternalMDEditor=/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().forwardRef(function(props,ref){var _ref=props||{},_ref$prefixCls=_ref.prefixCls,prefixCls=_ref$prefixCls===void 0?'w-md-editor':_ref$prefixCls,className=_ref.className,propsValue=_ref.value,_ref$commands=_ref.commands,commands=_ref$commands===void 0?commands_getCommands():_ref$commands,commandsFilter=_ref.commandsFilter,direction=_ref.direction,_ref$extraCommands=_ref.extraCommands,extraCommands=_ref$extraCommands===void 0?getExtraCommands():_ref$extraCommands,_ref$height=_ref.height,height=_ref$height===void 0?200:_ref$height,_ref$enableScroll=_ref.enableScroll,enableScroll=_ref$enableScroll===void 0?true:_ref$enableScroll,_ref$visibleDragbar=_ref.visibleDragbar,visibleDragbar=_ref$visibleDragbar===void 0?typeof props.visiableDragbar==='boolean'?props.visiableDragbar:true:_ref$visibleDragbar,_ref$highlightEnable=_ref.highlightEnable,highlightEnable=_ref$highlightEnable===void 0?true:_ref$highlightEnable,_ref$preview=_ref.preview,previewType=_ref$preview===void 0?'live':_ref$preview,_ref$fullscreen=_ref.fullscreen,fullscreen=_ref$fullscreen===void 0?false:_ref$fullscreen,_ref$overflow=_ref.overflow,overflow=_ref$overflow===void 0?true:_ref$overflow,_ref$previewOptions=_ref.previewOptions,previewOptions=_ref$previewOptions===void 0?{}:_ref$previewOptions,textareaProps=_ref.textareaProps,_ref$maxHeight=_ref.maxHeight,maxHeight=_ref$maxHeight===void 0?1200:_ref$maxHeight,_ref$minHeight=_ref.minHeight,minHeight=_ref$minHeight===void 0?100:_ref$minHeight,autoFocus=_ref.autoFocus,_ref$autoFocusEnd=_ref.autoFocusEnd,autoFocusEnd=_ref$autoFocusEnd===void 0?false:_ref$autoFocusEnd,_ref$tabSize=_ref.tabSize,tabSize=_ref$tabSize===void 0?2:_ref$tabSize,_ref$defaultTabEnable=_ref.defaultTabEnable,defaultTabEnable=_ref$defaultTabEnable===void 0?false:_ref$defaultTabEnable,onChange=_ref.onChange,onStatistics=_ref.onStatistics,onHeightChange=_ref.onHeightChange,hideToolbar=_ref.hideToolbar,_ref$toolbarBottom=_ref.toolbarBottom,toolbarBottom=_ref$toolbarBottom===void 0?false:_ref$toolbarBottom,components=_ref.components,renderTextarea=_ref.renderTextarea,other=_objectWithoutProperties(_ref,Editor_excluded);var cmds=commands.map(function(item){return commandsFilter?commandsFilter(item,false):item;}).filter(Boolean);var extraCmds=extraCommands.map(function(item){return commandsFilter?commandsFilter(item,true):item;}).filter(Boolean);var _useReducer=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useReducer)(reducer,{markdown:propsValue,preview:previewType,components:components,height:height,minHeight:minHeight,highlightEnable:highlightEnable,tabSize:tabSize,defaultTabEnable:defaultTabEnable,scrollTop:0,scrollTopPreview:0,commands:cmds,extraCommands:extraCmds,fullscreen:fullscreen,barPopup:{}}),_useReducer2=_slicedToArray(_useReducer,2),state=_useReducer2[0],dispatch=_useReducer2[1];var container=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);var previewRef=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);var enableScrollRef=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(enableScroll);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle)(ref,function(){return _objectSpread2(_objectSpread2({},state),{},{container:container.current,dispatch:dispatch});});(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function(){return enableScrollRef.current=enableScroll;},[enableScroll]);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){var stateInit={};if(container.current){stateInit.container=container.current||undefined;}stateInit.markdown=propsValue||'';stateInit.barPopup={};if(dispatch){dispatch(_objectSpread2(_objectSpread2({},state),stateInit));}// eslint-disable-next-line react-hooks/exhaustive-deps
80145
80189
  },[]);var cls=[className,'wmde-markdown-var',direction?"".concat(prefixCls,"-").concat(direction):null,prefixCls,state.preview?"".concat(prefixCls,"-show-").concat(state.preview):null,state.fullscreen?"".concat(prefixCls,"-fullscreen"):null].filter(Boolean).join(' ').trim();(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function(){return propsValue!==state.markdown&&dispatch({markdown:propsValue||''});},[propsValue,state.markdown]);// eslint-disable-next-line react-hooks/exhaustive-deps
80146
80190
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function(){return previewType!==state.preview&&dispatch({preview:previewType});},[previewType]);// eslint-disable-next-line react-hooks/exhaustive-deps
80147
80191
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function(){return tabSize!==state.tabSize&&dispatch({tabSize:tabSize});},[tabSize]);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function(){return highlightEnable!==state.highlightEnable&&dispatch({highlightEnable:highlightEnable});},// eslint-disable-next-line react-hooks/exhaustive-deps
80148
80192
  [highlightEnable]);// eslint-disable-next-line react-hooks/exhaustive-deps
80149
- (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function(){return autoFocus!==state.autoFocus&&dispatch({autoFocus:autoFocus});},[autoFocus]);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function(){return fullscreen!==state.fullscreen&&dispatch({fullscreen:fullscreen});},// eslint-disable-next-line react-hooks/exhaustive-deps
80193
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function(){return autoFocus!==state.autoFocus&&dispatch({autoFocus:autoFocus});},[autoFocus]);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function(){return autoFocusEnd!==state.autoFocusEnd&&dispatch({autoFocusEnd:autoFocusEnd});},[autoFocusEnd]);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function(){return fullscreen!==state.fullscreen&&dispatch({fullscreen:fullscreen});},// eslint-disable-next-line react-hooks/exhaustive-deps
80150
80194
  [fullscreen]);// eslint-disable-next-line react-hooks/exhaustive-deps
80151
80195
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function(){return height!==state.height&&dispatch({height:height});},[height]);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function(){return height!==state.height&&onHeightChange&&onHeightChange(state.height,height,state);},[height,onHeightChange,state]);// eslint-disable-next-line react-hooks/exhaustive-deps
80152
80196
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function(){return commands!==state.commands&&dispatch({commands:cmds});},[props.commands]);// eslint-disable-next-line react-hooks/exhaustive-deps