@uiw/react-md-editor 4.0.7 → 4.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +104 -2
- package/commands.d.ts +14 -7
- package/dist/mdeditor.css +1 -1
- package/dist/mdeditor.js +231 -233
- package/dist/mdeditor.min.js +1 -1
- package/esm/Editor.d.ts +1 -1
- package/esm/Editor.nohighlight.d.ts +1 -1
- package/esm/commands/index.cn.js +4 -4
- package/esm/commands/index.d.ts +8 -8
- package/esm/commands/index.js +8 -8
- package/esm/commands/title.d.ts +7 -1
- package/esm/commands/title.js +11 -4
- package/esm/commands/title1.d.ts +6 -0
- package/esm/commands/title1.js +16 -9
- package/esm/commands/title2.d.ts +6 -0
- package/esm/commands/title2.js +16 -9
- package/esm/commands/title3.d.ts +6 -0
- package/esm/commands/title3.js +16 -9
- package/esm/commands/title4.d.ts +6 -0
- package/esm/commands/title4.js +16 -9
- package/esm/commands/title5.d.ts +6 -0
- package/esm/commands/title5.js +16 -9
- package/esm/commands/title6.d.ts +6 -0
- package/esm/commands/title6.js +16 -9
- package/esm/components/DragBar/index.d.ts +1 -1
- package/esm/components/TextArea/Markdown.d.ts +1 -1
- package/esm/components/TextArea/Textarea.d.ts +1 -1
- package/esm/components/TextArea/index.d.ts +4 -4
- package/esm/components/TextArea/index.nohighlight.d.ts +3 -3
- package/esm/components/Toolbar/Child.d.ts +1 -1
- package/esm/components/Toolbar/index.d.ts +1 -1
- package/esm/index.d.ts +3 -0
- package/esm/index.js +3 -0
- package/lib/Editor.d.ts +1 -1
- package/lib/Editor.nohighlight.d.ts +1 -1
- package/lib/commands/index.cn.js +4 -4
- package/lib/commands/index.d.ts +8 -8
- package/lib/commands/index.js +42 -0
- package/lib/commands/title.d.ts +7 -1
- package/lib/commands/title.js +12 -4
- package/lib/commands/title1.d.ts +6 -0
- package/lib/commands/title1.js +16 -9
- package/lib/commands/title2.d.ts +6 -0
- package/lib/commands/title2.js +16 -9
- package/lib/commands/title3.d.ts +6 -0
- package/lib/commands/title3.js +16 -9
- package/lib/commands/title4.d.ts +6 -0
- package/lib/commands/title4.js +16 -9
- package/lib/commands/title5.d.ts +6 -0
- package/lib/commands/title5.js +16 -9
- package/lib/commands/title6.d.ts +6 -0
- package/lib/commands/title6.js +16 -9
- package/lib/components/DragBar/index.d.ts +1 -1
- package/lib/components/TextArea/Markdown.d.ts +1 -1
- package/lib/components/TextArea/Textarea.d.ts +1 -1
- package/lib/components/TextArea/index.d.ts +4 -4
- package/lib/components/TextArea/index.nohighlight.d.ts +3 -3
- package/lib/components/Toolbar/Child.d.ts +1 -1
- package/lib/components/Toolbar/index.d.ts +1 -1
- package/lib/index.d.ts +3 -0
- package/lib/index.js +26 -1
- package/nohighlight.d.ts +2 -0
- package/package.json +1 -1
- package/src/Editor.nohighlight.tsx +2 -2
- package/src/Editor.tsx +3 -3
- package/src/commands/index.cn.ts +3 -3
- package/src/commands/index.ts +14 -7
- package/src/commands/title.tsx +11 -4
- package/src/commands/title1.tsx +14 -7
- package/src/commands/title2.tsx +14 -7
- package/src/commands/title3.tsx +14 -7
- package/src/commands/title4.tsx +14 -7
- package/src/commands/title5.tsx +14 -7
- package/src/commands/title6.tsx +14 -7
- package/src/components/DragBar/index.tsx +1 -1
- package/src/components/TextArea/Markdown.tsx +1 -1
- package/src/components/TextArea/Textarea.tsx +2 -2
- package/src/components/TextArea/index.nohighlight.tsx +5 -4
- package/src/components/TextArea/index.tsx +6 -5
- package/src/components/Toolbar/Child.tsx +1 -1
- package/src/components/Toolbar/index.tsx +2 -2
- package/src/index.tsx +3 -0
package/README.md
CHANGED
|
@@ -1,3 +1,39 @@
|
|
|
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/Keyzer/6500434773" title="Keyzer for macOS"><img alt="Keyzer" height="52" width="52" src="https://wangchujiang.com/appicon/keyzer.png"></a>
|
|
5
|
+
<a target="_blank" href="https://github.com/jaywcjlove/vidwall-hub" title="Vidwall Hub for macOS"><img alt="Vidwall Hub" height="52" width="52" src="https://wangchujiang.com/appicon/vidwall-hub.png"></a>
|
|
6
|
+
<a target="_blank" href="https://apps.apple.com/app/VidCrop/6752624705" title="VidCrop for macOS"><img alt="VidCrop" height="52" width="52" src="https://wangchujiang.com/appicon/vidcrop.png"></a>
|
|
7
|
+
<a target="_blank" href="https://apps.apple.com/app/Vidwall/6747587746" title="Vidwall for macOS"><img alt="Vidwall" height="52" width="52" src="https://wangchujiang.com/appicon/vidwall.png"></a>
|
|
8
|
+
<a target="_blank" href="https://wangchujiang.com/mousio-hint/" title="Mousio Hint for macOS"><img alt="Mousio Hint" height="52" width="52" src="https://wangchujiang.com/appicon/mousio-hint.png"></a>
|
|
9
|
+
<a target="_blank" href="https://apps.apple.com/app/6746747327" title="Mousio for macOS"><img alt="Mousio" height="52" width="52" src="https://wangchujiang.com/appicon/mousio.png"></a>
|
|
10
|
+
<a target="_blank" href="https://apps.apple.com/app/6745227444" title="Musicer for macOS"><img alt="Musicer" height="52" width="52" src="https://wangchujiang.com/appicon/musicer.png"></a>
|
|
11
|
+
<a target="_blank" href="https://apps.apple.com/app/6743841447" title="Audioer for macOS"><img alt="Audioer" height="52" width="52" src="https://wangchujiang.com/appicon/audioer.png"></a>
|
|
12
|
+
<a target="_blank" href="https://apps.apple.com/app/6744690194" title="FileSentinel for macOS"><img alt="FileSentinel" height="52" width="52" src="https://wangchujiang.com/appicon/file-sentinel.png"></a>
|
|
13
|
+
<a target="_blank" href="https://apps.apple.com/app/6743495172" title="FocusCursor for macOS"><img alt="FocusCursor" height="52" width="52" src="https://wangchujiang.com/appicon/focus-cursor.png"></a>
|
|
14
|
+
<a target="_blank" href="https://apps.apple.com/app/6742680573" title="Videoer for macOS"><img alt="Videoer" height="52" width="52" src="https://wangchujiang.com/appicon/videoer.png"></a>
|
|
15
|
+
<a target="_blank" href="https://apps.apple.com/app/6740425504" title="KeyClicker for macOS"><img alt="KeyClicker" height="52" width="52" src="https://wangchujiang.com/appicon/key-clicker.png"></a>
|
|
16
|
+
<a target="_blank" href="https://apps.apple.com/app/6739052447" title="DayBar for macOS"><img alt="DayBar" height="52" width="52" src="https://wangchujiang.com/appicon/daybar.png"></a>
|
|
17
|
+
<a target="_blank" href="https://apps.apple.com/app/6739444407" title="Iconed for macOS"><img alt="Iconed" height="52" width="52" src="https://wangchujiang.com/appicon/iconed.png"></a>
|
|
18
|
+
<a target="_blank" href="https://apps.apple.com/app/6737160756" title="Mousio for macOS"><img alt="Mousio" height="52" width="52" src="https://wangchujiang.com/appicon/rightmenu-master.png"></a>
|
|
19
|
+
<a target="_blank" href="https://apps.apple.com/app/6723903021" title="Paste Quick for macOS"><img alt="Quick RSS" height="52" width="52" src="https://wangchujiang.com/appicon/paste-quick.png"></a>
|
|
20
|
+
<a target="_blank" href="https://apps.apple.com/app/6670696072" title="Quick RSS for macOS/iOS"><img alt="Quick RSS" height="52" width="52" src="https://wangchujiang.com/appicon/quick-rss.png"></a>
|
|
21
|
+
<a target="_blank" href="https://apps.apple.com/app/6670167443" title="Web Serve for macOS"><img alt="Web Serve" height="52" width="52" src="https://wangchujiang.com/appicon/web-serve.png"></a>
|
|
22
|
+
<a target="_blank" href="https://apps.apple.com/app/6503953628" title="Copybook Generator for macOS/iOS"><img alt="Copybook Generator" height="52" width="52" src="https://wangchujiang.com/appicon/copybook-generator.png"></a>
|
|
23
|
+
<a target="_blank" href="https://apps.apple.com/app/6471227008" title="DevTutor for macOS/iOS"><img alt="DevTutor for SwiftUI" height="52" width="52" src="https://wangchujiang.com/appicon/devtutor.png"></a>
|
|
24
|
+
<a target="_blank" href="https://apps.apple.com/app/6479819388" title="RegexMate for macOS/iOS"><img alt="RegexMate" height="52" width="52" src="https://wangchujiang.com/appicon/regex-mate.png"></a>
|
|
25
|
+
<a target="_blank" href="https://apps.apple.com/app/6479194014" title="Time Passage for macOS/iOS"><img alt="Time Passage" height="52" width="52" src="https://wangchujiang.com/appicon/time-passage.png"></a>
|
|
26
|
+
<a target="_blank" href="https://apps.apple.com/app/6478772538" title="IconizeFolder for macOS"><img alt="Iconize Folder" height="52" width="52" src="https://wangchujiang.com/appicon/iconize-folder.png"></a>
|
|
27
|
+
<a target="_blank" href="https://apps.apple.com/app/6478511402" title="Textsound Saver for macOS/iOS"><img alt="Textsound Saver" height="52" width="52" src="https://wangchujiang.com/appicon/textsound-saver.png"></a>
|
|
28
|
+
<a target="_blank" href="https://apps.apple.com/app/6476924627" title="Create Custom Symbols for macOS"><img alt="Create Custom Symbols" height="52" width="52" src="https://wangchujiang.com/appicon/create-custom-symbols.png"></a>
|
|
29
|
+
<a target="_blank" href="https://apps.apple.com/app/6476452351" title="DevHub for macOS"><img alt="DevHub" height="52" width="52" src="https://wangchujiang.com/appicon/devhub.png"></a>
|
|
30
|
+
<a target="_blank" href="https://apps.apple.com/app/6476400184" title="Resume Revise for macOS"><img alt="Resume Revise" height="52" width="52" src="https://wangchujiang.com/appicon/resume-revise.png"></a>
|
|
31
|
+
<a target="_blank" href="https://apps.apple.com/app/6472593276" title="Palette Genius for macOS"><img alt="Palette Genius" height="52" width="52" src="https://wangchujiang.com/appicon/palette-genius.png"></a>
|
|
32
|
+
<a target="_blank" href="https://apps.apple.com/app/6470879005" title="Symbol Scribe for macOS"><img alt="Symbol Scribe" height="52" width="52" src="https://wangchujiang.com/appicon/symbol-scribe.png"></a>
|
|
33
|
+
</div>
|
|
34
|
+
<hr>
|
|
35
|
+
|
|
36
|
+
|
|
1
37
|
<!--rehype:ignore:start-->
|
|
2
38
|
<p align="center">
|
|
3
39
|
<a href="https://uiwjs.github.io/npm-unpkg/#/pkg/@uiw/react-md-editor/file/README.md">
|
|
@@ -84,6 +120,49 @@ export default function App() {
|
|
|
84
120
|
}
|
|
85
121
|
```
|
|
86
122
|
|
|
123
|
+
### Headless Mode
|
|
124
|
+
|
|
125
|
+
The package exposes the necessary utilities to build a headless markdown editor with your own UI. This example creates a simple textarea that supports markdown keyboard shortcuts and correct handling of newlines.
|
|
126
|
+
|
|
127
|
+
```jsx mdx:preview
|
|
128
|
+
import React from "react";
|
|
129
|
+
import {
|
|
130
|
+
handleKeyDown,
|
|
131
|
+
shortcuts,
|
|
132
|
+
TextAreaCommandOrchestrator,
|
|
133
|
+
getCommands,
|
|
134
|
+
} from '@uiw/react-md-editor';
|
|
135
|
+
|
|
136
|
+
export default function App() {
|
|
137
|
+
const [value, setValue] = React.useState("**Hello world!!!**");
|
|
138
|
+
const textareaRef = React.useRef(null);
|
|
139
|
+
const orchestratorRef = React.useRef(null);
|
|
140
|
+
|
|
141
|
+
React.useEffect(() => {
|
|
142
|
+
if (textareaRef.current) {
|
|
143
|
+
orchestratorRef.current = new TextAreaCommandOrchestrator(textareaRef.current);
|
|
144
|
+
}
|
|
145
|
+
}, []);
|
|
146
|
+
|
|
147
|
+
const onKeyDown = (e) => {
|
|
148
|
+
handleKeyDown(e, 2, false);
|
|
149
|
+
if (orchestratorRef.current) {
|
|
150
|
+
shortcuts(e, getCommands(), orchestratorRef.current);
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
return (
|
|
155
|
+
<textarea
|
|
156
|
+
ref={textareaRef}
|
|
157
|
+
value={value}
|
|
158
|
+
onChange={(e) => setValue(e.target.value)}
|
|
159
|
+
onKeyDown={onKeyDown}
|
|
160
|
+
style={{ width: '100%', height: 200, padding: 10 }}
|
|
161
|
+
/>
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
87
166
|
### Special Markdown syntax
|
|
88
167
|
|
|
89
168
|
**Supports for CSS Style**
|
|
@@ -552,6 +631,27 @@ export default function App() {
|
|
|
552
631
|
}
|
|
553
632
|
```
|
|
554
633
|
|
|
634
|
+
Set to support editor only
|
|
635
|
+
|
|
636
|
+
```jsx mdx:preview
|
|
637
|
+
import React, { useContext } from "react";
|
|
638
|
+
import MDEditor, { commands, EditorContext } from "@uiw/react-md-editor";
|
|
639
|
+
|
|
640
|
+
export default function App() {
|
|
641
|
+
const [value, setValue] = React.useState("**Hello world!!!**");
|
|
642
|
+
return (
|
|
643
|
+
<div className="container">
|
|
644
|
+
<MDEditor
|
|
645
|
+
value={value}
|
|
646
|
+
preview="edit"
|
|
647
|
+
extraCommands={[commands.fullscreen]}
|
|
648
|
+
onChange={(val) => setValue(val)}
|
|
649
|
+
/>
|
|
650
|
+
</div>
|
|
651
|
+
);
|
|
652
|
+
}
|
|
653
|
+
```
|
|
654
|
+
|
|
555
655
|
### Editor Font Size
|
|
556
656
|
|
|
557
657
|
[](https://codesandbox.io/embed/markdown-editor-for-react-uiwjs-react-md-editor-issues-425-2epmgh?fontsize=14&hidenavigation=1&theme=dark)
|
|
@@ -746,7 +846,7 @@ export default function App() {
|
|
|
746
846
|
|
|
747
847
|
```tsx mdx:preview
|
|
748
848
|
import React, { useState } from "react";
|
|
749
|
-
import MDEditor, { commands, ICommand, TextState, TextAreaTextApi } from "@uiw/react-md-editor";
|
|
849
|
+
import MDEditor, { commands, type ICommand, TextState, TextAreaTextApi } from "@uiw/react-md-editor";
|
|
750
850
|
import domToImage from "dom-to-image";
|
|
751
851
|
|
|
752
852
|
const textToImage: ICommand = {
|
|
@@ -1048,12 +1148,14 @@ As always, thanks to our amazing contributors!
|
|
|
1048
1148
|
<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>
|
|
1049
1149
|
<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>
|
|
1050
1150
|
<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>
|
|
1151
|
+
<a href="https://github.com/Stopa" title="Stepan Bolotnikov"><img src="https://avatars.githubusercontent.com/u/408256?v=4" width="42;" alt="Stepan Bolotnikov"/></a>
|
|
1051
1152
|
<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>
|
|
1052
1153
|
<a href="https://github.com/valenfv" title="Valentin"><img src="https://avatars.githubusercontent.com/u/34139820?v=4" width="42;" alt="Valentin"/></a>
|
|
1053
1154
|
<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>
|
|
1054
1155
|
<a href="https://github.com/juspky" title="juspky"><img src="https://avatars.githubusercontent.com/u/11074890?v=4" width="42;" alt="juspky"/></a>
|
|
1055
1156
|
<a href="https://github.com/ryicoh" title="ryicoh"><img src="https://avatars.githubusercontent.com/u/37844673?v=4" width="42;" alt="ryicoh"/></a>
|
|
1056
|
-
<a href="https://github.com/wj0990" title="wangjie"><img src="https://avatars.githubusercontent.com/u/8792016?v=4" width="42;" alt="wangjie"/></a
|
|
1157
|
+
<a href="https://github.com/wj0990" title="wangjie"><img src="https://avatars.githubusercontent.com/u/8792016?v=4" width="42;" alt="wangjie"/></a>
|
|
1158
|
+
<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-->
|
|
1057
1159
|
|
|
1058
1160
|
Made with [contributors](https://github.com/jaywcjlove/github-action-contributors).
|
|
1059
1161
|
|
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.css
CHANGED