@uiw/react-md-editor 4.0.3 → 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.
- package/README.md +93 -75
- package/commands-cn.d.ts +65 -0
- package/dist/mdeditor.css +136 -50
- package/dist/mdeditor.js +65641 -66215
- package/dist/mdeditor.min.css +1 -1
- package/dist/mdeditor.min.js +1 -1
- package/dist/mdeditor.min.js.LICENSE.txt +2 -2
- package/esm/Context.d.ts +20 -33
- package/esm/Editor.js +1 -2
- package/esm/Editor.nohighlight.js +1 -2
- package/esm/Types.d.ts +1 -1
- package/esm/commands/comment.js +1 -2
- package/esm/commands/group.d.ts +1 -1
- package/esm/commands/index.cn.d.ts +33 -0
- package/esm/commands/index.cn.js +197 -0
- package/esm/commands/issue.js +2 -2
- package/esm/commands/preview.js +1 -2
- package/esm/components/TextArea/handleKeyDown.d.ts +0 -1
- package/esm/components/TextArea/index.d.ts +1 -1
- package/esm/components/TextArea/index.js +5 -6
- package/esm/components/TextArea/index.nohighlight.d.ts +1 -1
- package/esm/components/TextArea/index.nohighlight.js +4 -4
- package/esm/components/TextArea/shortcuts.d.ts +0 -1
- package/esm/components/Toolbar/Child.d.ts +1 -1
- package/esm/components/Toolbar/index.js +1 -2
- package/lib/Context.d.ts +20 -33
- package/lib/Types.d.ts +1 -1
- package/lib/commands/group.d.ts +1 -1
- package/lib/commands/index.cn.d.ts +33 -0
- package/lib/commands/index.cn.js +221 -0
- package/lib/commands/index.js +2 -4
- package/lib/commands/issue.js +2 -2
- package/lib/components/TextArea/handleKeyDown.d.ts +0 -1
- package/lib/components/TextArea/index.d.ts +1 -1
- package/lib/components/TextArea/index.js +4 -4
- package/lib/components/TextArea/index.nohighlight.d.ts +1 -1
- package/lib/components/TextArea/index.nohighlight.js +4 -4
- package/lib/components/TextArea/shortcuts.d.ts +0 -1
- package/lib/components/Toolbar/Child.d.ts +1 -1
- package/package.json +7 -1
- package/src/Types.ts +1 -1
- package/src/commands/index.cn.ts +187 -0
- package/src/commands/issue.tsx +2 -2
- package/src/components/TextArea/index.nohighlight.tsx +1 -1
- package/src/components/TextArea/index.tsx +1 -1
- package/src/components/Toolbar/Child.tsx +1 -1
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
/**!
|
|
12
|
-
* @uiw/copy-to-clipboard v1.0.
|
|
12
|
+
* @uiw/copy-to-clipboard v1.0.17
|
|
13
13
|
* Copy to clipboard.
|
|
14
14
|
*
|
|
15
|
-
* Copyright (c)
|
|
15
|
+
* Copyright (c) 2024 Kenny Wang
|
|
16
16
|
* https://github.com/uiwjs/copy-to-clipboard.git
|
|
17
17
|
*
|
|
18
18
|
* @website: https://uiwjs.github.io/copy-to-clipboard
|
package/esm/Context.d.ts
CHANGED
|
@@ -28,38 +28,25 @@ export interface ContextStore {
|
|
|
28
28
|
export type ExecuteCommandState = Pick<ContextStore, 'fullscreen' | 'preview' | 'highlightEnable'>;
|
|
29
29
|
export declare function reducer(state: ContextStore, action: ContextStore): {
|
|
30
30
|
[x: string]: any;
|
|
31
|
-
components?:
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
highlightEnable?: boolean | undefined;
|
|
52
|
-
autoFocus?: boolean | undefined;
|
|
53
|
-
textarea?: HTMLTextAreaElement | undefined;
|
|
54
|
-
commandOrchestrator?: TextAreaCommandOrchestrator | undefined;
|
|
55
|
-
textareaWarp?: HTMLDivElement | undefined;
|
|
56
|
-
textareaPre?: HTMLPreElement | undefined;
|
|
57
|
-
container?: HTMLDivElement | null | undefined;
|
|
58
|
-
dispatch?: React.Dispatch<ContextStore> | undefined;
|
|
59
|
-
barPopup?: Record<string, boolean> | undefined;
|
|
60
|
-
scrollTop?: number | undefined;
|
|
61
|
-
scrollTopPreview?: number | undefined;
|
|
62
|
-
tabSize?: number | undefined;
|
|
63
|
-
defaultTabEnable?: boolean | undefined;
|
|
31
|
+
components?: MDEditorProps["components"];
|
|
32
|
+
commands?: ICommand<string>[];
|
|
33
|
+
extraCommands?: ICommand<string>[];
|
|
34
|
+
markdown?: string;
|
|
35
|
+
preview?: PreviewType;
|
|
36
|
+
height?: React.CSSProperties["height"];
|
|
37
|
+
fullscreen?: boolean;
|
|
38
|
+
highlightEnable?: boolean;
|
|
39
|
+
autoFocus?: boolean;
|
|
40
|
+
textarea?: HTMLTextAreaElement;
|
|
41
|
+
commandOrchestrator?: TextAreaCommandOrchestrator;
|
|
42
|
+
textareaWarp?: HTMLDivElement;
|
|
43
|
+
textareaPre?: HTMLPreElement;
|
|
44
|
+
container?: HTMLDivElement | null;
|
|
45
|
+
dispatch?: React.Dispatch<ContextStore>;
|
|
46
|
+
barPopup?: Record<string, boolean>;
|
|
47
|
+
scrollTop?: number;
|
|
48
|
+
scrollTopPreview?: number;
|
|
49
|
+
tabSize?: number;
|
|
50
|
+
defaultTabEnable?: boolean;
|
|
64
51
|
};
|
|
65
52
|
export declare const EditorContext: React.Context<ContextStore>;
|
package/esm/Editor.js
CHANGED
|
@@ -8,8 +8,7 @@ import { ToolbarVisibility } from './components/Toolbar';
|
|
|
8
8
|
import DragBar from './components/DragBar';
|
|
9
9
|
import { getCommands, getExtraCommands, TextAreaCommandOrchestrator } from './commands';
|
|
10
10
|
import { reducer, EditorContext } from './Context';
|
|
11
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
12
|
function setGroupPopFalse(data) {
|
|
14
13
|
if (data === void 0) {
|
|
15
14
|
data = {};
|
|
@@ -8,8 +8,7 @@ import { ToolbarVisibility } from './components/Toolbar';
|
|
|
8
8
|
import DragBar from './components/DragBar';
|
|
9
9
|
import { getCommands, getExtraCommands, TextAreaCommandOrchestrator } from './commands';
|
|
10
10
|
import { reducer, EditorContext } from './Context';
|
|
11
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
12
|
function setGroupPopFalse(data) {
|
|
14
13
|
if (data === void 0) {
|
|
15
14
|
data = {};
|
package/esm/Types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CSSProperties } from 'react';
|
|
1
|
+
import type { CSSProperties, JSX } from 'react';
|
|
2
2
|
import type { MarkdownPreviewProps } from '@uiw/react-markdown-preview/nohighlight';
|
|
3
3
|
import type { ITextAreaProps } from './components/TextArea/index.nohighlight';
|
|
4
4
|
import type { ICommand, TextState } from './commands';
|
package/esm/commands/comment.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { selectWord, executeCommand } from '../utils/markdownUtils';
|
|
3
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
4
|
export var comment = {
|
|
6
5
|
name: 'comment',
|
|
7
6
|
keyCommand: 'comment',
|
package/esm/commands/group.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ import { ICommand, ICommandChildCommands, ICommandChildHandle } from './';
|
|
|
2
2
|
export type GroupOptions = Omit<ICommand<string>, 'children'> & {
|
|
3
3
|
children?: ICommandChildHandle['children'];
|
|
4
4
|
};
|
|
5
|
-
export declare const group: (arr: ICommandChildCommands[
|
|
5
|
+
export declare const group: (arr: ICommandChildCommands["children"], options?: GroupOptions) => ICommand<string>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type ICommand } from './';
|
|
2
|
+
import { divider } from './divider';
|
|
3
|
+
import { group } from './group';
|
|
4
|
+
declare let bold: ICommand;
|
|
5
|
+
declare let code: ICommand;
|
|
6
|
+
declare let codeBlock: ICommand;
|
|
7
|
+
declare let comment: ICommand;
|
|
8
|
+
declare let fullscreen: ICommand;
|
|
9
|
+
declare let hr: ICommand;
|
|
10
|
+
declare let image: ICommand;
|
|
11
|
+
declare let italic: ICommand;
|
|
12
|
+
declare let link: ICommand;
|
|
13
|
+
declare let checkedListCommand: ICommand;
|
|
14
|
+
declare let orderedListCommand: ICommand;
|
|
15
|
+
declare let unorderedListCommand: ICommand;
|
|
16
|
+
declare let codeEdit: ICommand;
|
|
17
|
+
declare let codeLive: ICommand;
|
|
18
|
+
declare let codePreview: ICommand;
|
|
19
|
+
declare let quote: ICommand;
|
|
20
|
+
declare let strikethrough: ICommand;
|
|
21
|
+
declare let issue: ICommand;
|
|
22
|
+
declare let title: ICommand;
|
|
23
|
+
declare let title1: ICommand;
|
|
24
|
+
declare let title2: ICommand;
|
|
25
|
+
declare let title3: ICommand;
|
|
26
|
+
declare let title4: ICommand;
|
|
27
|
+
declare let title5: ICommand;
|
|
28
|
+
declare let title6: ICommand;
|
|
29
|
+
declare let table: ICommand;
|
|
30
|
+
declare let help: ICommand;
|
|
31
|
+
export declare const getCommands: () => ICommand[];
|
|
32
|
+
export declare const getExtraCommands: () => ICommand[];
|
|
33
|
+
export { title, title1, title2, title3, title4, title5, title6, bold, codeBlock, comment, italic, strikethrough, hr, group, divider, link, quote, code, image, unorderedListCommand, orderedListCommand, checkedListCommand, table, issue, help, codeEdit, codeLive, codePreview, fullscreen, };
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import { divider } from './divider';
|
|
3
|
+
import { group } from './group';
|
|
4
|
+
import { bold as boldInit } from './bold';
|
|
5
|
+
import { code as codeInit, codeBlock as codeBlockInit } from './code';
|
|
6
|
+
import { comment as commentInit } from './comment';
|
|
7
|
+
import { fullscreen as fullscreenInit } from './fullscreen';
|
|
8
|
+
import { hr as hrInit } from './hr';
|
|
9
|
+
import { image as imageInit } from './image';
|
|
10
|
+
import { italic as italicInit } from './italic';
|
|
11
|
+
import { link as linkInit } from './link';
|
|
12
|
+
import { checkedListCommand as checkedListCommandInit, orderedListCommand as orderedListCommandInit, unorderedListCommand as unorderedListCommandInit } from './list';
|
|
13
|
+
import { codeEdit as codeEditInit, codeLive as codeLiveInit, codePreview as codePreviewInit } from './preview';
|
|
14
|
+
import { quote as quoteInit } from './quote';
|
|
15
|
+
import { strikethrough as strikethroughInit } from './strikeThrough';
|
|
16
|
+
import { issue as issueInit } from './issue';
|
|
17
|
+
import { title as titleInit } from './title';
|
|
18
|
+
import { title1 as title1Init } from './title1';
|
|
19
|
+
import { title2 as title2Init } from './title2';
|
|
20
|
+
import { title3 as title3Init } from './title3';
|
|
21
|
+
import { title4 as title4Init } from './title4';
|
|
22
|
+
import { title5 as title5Init } from './title5';
|
|
23
|
+
import { title6 as title6Init } from './title6';
|
|
24
|
+
import { table as tableInit } from './table';
|
|
25
|
+
import { help as helpInit } from './help';
|
|
26
|
+
var bold = _extends({}, boldInit, {
|
|
27
|
+
buttonProps: {
|
|
28
|
+
'aria-label': '添加粗体文本(ctrl + b)',
|
|
29
|
+
title: '添加粗体文本(ctrl + b)'
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
var code = _extends({}, codeInit, {
|
|
33
|
+
buttonProps: {
|
|
34
|
+
'aria-label': '插入代码(ctrl + j)',
|
|
35
|
+
title: '插入代码(ctrl + j)'
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
var codeBlock = _extends({}, codeBlockInit, {
|
|
39
|
+
buttonProps: {
|
|
40
|
+
'aria-label': '插入代码块(ctrl + shift + j)',
|
|
41
|
+
title: '插入代码块(ctrl + shift + j)'
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
var comment = _extends({}, commentInit, {
|
|
45
|
+
buttonProps: {
|
|
46
|
+
'aria-label': '插入注释(ctrl + /)',
|
|
47
|
+
title: '插入注释(ctrl + /)'
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
var fullscreen = _extends({}, fullscreenInit, {
|
|
51
|
+
buttonProps: {
|
|
52
|
+
'aria-label': '切换全屏(ctrl + 0)',
|
|
53
|
+
title: '切换全屏(ctrl + 0)'
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
var hr = _extends({}, hrInit, {
|
|
57
|
+
buttonProps: {
|
|
58
|
+
'aria-label': '插入HR (ctrl + h)',
|
|
59
|
+
title: '插入HR (ctrl + h)'
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
var image = _extends({}, imageInit, {
|
|
63
|
+
buttonProps: {
|
|
64
|
+
'aria-label': '添加图像(ctrl + k)',
|
|
65
|
+
title: '添加图像(ctrl + k)'
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
var italic = _extends({}, italicInit, {
|
|
69
|
+
buttonProps: {
|
|
70
|
+
'aria-label': '添加斜体文本(ctrl + i)',
|
|
71
|
+
title: '添加斜体文本(ctrl + i)'
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
var link = _extends({}, linkInit, {
|
|
75
|
+
buttonProps: {
|
|
76
|
+
'aria-label': '添加链接(ctrl + l)',
|
|
77
|
+
title: '添加链接(ctrl + l)'
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
var checkedListCommand = _extends({}, checkedListCommandInit, {
|
|
81
|
+
buttonProps: {
|
|
82
|
+
'aria-label': '添加检查列表(ctrl + shift + c)',
|
|
83
|
+
title: '添加检查列表(ctrl + shift + c)'
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
var orderedListCommand = _extends({}, orderedListCommandInit, {
|
|
87
|
+
buttonProps: {
|
|
88
|
+
'aria-label': '添加有序列表(ctrl + shift + o)',
|
|
89
|
+
title: '添加有序列表(ctrl + shift + o)'
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
var unorderedListCommand = _extends({}, unorderedListCommandInit, {
|
|
93
|
+
buttonProps: {
|
|
94
|
+
'aria-label': '添加无序列表(ctrl + shift + u)',
|
|
95
|
+
title: '添加无序列表(ctrl + shift + u)'
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
var codeEdit = _extends({}, codeEditInit, {
|
|
99
|
+
buttonProps: {
|
|
100
|
+
'aria-label': '编辑代码(ctrl + 7)',
|
|
101
|
+
title: '编辑代码(ctrl + 7)'
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
var codeLive = _extends({}, codeLiveInit, {
|
|
105
|
+
buttonProps: {
|
|
106
|
+
'aria-label': '实时代码(ctrl + 8)',
|
|
107
|
+
title: '实时代码(ctrl + 8)'
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
var codePreview = _extends({}, codePreviewInit, {
|
|
111
|
+
buttonProps: {
|
|
112
|
+
'aria-label': '预览代码(ctrl + 9)',
|
|
113
|
+
title: '预览代码(ctrl + 9)'
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
var quote = _extends({}, quoteInit, {
|
|
117
|
+
buttonProps: {
|
|
118
|
+
'aria-label': '预览代码(ctrl + 9)',
|
|
119
|
+
title: '预览代码(ctrl + 9)'
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
var strikethrough = _extends({}, strikethroughInit, {
|
|
123
|
+
buttonProps: {
|
|
124
|
+
'aria-label': 'Add strikethrough text (ctrl + shift + x)',
|
|
125
|
+
title: 'Add strikethrough text (ctrl + shift + x)'
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
var issue = _extends({}, issueInit, {
|
|
129
|
+
buttonProps: {
|
|
130
|
+
'aria-label': '添加 issue',
|
|
131
|
+
title: '添加 issue'
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
var title = _extends({}, titleInit, {
|
|
135
|
+
buttonProps: {
|
|
136
|
+
'aria-label': '插入 title (ctrl + 1)',
|
|
137
|
+
title: '插入 title (ctrl + 1)'
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
var title1 = _extends({}, title1Init, {
|
|
141
|
+
buttonProps: {
|
|
142
|
+
'aria-label': '插入 title1 (ctrl + 1)',
|
|
143
|
+
title: '插入 title1 (ctrl + 1)'
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
var title2 = _extends({}, title2Init, {
|
|
147
|
+
buttonProps: {
|
|
148
|
+
'aria-label': '插入 title2 (ctrl + 2)',
|
|
149
|
+
title: '插入 title2 (ctrl + 2)'
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
var title3 = _extends({}, title3Init, {
|
|
153
|
+
buttonProps: {
|
|
154
|
+
'aria-label': '插入 title3 (ctrl + 3)',
|
|
155
|
+
title: '插入 title3 (ctrl + 3)'
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
var title4 = _extends({}, title4Init, {
|
|
159
|
+
buttonProps: {
|
|
160
|
+
'aria-label': '插入 title4 (ctrl + 4)',
|
|
161
|
+
title: '插入 title4 (ctrl + 4)'
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
var title5 = _extends({}, title5Init, {
|
|
165
|
+
buttonProps: {
|
|
166
|
+
'aria-label': '插入 title5 (ctrl + 5)',
|
|
167
|
+
title: '插入 title5 (ctrl + 5)'
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
var title6 = _extends({}, title6Init, {
|
|
171
|
+
buttonProps: {
|
|
172
|
+
'aria-label': '插入 title6 (ctrl + 6)',
|
|
173
|
+
title: '插入 title6 (ctrl + 6)'
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
var table = _extends({}, tableInit, {
|
|
177
|
+
buttonProps: {
|
|
178
|
+
'aria-label': '添加表格',
|
|
179
|
+
title: '添加表格'
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
var help = _extends({}, helpInit, {
|
|
183
|
+
buttonProps: {
|
|
184
|
+
'aria-label': '打开帮助',
|
|
185
|
+
title: '打开帮助'
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
export var getCommands = () => [bold, italic, strikethrough, hr, group([title1, title2, title3, title4, title5, title6], {
|
|
189
|
+
name: 'title',
|
|
190
|
+
groupName: 'title',
|
|
191
|
+
buttonProps: {
|
|
192
|
+
'aria-label': '插入标题',
|
|
193
|
+
title: 'I插入标题'
|
|
194
|
+
}
|
|
195
|
+
}), divider, link, quote, code, codeBlock, comment, image, table, divider, unorderedListCommand, orderedListCommand, checkedListCommand, divider, help];
|
|
196
|
+
export var getExtraCommands = () => [codeEdit, codeLive, codePreview, divider, fullscreen];
|
|
197
|
+
export { title, title1, title2, title3, title4, title5, title6, bold, codeBlock, comment, italic, strikethrough, hr, group, divider, link, quote, code, image, unorderedListCommand, orderedListCommand, checkedListCommand, table, issue, help, codeEdit, codeLive, codePreview, fullscreen };
|
package/esm/commands/issue.js
CHANGED
|
@@ -17,8 +17,8 @@ export var issue = {
|
|
|
17
17
|
viewBox: "0 0 448 512",
|
|
18
18
|
children: /*#__PURE__*/_jsx("path", {
|
|
19
19
|
fill: "currentColor",
|
|
20
|
-
d: "M181.3 32.4c17.4 2.9 29.2 19.4 26.3 36.8L197.8
|
|
21
|
-
//Font Awesome Free 6.
|
|
20
|
+
d: "M181.3 32.4c17.4 2.9 29.2 19.4 26.3 36.8L197.8 128l95.1 0 11.5-69.3c2.9-17.4 19.4-29.2 36.8-26.3s29.2 19.4 26.3 36.8L357.8 128l58.2 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-68.9 0L325.8 320l58.2 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-68.9 0-11.5 69.3c-2.9 17.4-19.4 29.2-36.8 26.3s-29.2-19.4-26.3-36.8l9.8-58.7-95.1 0-11.5 69.3c-2.9 17.4-19.4 29.2-36.8 26.3s-29.2-19.4-26.3-36.8L90.2 384 32 384c-17.7 0-32-14.3-32-32s14.3-32 32-32l68.9 0 21.3-128L64 192c-17.7 0-32-14.3-32-32s14.3-32 32-32l68.9 0 11.5-69.3c2.9-17.4 19.4-29.2 36.8-26.3zM187.1 192L165.8 320l95.1 0 21.3-128-95.1 0z"
|
|
21
|
+
//Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com
|
|
22
22
|
})
|
|
23
23
|
}),
|
|
24
24
|
execute: (state, api) => {
|
package/esm/commands/preview.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
3
|
export var codePreview = {
|
|
5
4
|
name: 'preview',
|
|
6
5
|
keyCommand: 'preview',
|
|
@@ -8,8 +8,7 @@ import Markdown from './Markdown';
|
|
|
8
8
|
import Textarea from './Textarea';
|
|
9
9
|
import { TextAreaCommandOrchestrator } from '../../commands';
|
|
10
10
|
import "./index.css";
|
|
11
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
12
|
export default function TextArea(props) {
|
|
14
13
|
var _ref = props || {},
|
|
15
14
|
{
|
|
@@ -44,11 +43,11 @@ export default function TextArea(props) {
|
|
|
44
43
|
}, []);
|
|
45
44
|
useEffect(() => {
|
|
46
45
|
if (textRef.current && dispatch) {
|
|
47
|
-
var
|
|
48
|
-
executeRef.current =
|
|
46
|
+
var commandOrchestrator = new TextAreaCommandOrchestrator(textRef.current);
|
|
47
|
+
executeRef.current = commandOrchestrator;
|
|
49
48
|
dispatch({
|
|
50
49
|
textarea: textRef.current,
|
|
51
|
-
commandOrchestrator
|
|
50
|
+
commandOrchestrator
|
|
52
51
|
});
|
|
53
52
|
}
|
|
54
53
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -66,7 +65,7 @@ export default function TextArea(props) {
|
|
|
66
65
|
style: {
|
|
67
66
|
minHeight
|
|
68
67
|
},
|
|
69
|
-
children: renderTextarea ? (
|
|
68
|
+
children: renderTextarea ? (/*#__PURE__*/React.cloneElement(renderTextarea(_extends({}, otherProps, {
|
|
70
69
|
value: markdown,
|
|
71
70
|
autoComplete: 'off',
|
|
72
71
|
autoCorrect: 'off',
|
|
@@ -40,11 +40,11 @@ export default function TextArea(props) {
|
|
|
40
40
|
}, []);
|
|
41
41
|
useEffect(() => {
|
|
42
42
|
if (textRef.current && dispatch) {
|
|
43
|
-
var
|
|
44
|
-
executeRef.current =
|
|
43
|
+
var commandOrchestrator = new TextAreaCommandOrchestrator(textRef.current);
|
|
44
|
+
executeRef.current = commandOrchestrator;
|
|
45
45
|
dispatch({
|
|
46
46
|
textarea: textRef.current,
|
|
47
|
-
commandOrchestrator
|
|
47
|
+
commandOrchestrator
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
50
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -59,7 +59,7 @@ export default function TextArea(props) {
|
|
|
59
59
|
onScroll: onScroll,
|
|
60
60
|
children: /*#__PURE__*/_jsx("div", {
|
|
61
61
|
className: prefixCls + "-text",
|
|
62
|
-
children: renderTextarea ? (
|
|
62
|
+
children: renderTextarea ? (/*#__PURE__*/React.cloneElement(renderTextarea(_extends({}, otherProps, {
|
|
63
63
|
value: markdown,
|
|
64
64
|
autoComplete: 'off',
|
|
65
65
|
autoCorrect: 'off',
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { ICommand, TextAreaCommandOrchestrator } from '../../commands';
|
|
3
2
|
import { ContextStore, ExecuteCommandState } from '../../Context';
|
|
4
3
|
export default function shortcutsHandle(e: KeyboardEvent | React.KeyboardEvent<HTMLTextAreaElement>, commands?: ICommand[], commandOrchestrator?: TextAreaCommandOrchestrator, dispatch?: React.Dispatch<ContextStore>, state?: ExecuteCommandState): void;
|
|
@@ -3,8 +3,7 @@ import React, { Fragment, useContext, useEffect, useRef } from 'react';
|
|
|
3
3
|
import { EditorContext } from '../../Context';
|
|
4
4
|
import Child from './Child';
|
|
5
5
|
import "./index.css";
|
|
6
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
7
|
export function ToolbarItems(props) {
|
|
9
8
|
var {
|
|
10
9
|
prefixCls,
|
package/lib/Context.d.ts
CHANGED
|
@@ -28,38 +28,25 @@ export interface ContextStore {
|
|
|
28
28
|
export type ExecuteCommandState = Pick<ContextStore, 'fullscreen' | 'preview' | 'highlightEnable'>;
|
|
29
29
|
export declare function reducer(state: ContextStore, action: ContextStore): {
|
|
30
30
|
[x: string]: any;
|
|
31
|
-
components?:
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
highlightEnable?: boolean | undefined;
|
|
52
|
-
autoFocus?: boolean | undefined;
|
|
53
|
-
textarea?: HTMLTextAreaElement | undefined;
|
|
54
|
-
commandOrchestrator?: TextAreaCommandOrchestrator | undefined;
|
|
55
|
-
textareaWarp?: HTMLDivElement | undefined;
|
|
56
|
-
textareaPre?: HTMLPreElement | undefined;
|
|
57
|
-
container?: HTMLDivElement | null | undefined;
|
|
58
|
-
dispatch?: React.Dispatch<ContextStore> | undefined;
|
|
59
|
-
barPopup?: Record<string, boolean> | undefined;
|
|
60
|
-
scrollTop?: number | undefined;
|
|
61
|
-
scrollTopPreview?: number | undefined;
|
|
62
|
-
tabSize?: number | undefined;
|
|
63
|
-
defaultTabEnable?: boolean | undefined;
|
|
31
|
+
components?: MDEditorProps["components"];
|
|
32
|
+
commands?: ICommand<string>[];
|
|
33
|
+
extraCommands?: ICommand<string>[];
|
|
34
|
+
markdown?: string;
|
|
35
|
+
preview?: PreviewType;
|
|
36
|
+
height?: React.CSSProperties["height"];
|
|
37
|
+
fullscreen?: boolean;
|
|
38
|
+
highlightEnable?: boolean;
|
|
39
|
+
autoFocus?: boolean;
|
|
40
|
+
textarea?: HTMLTextAreaElement;
|
|
41
|
+
commandOrchestrator?: TextAreaCommandOrchestrator;
|
|
42
|
+
textareaWarp?: HTMLDivElement;
|
|
43
|
+
textareaPre?: HTMLPreElement;
|
|
44
|
+
container?: HTMLDivElement | null;
|
|
45
|
+
dispatch?: React.Dispatch<ContextStore>;
|
|
46
|
+
barPopup?: Record<string, boolean>;
|
|
47
|
+
scrollTop?: number;
|
|
48
|
+
scrollTopPreview?: number;
|
|
49
|
+
tabSize?: number;
|
|
50
|
+
defaultTabEnable?: boolean;
|
|
64
51
|
};
|
|
65
52
|
export declare const EditorContext: React.Context<ContextStore>;
|
package/lib/Types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CSSProperties } from 'react';
|
|
1
|
+
import type { CSSProperties, JSX } from 'react';
|
|
2
2
|
import type { MarkdownPreviewProps } from '@uiw/react-markdown-preview/nohighlight';
|
|
3
3
|
import type { ITextAreaProps } from './components/TextArea/index.nohighlight';
|
|
4
4
|
import type { ICommand, TextState } from './commands';
|
package/lib/commands/group.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ import { ICommand, ICommandChildCommands, ICommandChildHandle } from './';
|
|
|
2
2
|
export type GroupOptions = Omit<ICommand<string>, 'children'> & {
|
|
3
3
|
children?: ICommandChildHandle['children'];
|
|
4
4
|
};
|
|
5
|
-
export declare const group: (arr: ICommandChildCommands[
|
|
5
|
+
export declare const group: (arr: ICommandChildCommands["children"], options?: GroupOptions) => ICommand<string>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type ICommand } from './';
|
|
2
|
+
import { divider } from './divider';
|
|
3
|
+
import { group } from './group';
|
|
4
|
+
declare let bold: ICommand;
|
|
5
|
+
declare let code: ICommand;
|
|
6
|
+
declare let codeBlock: ICommand;
|
|
7
|
+
declare let comment: ICommand;
|
|
8
|
+
declare let fullscreen: ICommand;
|
|
9
|
+
declare let hr: ICommand;
|
|
10
|
+
declare let image: ICommand;
|
|
11
|
+
declare let italic: ICommand;
|
|
12
|
+
declare let link: ICommand;
|
|
13
|
+
declare let checkedListCommand: ICommand;
|
|
14
|
+
declare let orderedListCommand: ICommand;
|
|
15
|
+
declare let unorderedListCommand: ICommand;
|
|
16
|
+
declare let codeEdit: ICommand;
|
|
17
|
+
declare let codeLive: ICommand;
|
|
18
|
+
declare let codePreview: ICommand;
|
|
19
|
+
declare let quote: ICommand;
|
|
20
|
+
declare let strikethrough: ICommand;
|
|
21
|
+
declare let issue: ICommand;
|
|
22
|
+
declare let title: ICommand;
|
|
23
|
+
declare let title1: ICommand;
|
|
24
|
+
declare let title2: ICommand;
|
|
25
|
+
declare let title3: ICommand;
|
|
26
|
+
declare let title4: ICommand;
|
|
27
|
+
declare let title5: ICommand;
|
|
28
|
+
declare let title6: ICommand;
|
|
29
|
+
declare let table: ICommand;
|
|
30
|
+
declare let help: ICommand;
|
|
31
|
+
export declare const getCommands: () => ICommand[];
|
|
32
|
+
export declare const getExtraCommands: () => ICommand[];
|
|
33
|
+
export { title, title1, title2, title3, title4, title5, title6, bold, codeBlock, comment, italic, strikethrough, hr, group, divider, link, quote, code, image, unorderedListCommand, orderedListCommand, checkedListCommand, table, issue, help, codeEdit, codeLive, codePreview, fullscreen, };
|