@uiw/react-md-editor 3.23.6 → 3.24.0
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 +29 -4
- package/dist/mdeditor.css +2 -0
- package/dist/mdeditor.js +225 -237
- package/dist/mdeditor.min.css +1 -1
- package/dist/mdeditor.min.js +1 -1
- package/dist/mdeditor.min.js.LICENSE.txt +1 -1
- package/esm/commands/bold.js +9 -13
- package/esm/commands/code.d.ts +1 -1
- package/esm/commands/code.js +75 -68
- package/esm/commands/comment.js +20 -18
- package/esm/commands/help.d.ts +2 -0
- package/esm/commands/help.js +22 -0
- package/esm/commands/hr.js +33 -2
- package/esm/commands/image.js +39 -16
- package/esm/commands/index.d.ts +3 -1
- package/esm/commands/index.js +3 -1
- package/esm/commands/issue.d.ts +2 -0
- package/esm/commands/issue.js +41 -0
- package/esm/commands/italic.js +9 -13
- package/esm/commands/link.js +40 -14
- package/esm/commands/list.d.ts +3 -10
- package/esm/commands/list.js +39 -41
- package/esm/commands/quote.js +8 -8
- package/esm/commands/strikeThrough.js +9 -13
- package/esm/commands/table.d.ts +2 -0
- package/esm/commands/table.js +57 -0
- package/esm/commands/title.d.ts +7 -1
- package/esm/commands/title.js +21 -0
- package/esm/commands/title1.js +9 -7
- package/esm/commands/title2.js +9 -7
- package/esm/commands/title3.js +9 -7
- package/esm/commands/title4.js +9 -7
- package/esm/commands/title5.js +9 -7
- package/esm/commands/title6.js +9 -7
- package/esm/components/TextArea/handleKeyDown.js +83 -3
- package/esm/utils/InsertTextAtPosition.d.ts +0 -7
- package/esm/utils/InsertTextAtPosition.js +6 -24
- package/esm/utils/markdownUtils.d.ts +23 -1
- package/esm/utils/markdownUtils.js +83 -4
- package/lib/Context.js +2 -3
- package/lib/Editor.js +1 -2
- package/lib/commands/bold.js +10 -15
- package/lib/commands/code.d.ts +1 -1
- package/lib/commands/code.js +75 -70
- package/lib/commands/comment.js +21 -20
- package/lib/commands/divider.js +2 -3
- package/lib/commands/fullscreen.js +2 -3
- package/lib/commands/group.js +2 -3
- package/lib/commands/help.d.ts +2 -0
- package/lib/commands/help.js +29 -0
- package/lib/commands/hr.js +35 -5
- package/lib/commands/image.js +40 -18
- package/lib/commands/index.d.ts +3 -1
- package/lib/commands/index.js +8 -10
- package/lib/commands/issue.d.ts +2 -0
- package/lib/commands/issue.js +48 -0
- package/lib/commands/italic.js +10 -15
- package/lib/commands/link.js +41 -16
- package/lib/commands/list.d.ts +3 -10
- package/lib/commands/list.js +43 -52
- package/lib/commands/preview.js +4 -7
- package/lib/commands/quote.js +9 -10
- package/lib/commands/strikeThrough.js +10 -15
- package/lib/commands/table.d.ts +2 -0
- package/lib/commands/table.js +64 -0
- package/lib/commands/title.d.ts +7 -1
- package/lib/commands/title.js +23 -3
- package/lib/commands/title1.js +11 -10
- package/lib/commands/title2.js +11 -10
- package/lib/commands/title3.js +11 -10
- package/lib/commands/title4.js +11 -10
- package/lib/commands/title5.js +11 -10
- package/lib/commands/title6.js +11 -10
- package/lib/components/DragBar/index.js +1 -2
- package/lib/components/TextArea/handleKeyDown.js +84 -4
- package/lib/index.js +1 -2
- package/lib/utils/InsertTextAtPosition.d.ts +0 -7
- package/lib/utils/InsertTextAtPosition.js +6 -26
- package/lib/utils/markdownUtils.d.ts +23 -1
- package/lib/utils/markdownUtils.js +84 -4
- package/package.json +4 -1
- package/src/commands/bold.tsx +13 -12
- package/src/commands/code.tsx +72 -71
- package/src/commands/comment.tsx +20 -15
- package/src/commands/help.tsx +19 -0
- package/src/commands/hr.tsx +33 -2
- package/src/commands/image.tsx +38 -15
- package/src/commands/index.ts +8 -1
- package/src/commands/issue.tsx +36 -0
- package/src/commands/italic.tsx +13 -12
- package/src/commands/link.tsx +39 -12
- package/src/commands/list.tsx +35 -53
- package/src/commands/quote.tsx +14 -13
- package/src/commands/strikeThrough.tsx +13 -12
- package/src/commands/table.tsx +52 -0
- package/src/commands/title.tsx +18 -1
- package/src/commands/title1.tsx +6 -9
- package/src/commands/title2.tsx +6 -9
- package/src/commands/title3.tsx +6 -9
- package/src/commands/title4.tsx +6 -9
- package/src/commands/title5.tsx +6 -9
- package/src/commands/title6.tsx +6 -9
- package/src/components/TextArea/handleKeyDown.tsx +50 -3
- package/src/utils/InsertTextAtPosition.ts +7 -28
- package/src/utils/markdownUtils.ts +94 -4
package/README.md
CHANGED
|
@@ -46,6 +46,7 @@ A simple markdown editor with preview, implemented with React.js and TypeScript.
|
|
|
46
46
|
- 😻 GitHub flavored markdown support.
|
|
47
47
|
- 🌒 Support dark-mode/night-mode **@v3.11.0+**.
|
|
48
48
|
- 💡 Support [next.js](https://github.com/uiwjs/react-md-editor/issues/52#issuecomment-848969341), [Use examples](#support-nextjs) in [next.js](https://nextjs.org/).
|
|
49
|
+
- Line/lines duplication (Ctrl+D) and movement (Alt+UpArrow/DownArrow) **@v3.24.0+**.
|
|
49
50
|
|
|
50
51
|
### Quick Start
|
|
51
52
|
|
|
@@ -398,6 +399,27 @@ const codePreview = {
|
|
|
398
399
|
icon: <Button />
|
|
399
400
|
};
|
|
400
401
|
|
|
402
|
+
const Disable = () => {
|
|
403
|
+
const { preview, dispatch } = useContext(EditorContext);
|
|
404
|
+
return (
|
|
405
|
+
<button disabled={preview === "preview"}>
|
|
406
|
+
<svg viewBox="0 0 16 16" width="12px" height="12px">
|
|
407
|
+
<path
|
|
408
|
+
d="M8 0C3.6 0 0 3.6 0 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8Zm.9 13H7v-1.8h1.9V13Zm-.1-3.6v.5H7.1v-.6c.2-2.1 2-1.9 1.9-3.2.1-.7-.3-1.1-1-1.1-.8 0-1.2.7-1.2 1.6H5c0-1.7 1.2-3 2.9-3 2.3 0 3 1.4 3 2.3.1 2.3-1.9 2-2.1 3.5Z"
|
|
409
|
+
fill="currentColor"
|
|
410
|
+
/>
|
|
411
|
+
</svg>
|
|
412
|
+
</button>
|
|
413
|
+
)
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
const customButton = {
|
|
417
|
+
name: "disable",
|
|
418
|
+
keyCommand: "disable",
|
|
419
|
+
value: "disable",
|
|
420
|
+
icon: <Disable />
|
|
421
|
+
}
|
|
422
|
+
|
|
401
423
|
export default function App() {
|
|
402
424
|
const [value, setValue] = React.useState("**Hello world!!!**");
|
|
403
425
|
return (
|
|
@@ -406,7 +428,7 @@ export default function App() {
|
|
|
406
428
|
<MDEditor
|
|
407
429
|
value={value}
|
|
408
430
|
preview="edit"
|
|
409
|
-
extraCommands={[codePreview, commands.fullscreen]}
|
|
431
|
+
extraCommands={[codePreview, customButton, commands.fullscreen]}
|
|
410
432
|
onChange={(val) => setValue(val)}
|
|
411
433
|
/>
|
|
412
434
|
</div>
|
|
@@ -542,7 +564,7 @@ export default function App() {
|
|
|
542
564
|
});
|
|
543
565
|
return <code style={{ fontSize: '150%' }} dangerouslySetInnerHTML={{ __html: html }} />;
|
|
544
566
|
}
|
|
545
|
-
return <code className={String(className)}>{
|
|
567
|
+
return <code className={String(className)}>{children}</code>;
|
|
546
568
|
},
|
|
547
569
|
},
|
|
548
570
|
}}
|
|
@@ -830,8 +852,8 @@ As always, thanks to our amazing contributors!
|
|
|
830
852
|
<a href="https://github.com/nuragic" title="Andrea Puddu">
|
|
831
853
|
<img src="https://avatars.githubusercontent.com/u/1586378?v=4" width="42;" alt="Andrea Puddu"/>
|
|
832
854
|
</a>
|
|
833
|
-
<a href="https://github.com/bramus" title="Bramus
|
|
834
|
-
<img src="https://avatars.githubusercontent.com/u/213073?v=4" width="42;" alt="Bramus
|
|
855
|
+
<a href="https://github.com/bramus" title="Bramus">
|
|
856
|
+
<img src="https://avatars.githubusercontent.com/u/213073?v=4" width="42;" alt="Bramus"/>
|
|
835
857
|
</a>
|
|
836
858
|
<a href="https://github.com/CarleneCannon-Conner" title="Carlene Cannon-Conner">
|
|
837
859
|
<img src="https://avatars.githubusercontent.com/u/1942791?v=4" width="42;" alt="Carlene Cannon-Conner"/>
|
|
@@ -860,6 +882,9 @@ As always, thanks to our amazing contributors!
|
|
|
860
882
|
<a href="https://github.com/phillipb" title="Phillip Burch">
|
|
861
883
|
<img src="https://avatars.githubusercontent.com/u/1482089?v=4" width="42;" alt="Phillip Burch"/>
|
|
862
884
|
</a>
|
|
885
|
+
<a href="https://github.com/RARgames" title="RAR">
|
|
886
|
+
<img src="https://avatars.githubusercontent.com/u/13639766?v=4" width="42;" alt="RAR"/>
|
|
887
|
+
</a>
|
|
863
888
|
<a href="https://github.com/toresbe" title="Tore Sinding Bekkedal">
|
|
864
889
|
<img src="https://avatars.githubusercontent.com/u/1761606?v=4" width="42;" alt="Tore Sinding Bekkedal"/>
|
|
865
890
|
</a>
|
package/dist/mdeditor.css
CHANGED
|
@@ -1288,7 +1288,9 @@ body[data-color-mode*='light'] {
|
|
|
1288
1288
|
--md-editor-font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
|
1289
1289
|
--md-editor-background-color: var(--color-canvas-default, #ffffff);
|
|
1290
1290
|
--md-editor-box-shadow-color: var(--color-border-default, #d0d7de);
|
|
1291
|
+
box-shadow: 0 0 0 1px #d0d7de, 0 0 0 #d0d7de, 0 1px 1px #d0d7de;
|
|
1291
1292
|
box-shadow: 0 0 0 1px var(--md-editor-box-shadow-color), 0 0 0 var(--md-editor-box-shadow-color), 0 1px 1px var(--md-editor-box-shadow-color);
|
|
1293
|
+
background-color: #ffffff;
|
|
1292
1294
|
background-color: var(--md-editor-background-color);
|
|
1293
1295
|
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
|
1294
1296
|
display: flex;
|