@uiw/react-md-editor 4.0.4 → 4.0.5

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 (40) hide show
  1. package/README.md +72 -75
  2. package/dist/mdeditor.css +86 -2
  3. package/dist/mdeditor.js +65647 -66250
  4. package/dist/mdeditor.min.css +1 -1
  5. package/dist/mdeditor.min.js +1 -1
  6. package/dist/mdeditor.min.js.LICENSE.txt +2 -2
  7. package/esm/Context.d.ts +20 -33
  8. package/esm/Editor.js +1 -2
  9. package/esm/Editor.nohighlight.js +1 -2
  10. package/esm/Types.d.ts +1 -1
  11. package/esm/commands/comment.js +1 -2
  12. package/esm/commands/group.d.ts +1 -1
  13. package/esm/commands/issue.js +2 -2
  14. package/esm/commands/preview.js +1 -2
  15. package/esm/components/TextArea/handleKeyDown.d.ts +0 -1
  16. package/esm/components/TextArea/index.d.ts +1 -1
  17. package/esm/components/TextArea/index.js +5 -6
  18. package/esm/components/TextArea/index.nohighlight.d.ts +1 -1
  19. package/esm/components/TextArea/index.nohighlight.js +4 -4
  20. package/esm/components/TextArea/shortcuts.d.ts +0 -1
  21. package/esm/components/Toolbar/Child.d.ts +1 -1
  22. package/esm/components/Toolbar/index.js +1 -2
  23. package/lib/Context.d.ts +20 -33
  24. package/lib/Types.d.ts +1 -1
  25. package/lib/commands/group.d.ts +1 -1
  26. package/lib/commands/index.js +2 -4
  27. package/lib/commands/issue.js +2 -2
  28. package/lib/components/TextArea/handleKeyDown.d.ts +0 -1
  29. package/lib/components/TextArea/index.d.ts +1 -1
  30. package/lib/components/TextArea/index.js +4 -4
  31. package/lib/components/TextArea/index.nohighlight.d.ts +1 -1
  32. package/lib/components/TextArea/index.nohighlight.js +4 -4
  33. package/lib/components/TextArea/shortcuts.d.ts +0 -1
  34. package/lib/components/Toolbar/Child.d.ts +1 -1
  35. package/package.json +1 -1
  36. package/src/Types.ts +1 -1
  37. package/src/commands/issue.tsx +2 -2
  38. package/src/components/TextArea/index.nohighlight.tsx +1 -1
  39. package/src/components/TextArea/index.tsx +1 -1
  40. package/src/components/Toolbar/Child.tsx +1 -1
package/README.md CHANGED
@@ -165,6 +165,29 @@ export default function App() {
165
165
  }
166
166
  ```
167
167
 
168
+ ### Placeholder & maxLength
169
+
170
+ "Below is an example that sets the `placeholder` for the editor and defines the maximum input character length as `10` characters."
171
+
172
+ ```jsx mdx:preview
173
+ import React from "react";
174
+ import MDEditor from '@uiw/react-md-editor';
175
+
176
+ export default function App() {
177
+ const [value, setValue] = React.useState("");
178
+ return (
179
+ <MDEditor
180
+ value={value}
181
+ onChange={setValue}
182
+ textareaProps={{
183
+ placeholder: 'Please enter Markdown text',
184
+ maxLength: 10
185
+ }}
186
+ />
187
+ );
188
+ }
189
+ ```
190
+
168
191
  ### Custom Toolbars
169
192
 
170
193
  [![Open in CodeSandbox](https://img.shields.io/badge/Open%20in-CodeSandbox-blue?logo=codesandbox)](https://codesandbox.io/embed/react-md-editor-custom-toolbars-m2n10?fontsize=14&hidenavigation=1&theme=dark)
@@ -560,6 +583,30 @@ export default function App() {
560
583
  }
561
584
  ```
562
585
 
