md-editor-v3 4.3.0 → 4.5.0-beta.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 +131 -111
- package/lib/cjs/MdCatalog.cjs +1 -1
- package/lib/cjs/MdEditor.cjs +27 -27
- package/lib/cjs/MdModal.cjs +1 -1
- package/lib/cjs/MdPreview.cjs +1 -1
- package/lib/cjs/ModalToolbar.cjs +1 -1
- package/lib/cjs/chunks/config.cjs +1 -1
- package/lib/cjs/chunks/index.cjs +6 -6
- package/lib/cjs/chunks/index3.cjs +1 -2
- package/lib/cjs/chunks/index4.cjs +2 -0
- package/lib/cjs/index.cjs +1 -1
- package/lib/es/MdCatalog.mjs +1 -1
- package/lib/es/MdEditor.mjs +925 -1117
- package/lib/es/MdModal.mjs +6 -139
- package/lib/es/MdPreview.mjs +1 -1
- package/lib/es/ModalToolbar.mjs +1 -1
- package/lib/es/chunks/config.mjs +25 -26
- package/lib/es/chunks/index.mjs +430 -327
- package/lib/es/chunks/index3.mjs +163 -61
- package/lib/es/chunks/index4.mjs +69 -0
- package/lib/es/index.mjs +18 -17
- package/lib/preview.css +1 -1
- package/lib/style.css +1 -1
- package/lib/types/MdEditor/Editor.d.ts +19 -1
- package/lib/types/MdEditor/components/Icon/Icon.d.ts +16 -0
- package/lib/types/MdEditor/components/Icon/Str.d.ts +3 -0
- package/lib/types/MdEditor/components/Icon/index.d.ts +16 -0
- package/lib/types/MdEditor/config.d.ts +2 -1
- package/lib/types/MdEditor/index.d.ts +42 -4
- package/lib/types/MdEditor/layouts/Content/ContentPreview.d.ts +33 -73
- package/lib/types/MdEditor/layouts/Content/index.d.ts +73 -58
- package/lib/types/MdEditor/layouts/Content/props.d.ts +73 -17
- package/lib/types/MdEditor/props.d.ts +29 -1
- package/lib/types/MdEditor/type.d.ts +37 -8
- package/lib/types/MdPreview/MdPreview.d.ts +18 -0
- package/lib/types/MdPreview/index.d.ts +39 -1
- package/lib/umd/index.js +43 -43
- package/package.json +1 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { LooseRequired } from '@vue/shared';
|
|
2
2
|
import markdownit from 'markdown-it/lib';
|
|
3
|
-
import { ExtractPropTypes, SetupContext } from 'vue';
|
|
3
|
+
import { Component, ExtractPropTypes, SetupContext } from 'vue';
|
|
4
4
|
import { Extension } from '@codemirror/state';
|
|
5
5
|
import { KeyBinding } from '@codemirror/view';
|
|
6
6
|
import { editorProps, mdPreviewProps } from './props';
|
|
7
|
+
import { IconName } from './components/Icon/Icon';
|
|
7
8
|
declare global {
|
|
8
9
|
interface Window {
|
|
9
10
|
hljs: any;
|
|
@@ -168,7 +169,7 @@ export interface ConfigOption {
|
|
|
168
169
|
/**
|
|
169
170
|
* 编辑器内部依赖库
|
|
170
171
|
*/
|
|
171
|
-
editorExtensions
|
|
172
|
+
editorExtensions: {
|
|
172
173
|
highlight?: {
|
|
173
174
|
instance?: any;
|
|
174
175
|
js?: string;
|
|
@@ -185,7 +186,14 @@ export interface ConfigOption {
|
|
|
185
186
|
js?: string;
|
|
186
187
|
css?: string;
|
|
187
188
|
};
|
|
189
|
+
/**
|
|
190
|
+
* Svg方式的图标
|
|
191
|
+
*/
|
|
188
192
|
iconfont?: string;
|
|
193
|
+
/**
|
|
194
|
+
* class方式的图标
|
|
195
|
+
*/
|
|
196
|
+
iconfontClass?: string;
|
|
189
197
|
screenfull?: {
|
|
190
198
|
instance?: any;
|
|
191
199
|
js?: string;
|
|
@@ -200,7 +208,7 @@ export interface ConfigOption {
|
|
|
200
208
|
css?: string;
|
|
201
209
|
};
|
|
202
210
|
};
|
|
203
|
-
editorConfig
|
|
211
|
+
editorConfig: {
|
|
204
212
|
/**
|
|
205
213
|
* 自定义提示语言
|
|
206
214
|
*/
|
|
@@ -221,28 +229,36 @@ export interface ConfigOption {
|
|
|
221
229
|
*
|
|
222
230
|
* @params theme 当前主题
|
|
223
231
|
* @params innerExtensions 当前主题下的扩展列表
|
|
224
|
-
* [keymap, minimalSetup, markdown, EditorView.lineWrapping, EditorView.updateListener, EditorView.domEventHandlers, oneDark??oneLight]
|
|
232
|
+
* [keymap, minimalSetup, html, markdown, EditorView.lineWrapping, EditorView.updateListener, EditorView.domEventHandlers, oneDark??oneLight]
|
|
225
233
|
* [快捷键, 最低配置, markdown识别, 横向自动换行, 更新事件, dom监听事件, oneDark主题(暗夜模式下), oneLight(默认模式下)]
|
|
226
234
|
*
|
|
235
|
+
* 如果要添加其他自带的扩展,比如java,注意添加到markdown之前,不然自动提示不正常
|
|
236
|
+
*
|
|
227
237
|
* @params keyBindings md-editor-v3内置的快捷键
|
|
228
238
|
*/
|
|
229
|
-
codeMirrorExtensions
|
|
239
|
+
codeMirrorExtensions: (theme: Themes, extensions: Array<Extension>, keyBindings: Array<KeyBinding>) => Array<Extension>;
|
|
230
240
|
/**
|
|
231
241
|
* 自定义markdown-it核心库扩展、属性等
|
|
232
242
|
*/
|
|
233
|
-
markdownItConfig
|
|
243
|
+
markdownItConfig: (md: markdownit) => void;
|
|
234
244
|
/**
|
|
235
245
|
* 挑选编辑器已预设的markdownIt的扩展
|
|
236
246
|
*
|
|
237
247
|
* @param plugins markdownIt的扩展,带编辑器已设定的属性
|
|
238
248
|
* @returns plugins
|
|
239
249
|
*/
|
|
240
|
-
markdownItPlugins
|
|
250
|
+
markdownItPlugins: (plugins: Array<MarkdownItConfigPlugin>) => Array<MarkdownItConfigPlugin>;
|
|
251
|
+
/**
|
|
252
|
+
* 如果使用内部的图标,可以切换展示的方式
|
|
253
|
+
*
|
|
254
|
+
* 以规避某些问题,例如Shadow Dom对Svg use的支持问题
|
|
255
|
+
*/
|
|
256
|
+
iconfontType: 'svg' | 'class';
|
|
241
257
|
}
|
|
242
258
|
/**
|
|
243
259
|
* 扩展编辑器内部功能,包括marked和一些内部依赖实例,如highlight、cropper等
|
|
244
260
|
*/
|
|
245
|
-
export type Config = (options: ConfigOption) => void;
|
|
261
|
+
export type Config = (options: Partial<ConfigOption>) => void;
|
|
246
262
|
/**
|
|
247
263
|
* 编辑器操作潜在的错误
|
|
248
264
|
*/
|
|
@@ -358,3 +374,16 @@ export type EditorProps = Readonly<LooseRequired<Readonly<ExtractPropTypes<typeo
|
|
|
358
374
|
export type MdPreviewProps = Readonly<LooseRequired<Readonly<ExtractPropTypes<typeof mdPreviewProps>>>>;
|
|
359
375
|
export type EditorEmits = Array<'onChange' | 'onSave' | 'onUploadImg' | 'onHtmlChanged' | 'onGetCatalog' | 'onError' | 'update:modelValue' | 'onBlur' | 'onFocus' | 'onInput'>;
|
|
360
376
|
export type EditorContext = SetupContext<EditorEmits>;
|
|
377
|
+
/**
|
|
378
|
+
* 自定义图标的数据类型
|
|
379
|
+
*/
|
|
380
|
+
export type CustomIcon = {
|
|
381
|
+
[key in IconName]?: {
|
|
382
|
+
component: Component | JSX.Element | string;
|
|
383
|
+
props: {
|
|
384
|
+
[key: string | number | symbol]: any;
|
|
385
|
+
};
|
|
386
|
+
};
|
|
387
|
+
} & {
|
|
388
|
+
copy?: string;
|
|
389
|
+
};
|
|
@@ -76,6 +76,14 @@ declare const MdPreview: import("vue").DefineComponent<{
|
|
|
76
76
|
type: import("vue").PropType<boolean>;
|
|
77
77
|
default: boolean;
|
|
78
78
|
};
|
|
79
|
+
noImgZoomIn: {
|
|
80
|
+
type: import("vue").PropType<boolean>;
|
|
81
|
+
default: boolean;
|
|
82
|
+
};
|
|
83
|
+
customIcon: {
|
|
84
|
+
type: import("vue").PropType<import('../MdEditor/type').CustomIcon>;
|
|
85
|
+
default: {};
|
|
86
|
+
};
|
|
79
87
|
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import('../MdEditor/type').EditorEmits, "onChange" | "onFocus" | "onBlur" | "onInput" | "onError" | "onSave" | "onUploadImg" | "onHtmlChanged" | "onGetCatalog" | "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
80
88
|
modelValue: {
|
|
81
89
|
type: import("vue").PropType<string>;
|
|
@@ -154,6 +162,14 @@ declare const MdPreview: import("vue").DefineComponent<{
|
|
|
154
162
|
type: import("vue").PropType<boolean>;
|
|
155
163
|
default: boolean;
|
|
156
164
|
};
|
|
165
|
+
noImgZoomIn: {
|
|
166
|
+
type: import("vue").PropType<boolean>;
|
|
167
|
+
default: boolean;
|
|
168
|
+
};
|
|
169
|
+
customIcon: {
|
|
170
|
+
type: import("vue").PropType<import('../MdEditor/type').CustomIcon>;
|
|
171
|
+
default: {};
|
|
172
|
+
};
|
|
157
173
|
}>> & {
|
|
158
174
|
onOnChange?: ((...args: any[]) => any) | undefined;
|
|
159
175
|
onOnFocus?: ((...args: any[]) => any) | undefined;
|
|
@@ -183,5 +199,7 @@ declare const MdPreview: import("vue").DefineComponent<{
|
|
|
183
199
|
codeStyleReverse: boolean;
|
|
184
200
|
codeStyleReverseList: string[];
|
|
185
201
|
noHighlight: boolean;
|
|
202
|
+
noImgZoomIn: boolean;
|
|
203
|
+
customIcon: import('../MdEditor/type').CustomIcon;
|
|
186
204
|
}>;
|
|
187
205
|
export default MdPreview;
|
|
@@ -21,6 +21,8 @@ declare const _default: {
|
|
|
21
21
|
codeStyleReverse: boolean;
|
|
22
22
|
codeStyleReverseList: string[];
|
|
23
23
|
noHighlight: boolean;
|
|
24
|
+
noImgZoomIn: boolean;
|
|
25
|
+
customIcon: import("..").CustomIcon;
|
|
24
26
|
}> & Omit<Readonly<import("vue").ExtractPropTypes<{
|
|
25
27
|
modelValue: {
|
|
26
28
|
type: import("vue").PropType<string>;
|
|
@@ -99,6 +101,14 @@ declare const _default: {
|
|
|
99
101
|
type: import("vue").PropType<boolean>;
|
|
100
102
|
default: boolean;
|
|
101
103
|
};
|
|
104
|
+
noImgZoomIn: {
|
|
105
|
+
type: import("vue").PropType<boolean>;
|
|
106
|
+
default: boolean;
|
|
107
|
+
};
|
|
108
|
+
customIcon: {
|
|
109
|
+
type: import("vue").PropType<import("..").CustomIcon>;
|
|
110
|
+
default: {};
|
|
111
|
+
};
|
|
102
112
|
}>> & {
|
|
103
113
|
onOnChange?: ((...args: any[]) => any) | undefined;
|
|
104
114
|
onOnFocus?: ((...args: any[]) => any) | undefined;
|
|
@@ -110,7 +120,7 @@ declare const _default: {
|
|
|
110
120
|
onOnHtmlChanged?: ((...args: any[]) => any) | undefined;
|
|
111
121
|
onOnGetCatalog?: ((...args: any[]) => any) | undefined;
|
|
112
122
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
113
|
-
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "editorId" | "class" | "style" | "mdHeadingId" | "theme" | "modelValue" | "language" | "showCodeRowNumber" | "previewTheme" | "sanitize" | "noMermaid" | "noKatex" | "codeTheme" | "formatCopiedText" | "codeStyleReverse" | "codeStyleReverseList" | "noHighlight">;
|
|
123
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "editorId" | "class" | "style" | "mdHeadingId" | "theme" | "modelValue" | "language" | "showCodeRowNumber" | "previewTheme" | "sanitize" | "noMermaid" | "noKatex" | "codeTheme" | "formatCopiedText" | "codeStyleReverse" | "codeStyleReverseList" | "noHighlight" | "noImgZoomIn" | "customIcon">;
|
|
114
124
|
$attrs: {
|
|
115
125
|
[x: string]: unknown;
|
|
116
126
|
};
|
|
@@ -202,6 +212,14 @@ declare const _default: {
|
|
|
202
212
|
type: import("vue").PropType<boolean>;
|
|
203
213
|
default: boolean;
|
|
204
214
|
};
|
|
215
|
+
noImgZoomIn: {
|
|
216
|
+
type: import("vue").PropType<boolean>;
|
|
217
|
+
default: boolean;
|
|
218
|
+
};
|
|
219
|
+
customIcon: {
|
|
220
|
+
type: import("vue").PropType<import("..").CustomIcon>;
|
|
221
|
+
default: {};
|
|
222
|
+
};
|
|
205
223
|
}>> & {
|
|
206
224
|
onOnChange?: ((...args: any[]) => any) | undefined;
|
|
207
225
|
onOnFocus?: ((...args: any[]) => any) | undefined;
|
|
@@ -231,6 +249,8 @@ declare const _default: {
|
|
|
231
249
|
codeStyleReverse: boolean;
|
|
232
250
|
codeStyleReverseList: string[];
|
|
233
251
|
noHighlight: boolean;
|
|
252
|
+
noImgZoomIn: boolean;
|
|
253
|
+
customIcon: import("..").CustomIcon;
|
|
234
254
|
}, {}, string> & {
|
|
235
255
|
beforeCreate?: ((() => void) | (() => void)[]) | undefined;
|
|
236
256
|
created?: ((() => void) | (() => void)[]) | undefined;
|
|
@@ -329,6 +349,14 @@ declare const _default: {
|
|
|
329
349
|
type: import("vue").PropType<boolean>;
|
|
330
350
|
default: boolean;
|
|
331
351
|
};
|
|
352
|
+
noImgZoomIn: {
|
|
353
|
+
type: import("vue").PropType<boolean>;
|
|
354
|
+
default: boolean;
|
|
355
|
+
};
|
|
356
|
+
customIcon: {
|
|
357
|
+
type: import("vue").PropType<import("..").CustomIcon>;
|
|
358
|
+
default: {};
|
|
359
|
+
};
|
|
332
360
|
}>> & {
|
|
333
361
|
onOnChange?: ((...args: any[]) => any) | undefined;
|
|
334
362
|
onOnFocus?: ((...args: any[]) => any) | undefined;
|
|
@@ -422,6 +450,14 @@ declare const _default: {
|
|
|
422
450
|
type: import("vue").PropType<boolean>;
|
|
423
451
|
default: boolean;
|
|
424
452
|
};
|
|
453
|
+
noImgZoomIn: {
|
|
454
|
+
type: import("vue").PropType<boolean>;
|
|
455
|
+
default: boolean;
|
|
456
|
+
};
|
|
457
|
+
customIcon: {
|
|
458
|
+
type: import("vue").PropType<import("..").CustomIcon>;
|
|
459
|
+
default: {};
|
|
460
|
+
};
|
|
425
461
|
}>> & {
|
|
426
462
|
onOnChange?: ((...args: any[]) => any) | undefined;
|
|
427
463
|
onOnFocus?: ((...args: any[]) => any) | undefined;
|
|
@@ -451,6 +487,8 @@ declare const _default: {
|
|
|
451
487
|
codeStyleReverse: boolean;
|
|
452
488
|
codeStyleReverseList: string[];
|
|
453
489
|
noHighlight: boolean;
|
|
490
|
+
noImgZoomIn: boolean;
|
|
491
|
+
customIcon: import("..").CustomIcon;
|
|
454
492
|
}, {}, string> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & {
|
|
455
493
|
install: (app: App) => App;
|
|
456
494
|
};
|