remons-markdown-editor 1.0.0-beta.4 → 1.0.0-beta.6
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/dist/App.d.ts +2 -0
- package/dist/MarkdownEditor.d.ts +23 -0
- package/dist/components/Dialog/EditDialog.d.ts +21 -0
- package/dist/components/Editor/codemirrorExtensions.d.ts +12 -0
- package/dist/components/Editor/containerWidget.d.ts +20 -0
- package/dist/components/Editor/index.d.ts +16 -0
- package/dist/components/Panel/SplitPanels.d.ts +7 -0
- package/dist/components/Preview/index.d.ts +10 -0
- package/dist/components/Toolbar/buttons.d.ts +34 -0
- package/dist/components/Toolbar/config.d.ts +6 -0
- package/dist/components/Toolbar/hooks/useToolbar.d.ts +14 -0
- package/dist/components/Toolbar/index.d.ts +13 -0
- package/dist/components/Toolbar/renderers/TablePicker/TableDropdown.d.ts +5 -0
- package/dist/components/Toolbar/renderers/TablePicker/index.d.ts +9 -0
- package/dist/components/Toolbar/renderers/ToolbarItemRenderer.d.ts +7 -0
- package/dist/hooks/useFullscreen.d.ts +4 -0
- package/dist/hooks/useRegisterToolbar.d.ts +51 -0
- package/dist/hooks/useScrollSync.d.ts +5 -0
- package/dist/index.cjs +1314 -1191
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +248 -8
- package/dist/index.d.ts +5 -157
- package/dist/index.js +1289 -1169
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts +0 -0
- package/dist/registry/componentRegistry.d.ts +34 -0
- package/dist/types/index.d.ts +76 -0
- package/dist/utils/parseContainer.d.ts +18 -0
- package/dist/utils/writeContainer.d.ts +16 -0
- package/package.json +7 -7
- package/dist/index.css.map +0 -1
- package/dist/index.d.cts +0 -157
package/dist/index.css
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
.container {
|
|
1
|
+
.index-module__container___l6BT- {
|
|
3
2
|
padding: 4px;
|
|
4
3
|
display: block;
|
|
5
4
|
min-width: 200px;
|
|
@@ -8,13 +7,13 @@
|
|
|
8
7
|
border-radius: 6px;
|
|
9
8
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
|
10
9
|
}
|
|
11
|
-
.
|
|
10
|
+
.index-module__grid___tCZ-r {
|
|
12
11
|
display: grid;
|
|
13
12
|
gap: 2px;
|
|
14
13
|
transition: all 0.1s ease;
|
|
15
14
|
justify-content: flex-start;
|
|
16
15
|
}
|
|
17
|
-
.
|
|
16
|
+
.index-module__grid___tCZ-r .index-module__cell___vTDQz {
|
|
18
17
|
width: 24px;
|
|
19
18
|
height: 24px;
|
|
20
19
|
border: 1px solid #e8e8e8;
|
|
@@ -23,18 +22,18 @@
|
|
|
23
22
|
cursor: pointer;
|
|
24
23
|
transition: all 0.1s ease;
|
|
25
24
|
}
|
|
26
|
-
.
|
|
25
|
+
.index-module__grid___tCZ-r .index-module__cell___vTDQz.index-module__cellActive___0EYvU {
|
|
27
26
|
border-color: #91caff;
|
|
28
27
|
background: #ddf4ff;
|
|
29
28
|
}
|
|
30
|
-
.
|
|
29
|
+
.index-module__hint___dTObk {
|
|
31
30
|
padding: 12px 16px;
|
|
32
31
|
color: #999;
|
|
33
32
|
font-size: 12px;
|
|
34
33
|
text-align: center;
|
|
35
34
|
cursor: pointer;
|
|
36
35
|
}
|
|
37
|
-
.
|
|
36
|
+
.index-module__label___2CmK1 {
|
|
38
37
|
margin-top: 8px;
|
|
39
38
|
font-size: 13px;
|
|
40
39
|
color: #666;
|
|
@@ -42,4 +41,245 @@
|
|
|
42
41
|
min-height: 20px;
|
|
43
42
|
text-align: center;
|
|
44
43
|
}
|
|
45
|
-
|
|
44
|
+
* {
|
|
45
|
+
margin: 0;
|
|
46
|
+
padding: 0;
|
|
47
|
+
box-sizing: border-box;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
body {
|
|
51
|
+
margin: 0;
|
|
52
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
|
53
|
+
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
|
54
|
+
sans-serif;
|
|
55
|
+
-webkit-font-smoothing: antialiased;
|
|
56
|
+
-moz-osx-font-smoothing: grayscale;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
#root {
|
|
60
|
+
height: 100vh;
|
|
61
|
+
width: 100vw;
|
|
62
|
+
overflow: hidden;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/* ===== CSS 自定义属性(主题变量) ===== */
|
|
66
|
+
/* 浅色主题(默认) */
|
|
67
|
+
:root,
|
|
68
|
+
[data-theme="light"] {
|
|
69
|
+
--markdown-editor-color-bg-white: rgba(255, 255, 255, 0.6);
|
|
70
|
+
|
|
71
|
+
/* ── 边框(毛玻璃) ── */
|
|
72
|
+
--markdown-editor-color-border: rgba(255, 255, 255, 0.8);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/* ===== 深色主题 ===== */
|
|
76
|
+
[data-theme="dark"] {
|
|
77
|
+
--markdown-editor-color-bg-white: rgba(46, 51, 80, 0.8);
|
|
78
|
+
|
|
79
|
+
--markdown-editor-color-border: rgba(255, 255, 255, 0.1);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.ant-anchor-link-title {
|
|
83
|
+
white-space: inherit !important;
|
|
84
|
+
}
|
|
85
|
+
@font-face {
|
|
86
|
+
font-family: 'Inter';
|
|
87
|
+
font-style: normal;
|
|
88
|
+
font-weight: 400;
|
|
89
|
+
font-display: swap;
|
|
90
|
+
src: url(https://fonts.gstatic.com/s/inter/v20/UcCO3FwrK3iLTeHuS_nVMrMxCp50SjIw2boKoduKmMEVuLyfMZg.ttf) format('truetype');
|
|
91
|
+
}
|
|
92
|
+
@font-face {
|
|
93
|
+
font-family: 'Inter';
|
|
94
|
+
font-style: normal;
|
|
95
|
+
font-weight: 500;
|
|
96
|
+
font-display: swap;
|
|
97
|
+
src: url(https://fonts.gstatic.com/s/inter/v20/UcCO3FwrK3iLTeHuS_nVMrMxCp50SjIw2boKoduKmMEVuI6fMZg.ttf) format('truetype');
|
|
98
|
+
}
|
|
99
|
+
@font-face {
|
|
100
|
+
font-family: 'Inter';
|
|
101
|
+
font-style: normal;
|
|
102
|
+
font-weight: 600;
|
|
103
|
+
font-display: swap;
|
|
104
|
+
src: url(https://fonts.gstatic.com/s/inter/v20/UcCO3FwrK3iLTeHuS_nVMrMxCp50SjIw2boKoduKmMEVuGKYMZg.ttf) format('truetype');
|
|
105
|
+
}
|
|
106
|
+
@font-face {
|
|
107
|
+
font-family: 'Inter';
|
|
108
|
+
font-style: normal;
|
|
109
|
+
font-weight: 700;
|
|
110
|
+
font-display: swap;
|
|
111
|
+
src: url(https://fonts.gstatic.com/s/inter/v20/UcCO3FwrK3iLTeHuS_nVMrMxCp50SjIw2boKoduKmMEVuFuYMZg.ttf) format('truetype');
|
|
112
|
+
}
|
|
113
|
+
@font-face {
|
|
114
|
+
font-family: 'Noto Sans SC';
|
|
115
|
+
font-style: normal;
|
|
116
|
+
font-weight: 400;
|
|
117
|
+
font-display: swap;
|
|
118
|
+
src: url(https://fonts.gstatic.com/s/notosanssc/v40/k3kCo84MPvpLmixcA63oeAL7Iqp5IZJF9bmaG9_FnYw.ttf) format('truetype');
|
|
119
|
+
}
|
|
120
|
+
@font-face {
|
|
121
|
+
font-family: 'Noto Sans SC';
|
|
122
|
+
font-style: normal;
|
|
123
|
+
font-weight: 500;
|
|
124
|
+
font-display: swap;
|
|
125
|
+
src: url(https://fonts.gstatic.com/s/notosanssc/v40/k3kCo84MPvpLmixcA63oeAL7Iqp5IZJF9bmaG-3FnYw.ttf) format('truetype');
|
|
126
|
+
}
|
|
127
|
+
@font-face {
|
|
128
|
+
font-family: 'Noto Sans SC';
|
|
129
|
+
font-style: normal;
|
|
130
|
+
font-weight: 600;
|
|
131
|
+
font-display: swap;
|
|
132
|
+
src: url(https://fonts.gstatic.com/s/notosanssc/v40/k3kCo84MPvpLmixcA63oeAL7Iqp5IZJF9bmaGwHCnYw.ttf) format('truetype');
|
|
133
|
+
}
|
|
134
|
+
@font-face {
|
|
135
|
+
font-family: 'Noto Sans SC';
|
|
136
|
+
font-style: normal;
|
|
137
|
+
font-weight: 700;
|
|
138
|
+
font-display: swap;
|
|
139
|
+
src: url(https://fonts.gstatic.com/s/notosanssc/v40/k3kCo84MPvpLmixcA63oeAL7Iqp5IZJF9bmaGzjCnYw.ttf) format('truetype');
|
|
140
|
+
}
|
|
141
|
+
.app {
|
|
142
|
+
height: 100%;
|
|
143
|
+
display: flex;
|
|
144
|
+
flex-direction: column;
|
|
145
|
+
border: 1px solid var(--markdown-editor-color-border);
|
|
146
|
+
}
|
|
147
|
+
.app.fullscreen {
|
|
148
|
+
position: fixed;
|
|
149
|
+
top: 0;
|
|
150
|
+
left: 0;
|
|
151
|
+
right: 0;
|
|
152
|
+
bottom: 0;
|
|
153
|
+
z-index: 9999;
|
|
154
|
+
background: #fff;
|
|
155
|
+
width: 100vw;
|
|
156
|
+
height: 100vh;
|
|
157
|
+
}
|
|
158
|
+
.toolbar {
|
|
159
|
+
flex-shrink: 0;
|
|
160
|
+
display: flex;
|
|
161
|
+
align-items: center;
|
|
162
|
+
padding: 4px 8px;
|
|
163
|
+
background: var(--markdown-editor-color-bg-white);
|
|
164
|
+
border-bottom: 1px solid #d0d7de;
|
|
165
|
+
gap: 4px;
|
|
166
|
+
overflow-x: auto;
|
|
167
|
+
}
|
|
168
|
+
.toolbar-group {
|
|
169
|
+
display: flex;
|
|
170
|
+
align-items: center;
|
|
171
|
+
gap: 2px;
|
|
172
|
+
}
|
|
173
|
+
.toolbar-button {
|
|
174
|
+
display: flex;
|
|
175
|
+
align-items: center;
|
|
176
|
+
justify-content: center;
|
|
177
|
+
min-width: 32px;
|
|
178
|
+
height: 32px;
|
|
179
|
+
padding: 0 8px;
|
|
180
|
+
border: none;
|
|
181
|
+
border-radius: 6px;
|
|
182
|
+
background: transparent;
|
|
183
|
+
cursor: pointer;
|
|
184
|
+
font-size: 16px;
|
|
185
|
+
font-weight: 500;
|
|
186
|
+
color: #24292f;
|
|
187
|
+
transition: background-color 0.15s, color 0.15s;
|
|
188
|
+
white-space: nowrap;
|
|
189
|
+
}
|
|
190
|
+
.toolbar-button:hover {
|
|
191
|
+
background: #e1e4e8;
|
|
192
|
+
color: #0969da;
|
|
193
|
+
}
|
|
194
|
+
.toolbar-button:active {
|
|
195
|
+
background: #d0d7de;
|
|
196
|
+
}
|
|
197
|
+
.toolbar-button.ant-btn {
|
|
198
|
+
min-width: 32px;
|
|
199
|
+
height: 32px;
|
|
200
|
+
padding: 0 8px;
|
|
201
|
+
border-color: transparent !important;
|
|
202
|
+
box-shadow: none !important;
|
|
203
|
+
}
|
|
204
|
+
.toolbar-button.ant-btn:hover {
|
|
205
|
+
background: #e1e4e8;
|
|
206
|
+
color: #0969da;
|
|
207
|
+
border-color: transparent !important;
|
|
208
|
+
box-shadow: none !important;
|
|
209
|
+
}
|
|
210
|
+
.toolbar-button.ant-btn:active {
|
|
211
|
+
border-color: transparent !important;
|
|
212
|
+
box-shadow: none !important;
|
|
213
|
+
}
|
|
214
|
+
:where(.css-dev-only-do-not-override-u6izyw).ant-btn:not(:disabled):not(.ant-btn-disabled):hover {
|
|
215
|
+
border: none !important;
|
|
216
|
+
}
|
|
217
|
+
.toolbar-separator {
|
|
218
|
+
width: 1px;
|
|
219
|
+
height: 24px;
|
|
220
|
+
background: #d0d7de;
|
|
221
|
+
margin: 0 4px;
|
|
222
|
+
}
|
|
223
|
+
.split-panels {
|
|
224
|
+
flex: 1;
|
|
225
|
+
min-height: 0;
|
|
226
|
+
overflow: hidden;
|
|
227
|
+
}
|
|
228
|
+
.split-panels .ant-splitter {
|
|
229
|
+
height: 100%;
|
|
230
|
+
}
|
|
231
|
+
.split-panels .ant-splitter-panel {
|
|
232
|
+
min-height: 0;
|
|
233
|
+
}
|
|
234
|
+
.editor {
|
|
235
|
+
height: 100%;
|
|
236
|
+
}
|
|
237
|
+
.cm-scroller {
|
|
238
|
+
font-family: Consolas, Inter, 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif !important;
|
|
239
|
+
}
|
|
240
|
+
.cm-editor {
|
|
241
|
+
height: 100%;
|
|
242
|
+
}
|
|
243
|
+
.preview {
|
|
244
|
+
height: 100%;
|
|
245
|
+
overflow: auto;
|
|
246
|
+
}
|
|
247
|
+
/* 通用容器基类 */
|
|
248
|
+
.md-container {
|
|
249
|
+
margin: 16px 0;
|
|
250
|
+
border-radius: 6px;
|
|
251
|
+
border: 1px solid #d0d7de;
|
|
252
|
+
overflow: hidden;
|
|
253
|
+
}
|
|
254
|
+
/* 编辑弹窗样式 */
|
|
255
|
+
.edit-dialog {
|
|
256
|
+
padding: 8px 0;
|
|
257
|
+
}
|
|
258
|
+
.edit-dialog-field {
|
|
259
|
+
margin-bottom: 16px;
|
|
260
|
+
}
|
|
261
|
+
.edit-dialog-label {
|
|
262
|
+
display: block;
|
|
263
|
+
margin-bottom: 6px;
|
|
264
|
+
font-size: 14px;
|
|
265
|
+
font-weight: 500;
|
|
266
|
+
color: #24292f;
|
|
267
|
+
}
|
|
268
|
+
.edit-dialog-input {
|
|
269
|
+
width: 100%;
|
|
270
|
+
padding: 6px 10px;
|
|
271
|
+
font-size: 14px;
|
|
272
|
+
border: 1px solid #d0d7de;
|
|
273
|
+
border-radius: 6px;
|
|
274
|
+
outline: none;
|
|
275
|
+
transition: border-color 0.15s;
|
|
276
|
+
}
|
|
277
|
+
.edit-dialog-input:focus {
|
|
278
|
+
border-color: #0969da;
|
|
279
|
+
box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.1);
|
|
280
|
+
}
|
|
281
|
+
.edit-dialog-textarea {
|
|
282
|
+
resize: vertical;
|
|
283
|
+
font-family: inherit;
|
|
284
|
+
}
|
|
285
|
+
/*$vite$:1*/
|
package/dist/index.d.ts
CHANGED
|
@@ -1,157 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
interface ToolbarButtonConfig {
|
|
8
|
-
id?: string;
|
|
9
|
-
icon?: React__default.ComponentType;
|
|
10
|
-
label?: string;
|
|
11
|
-
children?: ToolbarButtonConfig[];
|
|
12
|
-
handler?: (view: EditorView, state: EditorState) => void;
|
|
13
|
-
separatorBefore?: boolean;
|
|
14
|
-
customRender?: () => React__default.ReactNode;
|
|
15
|
-
wrapTags?: [string, string];
|
|
16
|
-
disabled?: boolean;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* 弹窗属性配置
|
|
20
|
-
* 用于定义 Markdown 容器中需要填充的属性字段
|
|
21
|
-
*/
|
|
22
|
-
interface DialogField {
|
|
23
|
-
/** 字段键名,用于 Markdown 属性填充 */
|
|
24
|
-
key: string;
|
|
25
|
-
/** 默认值 */
|
|
26
|
-
defaultValue?: string;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* 组件 Schema
|
|
30
|
-
* 每个容器组件(如 :::linkCard)定义可编辑字段和弹窗渲染逻辑
|
|
31
|
-
* 也支持简单的标签包裹模式(通过 wrapTags)
|
|
32
|
-
*/
|
|
33
|
-
interface ComponentSchema {
|
|
34
|
-
/** 容器名称,对应 :::name 语法 */
|
|
35
|
-
name: string;
|
|
36
|
-
/** 工具栏按钮显示的标签 */
|
|
37
|
-
label: string;
|
|
38
|
-
/** 工具栏按钮显示的图标 */
|
|
39
|
-
icon?: React__default.ReactNode;
|
|
40
|
-
/**
|
|
41
|
-
* 标签包裹配置:设置为 [openTag, closeTag] 时,使用标签包裹模式(而非 :::name 容器)
|
|
42
|
-
* 配置后无需提供 fields 和 renderDialog
|
|
43
|
-
*/
|
|
44
|
-
wrapTags?: [string, string];
|
|
45
|
-
/** 弹窗属性配置 — 用于定义 Markdown 内容中需要填充的字段(wrapTags 模式下可选) */
|
|
46
|
-
fields?: DialogField[];
|
|
47
|
-
/**
|
|
48
|
-
* 弹窗内容渲染函数(wrapTags 模式下可选)
|
|
49
|
-
* 接收当前属性值和回调函数,由用户完全自定义弹窗内容的渲染
|
|
50
|
-
* @param props 当前属性值,用于回显
|
|
51
|
-
* @param onChange 属性变更回调,用于更新表单值
|
|
52
|
-
* @returns 弹窗内容的 ReactNode
|
|
53
|
-
*/
|
|
54
|
-
renderDialog?: (props: Record<string, string>, onChange: (key: string, value: string) => void) => React__default.ReactNode;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* 图片上传配置
|
|
58
|
-
*/
|
|
59
|
-
interface ImageUploadConfig {
|
|
60
|
-
/**
|
|
61
|
-
* 图片上传接口地址
|
|
62
|
-
* 需与 onUploadImage 二选一(优先级低于 onUploadImage)
|
|
63
|
-
*/
|
|
64
|
-
uploadUrl?: string;
|
|
65
|
-
/**
|
|
66
|
-
* 自定义上传函数(优先级高于 uploadUrl)
|
|
67
|
-
* 传入此函数时,将完全接管上传逻辑
|
|
68
|
-
* @param file 要上传的图片文件
|
|
69
|
-
* @returns Promise<string> - 返回图片 URL,失败返回 null
|
|
70
|
-
*/
|
|
71
|
-
onUploadImage?: (file: File) => Promise<string | null>;
|
|
72
|
-
/**
|
|
73
|
-
* 处理服务器返回结果的回调,允许转换 URL
|
|
74
|
-
* 当使用 uploadUrl 方式上传时,可以使用此回调来自定义处理响应数据
|
|
75
|
-
* @param result 服务器返回的原始响应数据
|
|
76
|
-
* @returns 图片 URL,如果返回 null 则上传失败
|
|
77
|
-
*/
|
|
78
|
-
onGetUploadUrl?: (result: any) => string | null;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
type PreviewOptions = Omit<RenderMarkdownProps, 'content'> & {
|
|
82
|
-
languages?: Record<string, any> | null | undefined;
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
interface MarkdownEditorRef {
|
|
86
|
-
getContent: () => string;
|
|
87
|
-
}
|
|
88
|
-
interface MarkdownEditorProps {
|
|
89
|
-
/** 初始内容 */
|
|
90
|
-
defaultValue?: string;
|
|
91
|
-
/** 受控内容 */
|
|
92
|
-
value?: string;
|
|
93
|
-
/** 内容变化回调 */
|
|
94
|
-
onChange?: (value: string) => void;
|
|
95
|
-
/** 是否显示预览面板 */
|
|
96
|
-
showPreview?: boolean;
|
|
97
|
-
/** 是否支持全屏 */
|
|
98
|
-
fullscreen?: boolean;
|
|
99
|
-
/** Preview 渲染配置 */
|
|
100
|
-
previewOptions?: PreviewOptions;
|
|
101
|
-
/** 图片上传配置 */
|
|
102
|
-
uploadConfig?: ImageUploadConfig;
|
|
103
|
-
}
|
|
104
|
-
declare const _default: React.ForwardRefExoticComponent<MarkdownEditorProps & React.RefAttributes<MarkdownEditorRef>>;
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* 注册自定义容器组件到工具栏。支持单个或批量注册。
|
|
108
|
-
* 支持两种模式:
|
|
109
|
-
*
|
|
110
|
-
* 1. 容器模式(linkCard):name + fields + renderDialog
|
|
111
|
-
* 插入 :::name 格式的容器,支持弹窗编辑属性
|
|
112
|
-
*
|
|
113
|
-
* 2. 标签包裹模式:name + wrapTags
|
|
114
|
-
* 插入简单的标签包裹文本,如 <plugin-container>...</plugin-container>
|
|
115
|
-
*
|
|
116
|
-
* @example 容器模式
|
|
117
|
-
* ```tsx
|
|
118
|
-
* const schema: ComponentSchema = {
|
|
119
|
-
* name: 'alert',
|
|
120
|
-
* label: '警告框',
|
|
121
|
-
* icon: <AlertOutlined />,
|
|
122
|
-
* fields: [{ key: 'level', defaultValue: 'info' }],
|
|
123
|
-
* renderDialog: (props, onChange) => (
|
|
124
|
-
* <Input value={props.level} onChange={e => onChange('level', e.target.value)} />
|
|
125
|
-
* ),
|
|
126
|
-
* }
|
|
127
|
-
*
|
|
128
|
-
* function MyPage() {
|
|
129
|
-
* useRegisterToolbar(schema)
|
|
130
|
-
* return <MarkdownEditor />
|
|
131
|
-
* }
|
|
132
|
-
* ```
|
|
133
|
-
*
|
|
134
|
-
* @example 标签包裹模式
|
|
135
|
-
* ```tsx
|
|
136
|
-
* function MyPage() {
|
|
137
|
-
* useRegisterToolbar({
|
|
138
|
-
* name: 'plugin-container',
|
|
139
|
-
* label: '自定义容器',
|
|
140
|
-
* icon: <AlertOutlined />,
|
|
141
|
-
* wrapTags: ['<plugin-container>', '</plugin-container>'],
|
|
142
|
-
* })
|
|
143
|
-
* return <MarkdownEditor />
|
|
144
|
-
* }
|
|
145
|
-
* ```
|
|
146
|
-
*
|
|
147
|
-
* @example 批量注册
|
|
148
|
-
* ```tsx
|
|
149
|
-
* function MyPage() {
|
|
150
|
-
* useRegisterToolbar([schema1, schema2, schema3])
|
|
151
|
-
* return <MarkdownEditor />
|
|
152
|
-
* }
|
|
153
|
-
* ```
|
|
154
|
-
*/
|
|
155
|
-
declare function useRegisterToolbar(schemas: ComponentSchema | ComponentSchema[]): void;
|
|
156
|
-
|
|
157
|
-
export { type ComponentSchema, type DialogField, type ImageUploadConfig, _default as MarkdownEditor, type MarkdownEditorProps, type MarkdownEditorRef, type PreviewOptions, type ToolbarButtonConfig, useRegisterToolbar };
|
|
1
|
+
export { default as MarkdownEditor } from './MarkdownEditor';
|
|
2
|
+
export type { MarkdownEditorProps, MarkdownEditorRef } from './MarkdownEditor';
|
|
3
|
+
export { useRegisterToolbar } from './hooks/useRegisterToolbar';
|
|
4
|
+
export type { ComponentSchema, DialogField, ToolbarButtonConfig, ImageUploadConfig, } from './types';
|
|
5
|
+
export type { PreviewOptions } from './components/Preview';
|