586
+ ### Disallowed Elements
587
+
588
+ ```jsx mdx:preview
589
+ import React from "react";
590
+ import MDEditor from '@uiw/react-md-editor';
591
+
592
+ export default function App() {
593
+ const [value, setValue] = React.useState("**Hello world!!!** <style>body{display:none;}</style> ");
594
+ return (
595
+ <div className="container">
596
+ <MDEditor
597
+ value={value}
598
+ height="100%"
599
+ previewOptions={{
600
+ disallowedElements: ['style'],
601
+ }}
602
+ visibleDragbar={false}
603
+ onChange={setValue}
604
+ />
605
+ </div>
606
+ );
607
+ }
608
+ ```
609
+
563
610
  ### Preview Markdown
564
611
 
565
612
  [![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)
@@ -928,81 +975,31 @@ npm run start
928
975
 
929
976
  As always, thanks to our amazing contributors!
930
977
 
931
- <!--AUTO_GENERATED_PLEASE_DONT_DELETE_IT--><a href="https://github.com/jaywcjlove" title="小弟调调">
932
- <img src="https://avatars.githubusercontent.com/u/1680273?v=4" width="42;" alt="小弟调调"/>
933
- </a>
934
- <a href="https://github.com/renovate-bot" title="Mend Renovate">
935
- <img src="https://avatars.githubusercontent.com/u/25180681?v=4" width="42;" alt="Mend Renovate"/>
936
- </a>
937
- <a href="https://github.com/stevemk14ebr" title="Stephen Eckels">
938
- <img src="https://avatars.githubusercontent.com/u/6619205?v=4" width="42;" alt="Stephen Eckels"/>
939
- </a>
940
- <a href="https://github.com/avalero" title="Alberto Valero Gómez">
941
- <img src="https://avatars.githubusercontent.com/u/1442682?v=4" width="42;" alt="Alberto Valero Gómez"/>
942
- </a>
943
- <a href="https://github.com/alphacoma18" title="Alpha Romer Coma">
944
- <img src="https://avatars.githubusercontent.com/u/108984668?v=4" width="42;" alt="Alpha Romer Coma"/>
945
- </a>
946
- <a href="https://github.com/RARgames" title="RAR">
947
- <img src="https://avatars.githubusercontent.com/u/13639766?v=4" width="42;" alt="RAR"/>
948
- </a>
949
- <a href="https://github.com/Exmirai" title="UniqueUlysees">
950
- <img src="https://avatars.githubusercontent.com/u/6436703?v=4" width="42;" alt="UniqueUlysees"/>
951
- </a>
952
- <a href="https://github.com/nuragic" title="Andrea Puddu">
953
- <img src="https://avatars.githubusercontent.com/u/1586378?v=4" width="42;" alt="Andrea Puddu"/>
954
- </a>
955
- <a href="https://github.com/bramus" title="Bramus">
956
- <img src="https://avatars.githubusercontent.com/u/213073?v=4" width="42;" alt="Bramus"/>
957
- </a>
958
- <a href="https://github.com/CarleneCannon-Conner" title="Carlene Cannon-Conner">
959
- <img src="https://avatars.githubusercontent.com/u/1942791?v=4" width="42;" alt="Carlene Cannon-Conner"/>
960
- </a>
961
- <a href="https://github.com/MercierCorentin" title="Corentin Mercier">
962
- <img src="https://avatars.githubusercontent.com/u/46066895?v=4" width="42;" alt="Corentin Mercier"/>
963
- </a>
964
- <a href="https://github.com/dmitriyyan" title="Dmitrii Ianushkevich">
965
- <img src="https://avatars.githubusercontent.com/u/89025862?v=4" width="42;" alt="Dmitrii Ianushkevich"/>
966
- </a>
967
- <a href="https://github.com/jnishiyama" title="James Finucane">
968
- <img src="https://avatars.githubusercontent.com/u/2048195?v=4" width="42;" alt="James Finucane"/>
969
- </a>
970
- <a href="https://github.com/allforabit" title="Kevin Nolan">
971
- <img src="https://avatars.githubusercontent.com/u/537189?v=4" width="42;" alt="Kevin Nolan"/>
972
- </a>
973
- <a href="https://github.com/kseikyo" title="Lucas Sierota">
974
- <img src="https://avatars.githubusercontent.com/u/29212286?v=4" width="42;" alt="Lucas Sierota"/>
975
- </a>
976
- <a href="https://github.com/michaelkramer" title="Michael Kramer">
977
- <img src="https://avatars.githubusercontent.com/u/6052223?v=4" width="42;" alt="Michael Kramer"/>
978
- </a>
979
- <a href="https://github.com/peterj" title="Peter Jausovec">
980
- <img src="https://avatars.githubusercontent.com/u/11080940?v=4" width="42;" alt="Peter Jausovec"/>
981
- </a>
982
- <a href="https://github.com/phillipb" title="Phillip Burch">
983
- <img src="https://avatars.githubusercontent.com/u/1482089?v=4" width="42;" alt="Phillip Burch"/>
984
- </a>
985
- <a href="https://github.com/psycho-baller" title="Rami Maalouf">
986
- <img src="https://avatars.githubusercontent.com/u/81759594?v=4" width="42;" alt="Rami Maalouf"/>
987
- </a>
988
- <a href="https://github.com/toresbe" title="Tore Sinding Bekkedal">
989
- <img src="https://avatars.githubusercontent.com/u/1761606?v=4" width="42;" alt="Tore Sinding Bekkedal"/>
990
- </a>
991
- <a href="https://github.com/valenfv" title="Valentin">
992
- <img src="https://avatars.githubusercontent.com/u/34139820?v=4" width="42;" alt="Valentin"/>
993
- </a>
994
- <a href="https://github.com/jmtes" title="juno tesoro">
995
- <img src="https://avatars.githubusercontent.com/u/38450133?v=4" width="42;" alt="juno tesoro"/>
996
- </a>
997
- <a href="https://github.com/juspky" title="juspky">
998
- <img src="https://avatars.githubusercontent.com/u/11074890?v=4" width="42;" alt="juspky"/>
999
- </a>
1000
- <a href="https://github.com/ryicoh" title="ryicoh">
1001
- <img src="https://avatars.githubusercontent.com/u/37844673?v=4" width="42;" alt="ryicoh"/>
1002
- </a>
1003
- <a href="https://github.com/wj0990" title="wangjie">
1004
- <img src="https://avatars.githubusercontent.com/u/8792016?v=4" width="42;" alt="wangjie"/>
1005
- </a><!--AUTO_GENERATED_PLEASE_DONT_DELETE_IT-END-->
978
+ <!--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>
979
+ <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>
980
+ <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>
981
+ <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>
982
+ <a href="https://github.com/RARgames" title="RAR"><img src="https://avatars.githubusercontent.com/u/13639766?v=4" width="42;" alt="RAR"/></a>
983
+ <a href="https://github.com/Exmirai" title="UniqueUlysees"><img src="https://avatars.githubusercontent.com/u/6436703?v=4" width="42;" alt="UniqueUlysees"/></a>
984
+ <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>
985
+ <a href="https://github.com/AntonR31337" title="Anton"><img src="https://avatars.githubusercontent.com/u/88384647?v=4" width="42;" alt="Anton"/></a>
986
+ <a href="https://github.com/bramus" title="Bramus"><img src="https://avatars.githubusercontent.com/u/213073?v=4" width="42;" alt="Bramus"/></a>
987
+ <a href="https://github.com/CarleneCannon-Conner" title="Carlene Cannon-Conner"><img src="https://avatars.githubusercontent.com/u/1942791?v=4" width="42;" alt="Carlene Cannon-Conner"/></a>
988
+ <a href="https://github.com/MercierCorentin" title="Corentin Mercier"><img src="https://avatars.githubusercontent.com/u/46066895?v=4" width="42;" alt="Corentin Mercier"/></a>
989
+ <a href="https://github.com/dmitriyyan" title="Dmitrii Ianushkevich"><img src="https://avatars.githubusercontent.com/u/89025862?v=4" width="42;" alt="Dmitrii Ianushkevich"/></a>
990
+ <a href="https://github.com/jnishiyama" title="James Finucane"><img src="https://avatars.githubusercontent.com/u/2048195?v=4" width="42;" alt="James Finucane"/></a>
991
+ <a href="https://github.com/allforabit" title="Kevin Nolan"><img src="https://avatars.githubusercontent.com/u/537189?v=4" width="42;" alt="Kevin Nolan"/></a>
992
+ <a href="https://github.com/kseikyo" title="Lucas Sierota"><img src="https://avatars.githubusercontent.com/u/29212286?v=4" width="42;" alt="Lucas Sierota"/></a>
993
+ <a href="https://github.com/michaelkramer" title="Michael Kramer"><img src="https://avatars.githubusercontent.com/u/6052223?v=4" width="42;" alt="Michael Kramer"/></a>
994
+ <a href="https://github.com/peterj" title="Peter Jausovec"><img src="https://avatars.githubusercontent.com/u/11080940?v=4" width="42;" alt="Peter Jausovec"/></a>
995
+ <a href="https://github.com/phillipb" title="Phillip Burch"><img src="https://avatars.githubusercontent.com/u/1482089?v=4" width="42;" alt="Phillip Burch"/></a>
996
+ <a href="https://github.com/psycho-baller" title="Rami Maalouf"><img src="https://avatars.githubusercontent.com/u/81759594?v=4" width="42;" alt="Rami Maalouf"/></a>
997
+ <a href="https://github.com/toresbe" title="Tore Sinding Bekkedal"><img src="https://avatars.githubusercontent.com/u/1761606?v=4" width="42;" alt="Tore Sinding Bekkedal"/></a>
998
+ <a href="https://github.com/valenfv" title="Valentin"><img src="https://avatars.githubusercontent.com/u/34139820?v=4" width="42;" alt="Valentin"/></a>
999
+ <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>
1000
+ <a href="https://github.com/juspky" title="juspky"><img src="https://avatars.githubusercontent.com/u/11074890?v=4" width="42;" alt="juspky"/></a>
1001
+ <a href="https://github.com/ryicoh" title="ryicoh"><img src="https://avatars.githubusercontent.com/u/37844673?v=4" width="42;" alt="ryicoh"/></a>
1002
+ <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-->
1006
1003
 
1007
1004
  Made with [contributors](https://github.com/jaywcjlove/github-action-contributors).
1008
1005
 
package/dist/mdeditor.css CHANGED
@@ -44,6 +44,13 @@
44
44
  --color-accent-emphasis: #1f6feb;
45
45
  --color-attention-subtle: rgba(187, 128, 9, 0.15);
46
46
  --color-danger-fg: #f85149;
47
+ --color-danger-emphasis: #da3633;
48
+ --color-attention-fg: #d29922;
49
+ --color-attention-emphasis: #9e6a03;
50
+ --color-done-fg: #a371f7;
51
+ --color-done-emphasis: #8957e5;
52
+ --color-success-fg: #3fb950;
53
+ --color-success-emphasis: #238636;
47
54
  --color-copied-active-bg: #2e9b33;
48
55
  }
49
56
  }
