@uiw/react-md-editor 4.0.3 → 4.0.4
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 +21 -0
- package/commands-cn.d.ts +65 -0
- package/dist/mdeditor.css +50 -48
- package/dist/mdeditor.js +249 -220
- package/dist/mdeditor.min.css +1 -1
- package/dist/mdeditor.min.js +1 -1
- package/esm/commands/index.cn.d.ts +33 -0
- package/esm/commands/index.cn.js +197 -0
- package/lib/commands/index.cn.d.ts +33 -0
- package/lib/commands/index.cn.js +221 -0
- package/package.json +7 -1
- package/src/commands/index.cn.ts +187 -0
package/README.md
CHANGED
|
@@ -502,6 +502,27 @@ export default function App() {
|
|
|
502
502
|
}
|
|
503
503
|
```
|
|
504
504
|
|
|
505
|
+
Internationalization Example, You can refer to [`commands-cn`](https://github.com/uiwjs/react-md-editor/blob/b3743ed8302b544f03aed6ed82bdbdf39efb2204/core/src/commands/index.cn.ts#L5-L187) for internationalization.
|
|
506
|
+
|
|
507
|
+
```jsx mdx:preview
|
|
508
|
+
import React, { useContext } from "react";
|
|
509
|
+
import MDEditor, { commands } from "@uiw/react-md-editor";
|
|
510
|
+
import { getCommands, getExtraCommands } from "@uiw/react-md-editor/commands-cn";
|
|
511
|
+
|
|
512
|
+
export default function App() {
|
|
513
|
+
const [value, setValue] = React.useState("**Hello world!!!**");
|
|
514
|
+
return (
|
|
515
|
+
<MDEditor
|
|
516
|
+
value={value}
|
|
517
|
+
preview="edit"
|
|
518
|
+
commands={[...getCommands()]}
|
|
519
|
+
extraCommands={[...getExtraCommands()]}
|
|
520
|
+
onChange={(val) => setValue(val)}
|
|
521
|
+
/>
|
|
522
|
+
);
|
|
523
|
+
}
|
|
524
|
+
```
|
|
525
|
+
|
|
505
526
|
### Editor Font Size
|
|
506
527
|
|
|
507
528
|
[](https://codesandbox.io/embed/markdown-editor-for-react-uiwjs-react-md-editor-issues-425-2epmgh?fontsize=14&hidenavigation=1&theme=dark)
|
package/commands-cn.d.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
declare module '@uiw/react-md-editor/commands-cn' {
|
|
2
|
+
import { type ICommand } from '@uiw/react-md-editor/esm/commands';
|
|
3
|
+
import { divider } from '@uiw/react-md-editor/esm/commands/divider';
|
|
4
|
+
import { group } from '@uiw/react-md-editor/esm/commands/group';
|
|
5
|
+
let bold: ICommand;
|
|
6
|
+
let code: ICommand;
|
|
7
|
+
let codeBlock: ICommand;
|
|
8
|
+
let comment: ICommand;
|
|
9
|
+
let fullscreen: ICommand;
|
|
10
|
+
let hr: ICommand;
|
|
11
|
+
let image: ICommand;
|
|
12
|
+
let italic: ICommand;
|
|
13
|
+
let link: ICommand;
|
|
14
|
+
let checkedListCommand: ICommand;
|
|
15
|
+
let orderedListCommand: ICommand;
|
|
16
|
+
let unorderedListCommand: ICommand;
|
|
17
|
+
let codeEdit: ICommand;
|
|
18
|
+
let codeLive: ICommand;
|
|
19
|
+
let codePreview: ICommand;
|
|
20
|
+
let quote: ICommand;
|
|
21
|
+
let strikethrough: ICommand;
|
|
22
|
+
let issue: ICommand;
|
|
23
|
+
let title: ICommand;
|
|
24
|
+
let title1: ICommand;
|
|
25
|
+
let title2: ICommand;
|
|
26
|
+
let title3: ICommand;
|
|
27
|
+
let title4: ICommand;
|
|
28
|
+
let title5: ICommand;
|
|
29
|
+
let title6: ICommand;
|
|
30
|
+
let table: ICommand;
|
|
31
|
+
let help: ICommand;
|
|
32
|
+
export const getCommands: () => ICommand[];
|
|
33
|
+
export const getExtraCommands: () => ICommand[];
|
|
34
|
+
export {
|
|
35
|
+
title,
|
|
36
|
+
title1,
|
|
37
|
+
title2,
|
|
38
|
+
title3,
|
|
39
|
+
title4,
|
|
40
|
+
title5,
|
|
41
|
+
title6,
|
|
42
|
+
bold,
|
|
43
|
+
codeBlock,
|
|
44
|
+
comment,
|
|
45
|
+
italic,
|
|
46
|
+
strikethrough,
|
|
47
|
+
hr,
|
|
48
|
+
group,
|
|
49
|
+
divider,
|
|
50
|
+
link,
|
|
51
|
+
quote,
|
|
52
|
+
code,
|
|
53
|
+
image,
|
|
54
|
+
unorderedListCommand,
|
|
55
|
+
orderedListCommand,
|
|
56
|
+
checkedListCommand,
|
|
57
|
+
table,
|
|
58
|
+
issue,
|
|
59
|
+
help,
|
|
60
|
+
codeEdit,
|
|
61
|
+
codeLive,
|
|
62
|
+
codePreview,
|
|
63
|
+
fullscreen,
|
|
64
|
+
};
|
|
65
|
+
}
|
package/dist/mdeditor.css
CHANGED
|
@@ -44,6 +44,7 @@
|
|
|
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-copied-active-bg: #2e9b33;
|
|
47
48
|
}
|
|
48
49
|
}
|
|
49
50
|
@media (prefers-color-scheme: light) {
|
|
@@ -92,6 +93,7 @@
|
|
|
92
93
|
--color-accent-emphasis: #0969da;
|
|
93
94
|
--color-attention-subtle: #fff8c5;
|
|
94
95
|
--color-danger-fg: #cf222e;
|
|
96
|
+
--color-copied-active-bg: #2e9b33;
|
|
95
97
|
}
|
|
96
98
|
}
|
|
97
99
|
[data-color-mode*='dark'] .wmde-markdown,
|
|
@@ -889,7 +891,7 @@ body[data-color-mode*='light'] {
|
|
|
889
891
|
display: flex;
|
|
890
892
|
position: absolute;
|
|
891
893
|
cursor: pointer;
|
|
892
|
-
color: var(--color-fg-
|
|
894
|
+
color: var(--color-fg-default);
|
|
893
895
|
top: 6px;
|
|
894
896
|
right: 6px;
|
|
895
897
|
border-radius: 5px;
|
|
@@ -913,7 +915,7 @@ body[data-color-mode*='light'] {
|
|
|
913
915
|
}
|
|
914
916
|
.wmde-markdown pre:hover .copied:active,
|
|
915
917
|
.wmde-markdown pre .copied.active {
|
|
916
|
-
background:
|
|
918
|
+
background: var(--color-copied-active-bg);
|
|
917
919
|
color: var(--color-canvas-default);
|
|
918
920
|
}
|
|
919
921
|
.wmde-markdown pre .active .octicon-copy {
|
|
@@ -922,10 +924,10 @@ body[data-color-mode*='light'] {
|
|
|
922
924
|
.wmde-markdown pre .active .octicon-check {
|
|
923
925
|
display: block;
|
|
924
926
|
}
|
|
925
|
-
.highlight-line {
|
|
927
|
+
.wmde-markdown .highlight-line {
|
|
926
928
|
background-color: var(--color-neutral-muted);
|
|
927
929
|
}
|
|
928
|
-
.code-line.line-number::before {
|
|
930
|
+
.wmde-markdown .code-line.line-number::before {
|
|
929
931
|
display: inline-block;
|
|
930
932
|
width: 1rem;
|
|
931
933
|
text-align: right;
|
|
@@ -934,82 +936,82 @@ body[data-color-mode*='light'] {
|
|
|
934
936
|
content: attr(line);
|
|
935
937
|
white-space: nowrap;
|
|
936
938
|
}
|
|
937
|
-
.token.comment,
|
|
938
|
-
.token.prolog,
|
|
939
|
-
.token.doctype,
|
|
940
|
-
.token.cdata {
|
|
939
|
+
.wmde-markdown .token.comment,
|
|
940
|
+
.wmde-markdown .token.prolog,
|
|
941
|
+
.wmde-markdown .token.doctype,
|
|
942
|
+
.wmde-markdown .token.cdata {
|
|
941
943
|
color: var(--color-prettylights-syntax-comment);
|
|
942
944
|
}
|
|
943
|
-
.token.namespace {
|
|
945
|
+
.wmde-markdown .token.namespace {
|
|
944
946
|
opacity: 0.7;
|
|
945
947
|
}
|
|
946
|
-
.token.property,
|
|
947
|
-
.token.tag,
|
|
948
|
-
.token.selector,
|
|
949
|
-
.token.constant,
|
|
950
|
-
.token.symbol,
|
|
951
|
-
.token.deleted {
|
|
948
|
+
.wmde-markdown .token.property,
|
|
949
|
+
.wmde-markdown .token.tag,
|
|
950
|
+
.wmde-markdown .token.selector,
|
|
951
|
+
.wmde-markdown .token.constant,
|
|
952
|
+
.wmde-markdown .token.symbol,
|
|
953
|
+
.wmde-markdown .token.deleted {
|
|
952
954
|
color: var(--color-prettylights-syntax-entity-tag);
|
|
953
955
|
}
|
|
954
|
-
.token.maybe-class-name {
|
|
956
|
+
.wmde-markdown .token.maybe-class-name {
|
|
955
957
|
color: var(--color-prettylights-syntax-variable);
|
|
956
958
|
}
|
|
957
|
-
.token.property-access,
|
|
958
|
-
.token.operator,
|
|
959
|
-
.token.boolean,
|
|
960
|
-
.token.number,
|
|
961
|
-
.token.selector .token.class,
|
|
962
|
-
.token.attr-name,
|
|
963
|
-
.token.string,
|
|
964
|
-
.token.char,
|
|
965
|
-
.token.builtin {
|
|
959
|
+
.wmde-markdown .token.property-access,
|
|
960
|
+
.wmde-markdown .token.operator,
|
|
961
|
+
.wmde-markdown .token.boolean,
|
|
962
|
+
.wmde-markdown .token.number,
|
|
963
|
+
.wmde-markdown .token.selector .token.class,
|
|
964
|
+
.wmde-markdown .token.attr-name,
|
|
965
|
+
.wmde-markdown .token.string,
|
|
966
|
+
.wmde-markdown .token.char,
|
|
967
|
+
.wmde-markdown .token.builtin {
|
|
966
968
|
color: var(--color-prettylights-syntax-constant);
|
|
967
969
|
}
|
|
968
|
-
.token.deleted {
|
|
970
|
+
.wmde-markdown .token.deleted {
|
|
969
971
|
color: var(--color-prettylights-syntax-markup-deleted-text);
|
|
970
972
|
}
|
|
971
|
-
.code-line .token.deleted {
|
|
973
|
+
.wmde-markdown .code-line .token.deleted {
|
|
972
974
|
background-color: var(--color-prettylights-syntax-markup-deleted-bg);
|
|
973
975
|
}
|
|
974
|
-
.token.inserted {
|
|
976
|
+
.wmde-markdown .token.inserted {
|
|
975
977
|
color: var(--color-prettylights-syntax-markup-inserted-text);
|
|
976
978
|
}
|
|
977
|
-
.code-line .token.inserted {
|
|
979
|
+
.wmde-markdown .code-line .token.inserted {
|
|
978
980
|
background-color: var(--color-prettylights-syntax-markup-inserted-bg);
|
|
979
981
|
}
|
|
980
|
-
.token.variable {
|
|
982
|
+
.wmde-markdown .token.variable {
|
|
981
983
|
color: var(--color-prettylights-syntax-constant);
|
|
982
984
|
}
|
|
983
|
-
.token.entity,
|
|
984
|
-
.token.url,
|
|
985
|
-
.language-css .token.string,
|
|
986
|
-
.style .token.string {
|
|
985
|
+
.wmde-markdown .token.entity,
|
|
986
|
+
.wmde-markdown .token.url,
|
|
987
|
+
.wmde-markdown .language-css .token.string,
|
|
988
|
+
.wmde-markdown .style .token.string {
|
|
987
989
|
color: var(--color-prettylights-syntax-string);
|
|
988
990
|
}
|
|
989
|
-
.token.color,
|
|
990
|
-
.token.atrule,
|
|
991
|
-
.token.attr-value,
|
|
992
|
-
.token.function,
|
|
993
|
-
.token.class-name {
|
|
991
|
+
.wmde-markdown .token.color,
|
|
992
|
+
.wmde-markdown .token.atrule,
|
|
993
|
+
.wmde-markdown .token.attr-value,
|
|
994
|
+
.wmde-markdown .token.function,
|
|
995
|
+
.wmde-markdown .token.class-name {
|
|
994
996
|
color: var(--color-prettylights-syntax-string);
|
|
995
997
|
}
|
|
996
|
-
.token.rule,
|
|
997
|
-
.token.regex,
|
|
998
|
-
.token.important,
|
|
999
|
-
.token.keyword {
|
|
998
|
+
.wmde-markdown .token.rule,
|
|
999
|
+
.wmde-markdown .token.regex,
|
|
1000
|
+
.wmde-markdown .token.important,
|
|
1001
|
+
.wmde-markdown .token.keyword {
|
|
1000
1002
|
color: var(--color-prettylights-syntax-keyword);
|
|
1001
1003
|
}
|
|
1002
|
-
.token.coord {
|
|
1004
|
+
.wmde-markdown .token.coord {
|
|
1003
1005
|
color: var(--color-prettylights-syntax-meta-diff-range);
|
|
1004
1006
|
}
|
|
1005
|
-
.token.important,
|
|
1006
|
-
.token.bold {
|
|
1007
|
+
.wmde-markdown .token.important,
|
|
1008
|
+
.wmde-markdown .token.bold {
|
|
1007
1009
|
font-weight: bold;
|
|
1008
1010
|
}
|
|
1009
|
-
.token.italic {
|
|
1011
|
+
.wmde-markdown .token.italic {
|
|
1010
1012
|
font-style: italic;
|
|
1011
1013
|
}
|
|
1012
|
-
.token.entity {
|
|
1014
|
+
.wmde-markdown .token.entity {
|
|
1013
1015
|
cursor: help;
|
|
1014
1016
|
}
|
|
1015
1017
|
|