zs_library 0.3.19 → 0.3.21
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/components/index.d.ts +1 -0
- package/dist/components/md-editor/editor.d.ts +76 -0
- package/dist/components/md-editor/index.d.ts +7 -55
- package/dist/index.es.js +428 -398
- package/dist/index.umd.js +50 -48
- package/dist/zs_library.css +1 -1
- package/package.json +7 -5
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { MDXEditorProps, ImageUploadHandler, ImagePreviewHandler, ViewMode, HEADING_LEVEL, CodeBlockEditorDescriptor, DirectiveDescriptor } from '@mdxeditor/editor';
|
|
2
|
+
import { FC, JSX } from 'react';
|
|
3
|
+
type Extension = {
|
|
4
|
+
extension: Extension;
|
|
5
|
+
} | readonly Extension[];
|
|
6
|
+
export interface ImagePluginConfig {
|
|
7
|
+
imageUploadHandler?: ImageUploadHandler;
|
|
8
|
+
imageAutocompleteSuggestions?: string[];
|
|
9
|
+
disableImageResize?: boolean;
|
|
10
|
+
disableImageSettingsButton?: boolean;
|
|
11
|
+
imagePreviewHandler?: ImagePreviewHandler;
|
|
12
|
+
ImageDialog?: FC<object> | (() => JSX.Element);
|
|
13
|
+
}
|
|
14
|
+
export interface DiffSourcePluginConfig {
|
|
15
|
+
viewMode?: ViewMode;
|
|
16
|
+
diffMarkdown?: string;
|
|
17
|
+
codeMirrorExtensions?: Extension[];
|
|
18
|
+
readOnlyDiff?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface HeadingPluginConfig {
|
|
21
|
+
allowedHeadingLevels?: readonly HEADING_LEVEL[];
|
|
22
|
+
}
|
|
23
|
+
export interface LinkPluginConfig {
|
|
24
|
+
validateUrl?: (url: string) => boolean;
|
|
25
|
+
disableAutoLink?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface CodeBlockPluginConfig {
|
|
28
|
+
codeBlockEditorDescriptors?: CodeBlockEditorDescriptor[];
|
|
29
|
+
defaultCodeBlockLanguage?: string | undefined;
|
|
30
|
+
}
|
|
31
|
+
export interface CodeMirrorPluginConfig {
|
|
32
|
+
codeBlockLanguages: Record<string, string>;
|
|
33
|
+
codeMirrorExtensions?: Extension[];
|
|
34
|
+
autoLoadLanguageSupport?: boolean;
|
|
35
|
+
}
|
|
36
|
+
export interface DirectivePluginConfig {
|
|
37
|
+
directiveDescriptors: DirectiveDescriptor[];
|
|
38
|
+
}
|
|
39
|
+
export interface MdEditorPluginConfig {
|
|
40
|
+
image?: ImagePluginConfig;
|
|
41
|
+
diffSource?: DiffSourcePluginConfig;
|
|
42
|
+
headings?: HeadingPluginConfig;
|
|
43
|
+
link?: LinkPluginConfig;
|
|
44
|
+
codeBlock?: CodeBlockPluginConfig;
|
|
45
|
+
codeMirror?: CodeMirrorPluginConfig;
|
|
46
|
+
directives?: DirectivePluginConfig;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Markdown 编辑器
|
|
50
|
+
*/
|
|
51
|
+
export interface MdEditorProps extends Omit<MDXEditorProps, "markdown" | "onChange"> {
|
|
52
|
+
/**
|
|
53
|
+
* Markdown 内容
|
|
54
|
+
*/
|
|
55
|
+
value?: string;
|
|
56
|
+
/**
|
|
57
|
+
* Markdown 内容变化时的回调
|
|
58
|
+
* @param value Markdown 内容
|
|
59
|
+
* @returns
|
|
60
|
+
*/
|
|
61
|
+
onChange?: (value: string) => void;
|
|
62
|
+
/**
|
|
63
|
+
* 编辑器插件配置
|
|
64
|
+
*/
|
|
65
|
+
pluginConfig?: MdEditorPluginConfig;
|
|
66
|
+
/**
|
|
67
|
+
* 自定义类名
|
|
68
|
+
*/
|
|
69
|
+
className?: string;
|
|
70
|
+
/**
|
|
71
|
+
* 主题,可选值为 `light`、`dark`、`auto`
|
|
72
|
+
*/
|
|
73
|
+
theme?: "light" | "dark" | "auto";
|
|
74
|
+
}
|
|
75
|
+
export declare const PrivMdEditor: FC<MdEditorProps>;
|
|
76
|
+
export {};
|
|
@@ -1,60 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { FC, JSX } from 'react';
|
|
1
|
+
import { PrivMdEditor } from './editor';
|
|
3
2
|
import { default as MDXEditorPreview } from './preview';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export interface ImagePluginConfig {
|
|
8
|
-
imageUploadHandler?: ImageUploadHandler;
|
|
9
|
-
imageAutocompleteSuggestions?: string[];
|
|
10
|
-
disableImageResize?: boolean;
|
|
11
|
-
disableImageSettingsButton?: boolean;
|
|
12
|
-
imagePreviewHandler?: ImagePreviewHandler;
|
|
13
|
-
ImageDialog?: FC<object> | (() => JSX.Element);
|
|
14
|
-
}
|
|
15
|
-
export interface DiffSourcePluginConfig {
|
|
16
|
-
viewMode?: ViewMode;
|
|
17
|
-
diffMarkdown?: string;
|
|
18
|
-
codeMirrorExtensions?: Extension[];
|
|
19
|
-
readOnlyDiff?: boolean;
|
|
20
|
-
}
|
|
21
|
-
export interface HeadingPluginConfig {
|
|
22
|
-
allowedHeadingLevels?: readonly HEADING_LEVEL[];
|
|
23
|
-
}
|
|
24
|
-
export interface LinkPluginConfig {
|
|
25
|
-
validateUrl?: (url: string) => boolean;
|
|
26
|
-
disableAutoLink?: boolean;
|
|
27
|
-
}
|
|
28
|
-
export interface CodeBlockPluginConfig {
|
|
29
|
-
codeBlockEditorDescriptors?: CodeBlockEditorDescriptor[];
|
|
30
|
-
defaultCodeBlockLanguage?: string | undefined;
|
|
31
|
-
}
|
|
32
|
-
export interface CodeMirrorPluginConfig {
|
|
33
|
-
codeBlockLanguages: Record<string, string>;
|
|
34
|
-
codeMirrorExtensions?: Extension[];
|
|
35
|
-
autoLoadLanguageSupport?: boolean;
|
|
36
|
-
}
|
|
37
|
-
export interface DirectivePluginConfig {
|
|
38
|
-
directiveDescriptors: DirectiveDescriptor[];
|
|
39
|
-
}
|
|
40
|
-
export interface MdEditorPluginConfig {
|
|
41
|
-
image?: ImagePluginConfig;
|
|
42
|
-
diffSource?: DiffSourcePluginConfig;
|
|
43
|
-
headings?: HeadingPluginConfig;
|
|
44
|
-
link?: LinkPluginConfig;
|
|
45
|
-
codeBlock?: CodeBlockPluginConfig;
|
|
46
|
-
codeMirror?: CodeMirrorPluginConfig;
|
|
47
|
-
directives?: DirectivePluginConfig;
|
|
48
|
-
}
|
|
49
|
-
export interface MdEditorProps extends Omit<MDXEditorProps, "markdown" | "onChange"> {
|
|
50
|
-
value?: string;
|
|
51
|
-
onChange?: (value: string) => void;
|
|
52
|
-
pluginConfig?: MdEditorPluginConfig;
|
|
53
|
-
className?: string;
|
|
54
|
-
theme?: "light" | "dark" | "auto";
|
|
55
|
-
}
|
|
56
|
-
declare const PrivMdEditor: FC<MdEditorProps>;
|
|
3
|
+
/**
|
|
4
|
+
* Markdown 编辑器
|
|
5
|
+
*/
|
|
57
6
|
export type MdEditorType = typeof PrivMdEditor & {
|
|
7
|
+
/**
|
|
8
|
+
* 预览组件
|
|
9
|
+
*/
|
|
58
10
|
Preview: typeof MDXEditorPreview;
|
|
59
11
|
};
|
|
60
12
|
declare const MdEditor: MdEditorType;
|