@@ -92,7 +99,14 @@
92
99
  --color-accent-fg: #0969da;
93
100
  --color-accent-emphasis: #0969da;
94
101
  --color-attention-subtle: #fff8c5;
95
- --color-danger-fg: #cf222e;
102
+ --color-danger-fg: #d1242f;
103
+ --color-danger-emphasis: #cf222e;
104
+ --color-attention-fg: #9a6700;
105
+ --color-attention-emphasis: #9a6700;
106
+ --color-done-fg: #8250df;
107
+ --color-done-emphasis: #8250df;
108
+ --color-success-fg: #1a7f37;
109
+ --color-success-emphasis: #1f883d;
96
110
  --color-copied-active-bg: #2e9b33;
97
111
  }
98
112
  }
@@ -196,7 +210,7 @@ body[data-color-mode*='light'] {
196
210
  }
197
211
  .wmde-markdown {
198
212
  -webkit-text-size-adjust: 100%;
199
- font-family: -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji';
213
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji';
200
214
  font-size: 16px;
201
215
  line-height: 1.5;
202
216
  word-wrap: break-word;
@@ -805,6 +819,15 @@ body[data-color-mode*='light'] {
805
819
  overflow: auto;
806
820
  display: block;
807
821
  }
822
+ .wmde-markdown pre > code::-webkit-scrollbar {
823
+ background: transparent;
824
+ width: 8px;
825
+ height: 8px;
826
+ }
827
+ .wmde-markdown pre > code::-webkit-scrollbar-thumb {
828
+ background: var(--color-fg-muted);
829
+ border-radius: 10px;
830
+ }
808
831
  .wmde-markdown .csv-data td,
809
832
  .wmde-markdown .csv-data th {
810
833
  padding: 5px;
@@ -924,6 +947,67 @@ body[data-color-mode*='light'] {
924
947
  .wmde-markdown pre .active .octicon-check {
925
948
  display: block;
926
949
  }
950
+ .wmde-markdown .markdown-alert {
951
+ padding: 0.5rem 1em;
952
+ color: inherit;
953
+ margin-bottom: 16px;
954
+ border-left: 0.25em solid var(--color-border-default);
955
+ border-left: 0.25em solid var(--borderColor-default, var(--color-border-default));
956
+ }
957
+ .wmde-markdown .markdown-alert > :last-child {
958
+ margin-bottom: 0 !important;
959
+ }
960
+ .wmde-markdown .markdown-alert .markdown-alert-title {
961
+ display: flex;
962
+ align-items: center;
963
+ line-height: 1;
964
+ font-weight: 500;
965
+ font-size: 14px;
966
+ }
967
+ .wmde-markdown .markdown-alert .markdown-alert-title svg.octicon {
968
+ margin-right: 8px !important;
969
+ margin-right: var(--base-size-8, 8px) !important;
970
+ }
971
+ .wmde-markdown .markdown-alert.markdown-alert-note {
972
+ border-left-color: var(--color-accent-emphasis);
973
+ border-left-color: var(--borderColor-accent-emphasis, var(--color-accent-emphasis));
974
+ }
975
+ .wmde-markdown .markdown-alert.markdown-alert-note .markdown-alert-title {
976
+ color: var(--color-accent-fg);
977
+ color: var(--fgColor-accent, var(--color-accent-fg));
978
+ }
979
+ .wmde-markdown .markdown-alert.markdown-alert-tip {
980
+ border-left-color: var(--color-success-emphasis);
981
+ border-left-color: var(--borderColor-success-emphasis, var(--color-success-emphasis));
982
+ }
983
+ .wmde-markdown .markdown-alert.markdown-alert-tip .markdown-alert-title {
984
+ color: var(--color-success-fg);
985
+ color: var(--fgColor-success, var(--color-success-fg));
986
+ }
987
+ .wmde-markdown .markdown-alert.markdown-alert-important {
988
+ border-left-color: var(--color-done-emphasis);
989
+ border-left-color: var(--borderColor-done-emphasis, var(--color-done-emphasis));
990
+ }
991
+ .wmde-markdown .markdown-alert.markdown-alert-important .markdown-alert-title {
992
+ color: var(--color-done-fg);
993
+ color: var(--fgColor-done, var(--color-done-fg));
994
+ }
995
+ .wmde-markdown .markdown-alert.markdown-alert-warning {
996
+ border-left-color: var(--color-attention-emphasis);
997
+ border-left-color: var(--borderColor-attention-emphasis, var(--color-attention-emphasis));
998
+ }
999
+ .wmde-markdown .markdown-alert.markdown-alert-warning .markdown-alert-title {
1000
+ color: var(--color-attention-fg);
1001
+ color: var(--fgColor-attention, var(--color-attention-fg));
1002
+ }
1003
+ .wmde-markdown .markdown-alert.markdown-alert-caution {
1004
+ border-left-color: var(--color-danger-emphasis);
1005
+ border-left-color: var(--borderColor-danger-emphasis, var(--color-danger-emphasis));
1006
+ }
1007
+ .wmde-markdown .markdown-alert.markdown-alert-caution .markdown-alert-title {
1008
+ color: var(--color-danger-fg);
1009
+ color: var(--fgColor-danger, var(--color-danger-fg));
1010
+ }
927
1011
  .wmde-markdown .highlight-line {
928
1012
  background-color: var(--color-neutral-muted);
929
1013
  }