@ibiz-template-plugin/ai-chat 0.0.123 → 0.0.125
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/index.es.js +10331 -10273
- package/dist/index.legacy.js +2 -2
- package/dist/polyfills.legacy.js +1 -1
- package/dist/style.css +2 -2
- package/dist/types/components/chat-net-disk/chat-net-disk.d.ts +5 -0
- package/dist/types/components/chat-net-disk/file-move-panel/file-move-panel.d.ts +2 -2
- package/dist/types/components/common/actions/actions.d.ts +4 -2
- package/dist/types/components/common/context-menu/context-menu.d.ts +0 -1
- package/dist/types/components/common/lazy-level-list/lazy-level-list.d.ts +17 -15
- package/dist/types/components/common/lazy-tree/lazy-tree.d.ts +18 -74
- package/dist/types/components/popup/popup.d.ts +13 -9
- package/dist/types/controller/file-system/file-system.controller.d.ts +12 -3
- package/dist/types/interface/i-chat-toolbar-item/i-chat-toolbar-item.d.ts +1 -1
- package/dist/types/interface/i-tree-node/i-tree-node.d.ts +54 -0
- package/dist/types/interface/index.d.ts +1 -0
- package/dist/types/locale/en/index.d.ts +2 -0
- package/dist/types/locale/zh-CN/index.d.ts +2 -0
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/types/utils/markdown-preview.d.ts +47 -0
- package/package.json +1 -1
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { FileSystemController } from '../../controller';
|
|
2
2
|
|
|
3
3
|
interface ChatNetDiskProps {
|
|
4
|
+
/**
|
|
5
|
+
* @description 控制器
|
|
6
|
+
* @type {FileSystemController}
|
|
7
|
+
* @memberof ChatNetDiskProps
|
|
8
|
+
*/
|
|
4
9
|
controller: FileSystemController;
|
|
5
10
|
}
|
|
6
11
|
export declare const ChatNetDisk: (props: ChatNetDiskProps) => import("preact").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FileSystemController } from '../../../controller';
|
|
2
|
-
import {
|
|
2
|
+
import { ITreeNode } from '../../../interface';
|
|
3
3
|
|
|
4
4
|
interface FileMovePanelProps {
|
|
5
5
|
/**
|
|
@@ -7,7 +7,7 @@ interface FileMovePanelProps {
|
|
|
7
7
|
* @type {IFile}
|
|
8
8
|
* @memberof FileMovePanelProps
|
|
9
9
|
*/
|
|
10
|
-
data:
|
|
10
|
+
data: ITreeNode;
|
|
11
11
|
/**
|
|
12
12
|
* @description 系统文件控制器
|
|
13
13
|
* @type {FileSystemController}
|
|
@@ -2,10 +2,12 @@ import { VNode } from 'preact';
|
|
|
2
2
|
|
|
3
3
|
export interface IAction {
|
|
4
4
|
id: string;
|
|
5
|
-
icon
|
|
5
|
+
icon?: VNode;
|
|
6
6
|
caption: string;
|
|
7
|
-
visible?: (data?: any) => boolean
|
|
7
|
+
visible?: boolean | ((data?: any) => boolean);
|
|
8
|
+
disabled?: boolean | ((data?: any) => boolean);
|
|
8
9
|
onClick?: (event: MouseEvent, data?: any) => void;
|
|
10
|
+
clickClose?: boolean;
|
|
9
11
|
}
|
|
10
12
|
interface ActionsProps {
|
|
11
13
|
/**
|
|
@@ -1,37 +1,38 @@
|
|
|
1
|
-
import { INodeEditInfo
|
|
1
|
+
import { INodeEditInfo } from '../lazy-tree/lazy-tree';
|
|
2
2
|
import { IAction } from '../actions/actions';
|
|
3
|
+
import { ITreeNode } from '../../../interface';
|
|
3
4
|
|
|
4
5
|
export type LazyLevelListMode = 'list' | 'card';
|
|
5
6
|
interface LazyLevelListProps {
|
|
6
7
|
/**
|
|
7
|
-
*
|
|
8
|
+
* 节点数据
|
|
8
9
|
*/
|
|
9
|
-
nodes:
|
|
10
|
+
nodes: ITreeNode[];
|
|
10
11
|
/**
|
|
11
12
|
* 异步加载子节点方法
|
|
12
13
|
* 返回子节点数组
|
|
13
14
|
*/
|
|
14
|
-
lazyLoad?: (node:
|
|
15
|
+
lazyLoad?: (node: ITreeNode) => Promise<ITreeNode[]>;
|
|
15
16
|
/**
|
|
16
17
|
* 节点选中回调
|
|
17
18
|
*/
|
|
18
|
-
onNodeCheck?: (node:
|
|
19
|
+
onNodeCheck?: (node: ITreeNode, checked: boolean) => void;
|
|
19
20
|
/**
|
|
20
21
|
* 节点点击回调
|
|
21
22
|
*/
|
|
22
|
-
onNodeClick?: (
|
|
23
|
+
onNodeClick?: (event: MouseEvent, node: ITreeNode) => void;
|
|
23
24
|
/**
|
|
24
25
|
* 节点展开回调
|
|
25
26
|
*/
|
|
26
|
-
onNodeExpand?: (node:
|
|
27
|
+
onNodeExpand?: (node: ITreeNode, expanded: boolean) => void;
|
|
27
28
|
/**
|
|
28
29
|
* 路径变化回调,用于父组件同步面包屑
|
|
29
30
|
*/
|
|
30
|
-
onPathChange?: (path:
|
|
31
|
+
onPathChange?: (path: ITreeNode[]) => void;
|
|
31
32
|
/**
|
|
32
33
|
* 受控路径(根 -> 当前层),由父组件传入
|
|
33
34
|
*/
|
|
34
|
-
path?:
|
|
35
|
+
path?: ITreeNode[];
|
|
35
36
|
/**
|
|
36
37
|
* 是否显示搜索框
|
|
37
38
|
* @default true
|
|
@@ -46,11 +47,6 @@ interface LazyLevelListProps {
|
|
|
46
47
|
* @default true
|
|
47
48
|
*/
|
|
48
49
|
highlight?: boolean;
|
|
49
|
-
/**
|
|
50
|
-
* 标识分隔符
|
|
51
|
-
* @default '/'
|
|
52
|
-
*/
|
|
53
|
-
separator?: string;
|
|
54
50
|
/**
|
|
55
51
|
* 过滤值
|
|
56
52
|
*/
|
|
@@ -84,6 +80,12 @@ interface LazyLevelListProps {
|
|
|
84
80
|
* @default 'list'
|
|
85
81
|
*/
|
|
86
82
|
mode?: LazyLevelListMode;
|
|
83
|
+
/**
|
|
84
|
+
* 节点过滤
|
|
85
|
+
* @param node
|
|
86
|
+
* @returns
|
|
87
|
+
*/
|
|
88
|
+
filterNodeMethod?: (node: ITreeNode) => boolean;
|
|
87
89
|
}
|
|
88
90
|
export interface LazyLevelListRef {
|
|
89
91
|
/**
|
|
@@ -91,7 +93,7 @@ export interface LazyLevelListRef {
|
|
|
91
93
|
* @param
|
|
92
94
|
* @returns
|
|
93
95
|
*/
|
|
94
|
-
overloadNode: (node:
|
|
96
|
+
overloadNode: (node: ITreeNode) => Promise<void>;
|
|
95
97
|
}
|
|
96
98
|
export declare const LazyLevelList: import('preact').FunctionalComponent<import('preact/compat').PropsWithoutRef<LazyLevelListProps> & {
|
|
97
99
|
ref?: import('preact').Ref<LazyLevelListRef> | undefined;
|
|
@@ -1,64 +1,7 @@
|
|
|
1
1
|
import { VNode } from 'preact';
|
|
2
2
|
import { IAction } from '../actions/actions';
|
|
3
|
+
import { ITreeNode } from '../../../interface';
|
|
3
4
|
|
|
4
|
-
export interface LazyTreeNode {
|
|
5
|
-
/**
|
|
6
|
-
* 节点唯一标识
|
|
7
|
-
*/
|
|
8
|
-
id: string;
|
|
9
|
-
/**
|
|
10
|
-
* 节点显示文本
|
|
11
|
-
*/
|
|
12
|
-
label: string;
|
|
13
|
-
/**
|
|
14
|
-
* 是否叶子节点
|
|
15
|
-
*/
|
|
16
|
-
isLeaf: boolean;
|
|
17
|
-
/**
|
|
18
|
-
* 子节点
|
|
19
|
-
*/
|
|
20
|
-
children?: LazyTreeNode[];
|
|
21
|
-
/**
|
|
22
|
-
* 是否已加载子节点
|
|
23
|
-
*/
|
|
24
|
-
loaded?: boolean;
|
|
25
|
-
/**
|
|
26
|
-
* 是否展开
|
|
27
|
-
*/
|
|
28
|
-
expanded?: boolean;
|
|
29
|
-
/**
|
|
30
|
-
* 是否正在加载
|
|
31
|
-
*/
|
|
32
|
-
loading?: boolean;
|
|
33
|
-
/**
|
|
34
|
-
* 父节点标识
|
|
35
|
-
*/
|
|
36
|
-
parentId?: string;
|
|
37
|
-
/**
|
|
38
|
-
* 节点深度
|
|
39
|
-
*/
|
|
40
|
-
depth?: number;
|
|
41
|
-
/**
|
|
42
|
-
* 自定义图标
|
|
43
|
-
*/
|
|
44
|
-
icon?: string;
|
|
45
|
-
/**
|
|
46
|
-
* 原始数据
|
|
47
|
-
*/
|
|
48
|
-
data: Record<string, any>;
|
|
49
|
-
/**
|
|
50
|
-
* 根节点标识
|
|
51
|
-
*/
|
|
52
|
-
rootId: string;
|
|
53
|
-
/**
|
|
54
|
-
* 根节点
|
|
55
|
-
*/
|
|
56
|
-
isRoot?: boolean;
|
|
57
|
-
/**
|
|
58
|
-
* 是否显示
|
|
59
|
-
*/
|
|
60
|
-
visible?: boolean;
|
|
61
|
-
}
|
|
62
5
|
export interface INodeEditInfo {
|
|
63
6
|
/**
|
|
64
7
|
* @description 图标
|
|
@@ -86,41 +29,41 @@ export interface INodeEditInfo {
|
|
|
86
29
|
type: 'draft' | 'edit';
|
|
87
30
|
/**
|
|
88
31
|
* @description 草稿的父节点 | 编辑节点
|
|
89
|
-
* @type {
|
|
32
|
+
* @type {ITreeNode}
|
|
90
33
|
* @memberof INodeEditInfo
|
|
91
34
|
*/
|
|
92
|
-
node:
|
|
35
|
+
node: ITreeNode;
|
|
93
36
|
}
|
|
94
37
|
interface LazyTreeProps {
|
|
95
38
|
/**
|
|
96
39
|
* 根节点数据
|
|
97
40
|
*/
|
|
98
|
-
nodes:
|
|
41
|
+
nodes: ITreeNode[];
|
|
99
42
|
/**
|
|
100
43
|
* 异步加载子节点方法
|
|
101
44
|
* 返回子节点数组
|
|
102
45
|
*/
|
|
103
|
-
lazyLoad?: (node:
|
|
46
|
+
lazyLoad?: (node: ITreeNode) => Promise<ITreeNode[]>;
|
|
104
47
|
/**
|
|
105
48
|
* 节点点击回调
|
|
106
49
|
*/
|
|
107
|
-
onNodeClick?: (
|
|
50
|
+
onNodeClick?: (event: MouseEvent, node: ITreeNode) => void;
|
|
108
51
|
/**
|
|
109
52
|
* 节点选中回调
|
|
110
53
|
*/
|
|
111
|
-
onNodeCheck?: (node:
|
|
54
|
+
onNodeCheck?: (node: ITreeNode, checked: boolean) => void;
|
|
112
55
|
/**
|
|
113
56
|
* 节点展开回调
|
|
114
57
|
*/
|
|
115
|
-
onNodeExpand?: (node:
|
|
58
|
+
onNodeExpand?: (node: ITreeNode, expanded: boolean) => void;
|
|
116
59
|
/**
|
|
117
60
|
* 当前活动路径变化回调(用户最后点击/展开的路径)
|
|
118
61
|
*/
|
|
119
|
-
onActivePathChange?: (path:
|
|
62
|
+
onActivePathChange?: (path: ITreeNode[]) => void;
|
|
120
63
|
/**
|
|
121
64
|
* 当前激活路径
|
|
122
65
|
*/
|
|
123
|
-
activePath?:
|
|
66
|
+
activePath?: ITreeNode[];
|
|
124
67
|
/**
|
|
125
68
|
* 是否显示搜索框
|
|
126
69
|
* @default true
|
|
@@ -145,11 +88,6 @@ interface LazyTreeProps {
|
|
|
145
88
|
* @default true
|
|
146
89
|
*/
|
|
147
90
|
expandOnClickNode?: boolean;
|
|
148
|
-
/**
|
|
149
|
-
* 标识分隔符
|
|
150
|
-
* @default '/'
|
|
151
|
-
*/
|
|
152
|
-
separator?: string;
|
|
153
91
|
/**
|
|
154
92
|
* 过滤值
|
|
155
93
|
*/
|
|
@@ -178,15 +116,21 @@ interface LazyTreeProps {
|
|
|
178
116
|
* @returns
|
|
179
117
|
*/
|
|
180
118
|
onCancel?: () => void;
|
|
119
|
+
/**
|
|
120
|
+
* 节点过滤
|
|
121
|
+
* @param node
|
|
122
|
+
* @returns
|
|
123
|
+
*/
|
|
124
|
+
filterNodeMethod?: (node: ITreeNode) => boolean;
|
|
181
125
|
}
|
|
182
126
|
export interface LazyTreeRef {
|
|
183
127
|
/**
|
|
184
128
|
* @description 重载节点
|
|
185
|
-
* @param {
|
|
129
|
+
* @param {ITreeNode} node 需要重载的节点
|
|
186
130
|
* @param {boolean} isParent 是否重载父节点,默认为false
|
|
187
131
|
* @memberof LazyTreeRef
|
|
188
132
|
*/
|
|
189
|
-
overloadNode: (node:
|
|
133
|
+
overloadNode: (node: ITreeNode, isParent?: boolean) => Promise<void>;
|
|
190
134
|
}
|
|
191
135
|
/**
|
|
192
136
|
* 懒加载树组件
|
|
@@ -1,20 +1,24 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComponentChildren } from 'preact';
|
|
2
|
+
import { IAction } from '../common/actions/actions';
|
|
2
3
|
|
|
3
4
|
type Position = 'top' | 'bottom' | 'left' | 'right' | 'top-left';
|
|
4
|
-
interface
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
interface IActionItem extends IAction {
|
|
6
|
+
position?: Position;
|
|
7
|
+
children?: IActionItem[];
|
|
8
|
+
triggerMode?: 'click' | 'hover';
|
|
9
|
+
content?: ComponentChildren;
|
|
10
|
+
popupClassName?: string;
|
|
8
11
|
}
|
|
9
|
-
export declare const Popup: ({ triggerMode, children, actions, content, disabled, position, isOpen: isOpenProp, onToggleOpen, popupClassName, onAction, }: {
|
|
12
|
+
export declare const Popup: ({ data, triggerMode, children, actions, content, disabled, position, isOpen: isOpenProp, onToggleOpen, popupClassName, onAction, }: {
|
|
10
13
|
triggerMode: "click" | "hover";
|
|
11
|
-
children:
|
|
12
|
-
actions?:
|
|
13
|
-
content?:
|
|
14
|
+
children: ComponentChildren;
|
|
15
|
+
actions?: IActionItem[];
|
|
16
|
+
content?: ComponentChildren;
|
|
14
17
|
position?: Position;
|
|
15
18
|
isOpen?: boolean;
|
|
16
19
|
popupClassName?: string;
|
|
17
20
|
disabled?: boolean;
|
|
21
|
+
data?: any;
|
|
18
22
|
onToggleOpen?: (isOpen: boolean) => void;
|
|
19
23
|
onAction?: (actionId: string, event: MouseEvent) => void;
|
|
20
24
|
}) => import("preact").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IFile, IFileItem, IMessageUtil, IConfirmUtil, IFileItemParams, IFileUploadPrams, IFileSystemOptions, FileUploaderOptions } from '../../interface';
|
|
1
|
+
import { IFile, IFileItem, ITreeNode, IMessageUtil, IConfirmUtil, IFileItemParams, IFileUploadPrams, IFileSystemOptions, FileUploaderOptions } from '../../interface';
|
|
2
2
|
import { AiChatController } from '../ai-chat/ai-chat.controller';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -9,7 +9,7 @@ import { AiChatController } from '../ai-chat/ai-chat.controller';
|
|
|
9
9
|
export declare class FileSystemController {
|
|
10
10
|
private opts;
|
|
11
11
|
private uploader;
|
|
12
|
-
|
|
12
|
+
aiChat: AiChatController;
|
|
13
13
|
/**
|
|
14
14
|
* Creates an instance of FileSystemController.
|
|
15
15
|
* @param {IFileSystemOptions} opts
|
|
@@ -48,9 +48,10 @@ export declare class FileSystemController {
|
|
|
48
48
|
/**
|
|
49
49
|
* @description 文件预览模式
|
|
50
50
|
* @readonly
|
|
51
|
+
* @type {("DEFAULT" | "CUSTOM" | undefined)}
|
|
51
52
|
* @memberof FileSystemController
|
|
52
53
|
*/
|
|
53
|
-
get filePreviewMode():
|
|
54
|
+
get filePreviewMode(): 'DEFAULT' | 'CUSTOM' | undefined;
|
|
54
55
|
/**
|
|
55
56
|
* @description 绑定函数this指向
|
|
56
57
|
* @private
|
|
@@ -172,4 +173,12 @@ export declare class FileSystemController {
|
|
|
172
173
|
* @memberof FileSystemController
|
|
173
174
|
*/
|
|
174
175
|
uploadFileToSystem(file_path: string, file: File): Promise<boolean>;
|
|
176
|
+
/**
|
|
177
|
+
* @description 加载文件树节点
|
|
178
|
+
* @param {ITreeNode} [parent] 父节点
|
|
179
|
+
* @param {IFileItemParams} [params] 参数
|
|
180
|
+
* @returns {*} {Promise<ITreeNode[]>}
|
|
181
|
+
* @memberof FileSystemController
|
|
182
|
+
*/
|
|
183
|
+
loadFileTreeNodes(parent?: ITreeNode, params?: IFileItemParams): Promise<ITreeNode[]>;
|
|
175
184
|
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export interface ITreeNode {
|
|
2
|
+
/**
|
|
3
|
+
* 根节点标识
|
|
4
|
+
*/
|
|
5
|
+
rootId: string;
|
|
6
|
+
/**
|
|
7
|
+
* 节点唯一标识
|
|
8
|
+
*/
|
|
9
|
+
id: string;
|
|
10
|
+
/**
|
|
11
|
+
* 节点显示文本
|
|
12
|
+
*/
|
|
13
|
+
label: string;
|
|
14
|
+
/**
|
|
15
|
+
* 是否叶子节点
|
|
16
|
+
*/
|
|
17
|
+
isLeaf: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* 节点深度
|
|
20
|
+
*/
|
|
21
|
+
depth: number;
|
|
22
|
+
/**
|
|
23
|
+
* 子节点
|
|
24
|
+
*/
|
|
25
|
+
children?: ITreeNode[];
|
|
26
|
+
/**
|
|
27
|
+
* 是否已加载子节点
|
|
28
|
+
*/
|
|
29
|
+
loaded?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* 是否展开
|
|
32
|
+
*/
|
|
33
|
+
expanded?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* 是否正在加载
|
|
36
|
+
*/
|
|
37
|
+
loading?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* 父节点标识
|
|
40
|
+
*/
|
|
41
|
+
parentId?: string;
|
|
42
|
+
/**
|
|
43
|
+
* 自定义图标
|
|
44
|
+
*/
|
|
45
|
+
icon?: string;
|
|
46
|
+
/**
|
|
47
|
+
* 原始数据
|
|
48
|
+
*/
|
|
49
|
+
data: Record<string, any>;
|
|
50
|
+
/**
|
|
51
|
+
* 根节点
|
|
52
|
+
*/
|
|
53
|
+
isRoot?: boolean;
|
|
54
|
+
}
|
|
@@ -29,3 +29,4 @@ export type { IFile, IFileItem, IFileItemParams, IFileUploadPrams, } from './i-f
|
|
|
29
29
|
export type { IFileSystemOptions } from './i-file-system-options/i-file-system-options';
|
|
30
30
|
export { TipTapNodeType, type ITipTapDropData, type TipTapNodeConfig, } from './i-tiptap/i-tiptap';
|
|
31
31
|
export * from './deep-research';
|
|
32
|
+
export type { ITreeNode } from './i-tree-node/i-tree-node';
|
|
@@ -11,5 +11,6 @@ export { ChatToolCallParser } from './util/chat-tool-call-parser';
|
|
|
11
11
|
export { ChatStepParser } from './util/chat-step-parser';
|
|
12
12
|
export { ChatUIActionParser } from './util/chat-ui-action-parser';
|
|
13
13
|
export { ContentProtector } from './util/content-protector';
|
|
14
|
+
export { MarkdownPreview } from './markdown-preview';
|
|
14
15
|
export { TextUtil } from './util/util';
|
|
15
16
|
export { FileIcon, FolderIcon } from './util/system-file';
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 消息 markdown 预览渲染器
|
|
3
|
+
*
|
|
4
|
+
* ## 为什么不直接用 `new Cherry({ defaultModel: 'previewOnly' })` + setMarkdown
|
|
5
|
+
* previewOnly 模式的 Cherry 仍会创建 CodeMirror、工具栏、内部 ResizeObserver 等完整
|
|
6
|
+
* 编辑器 DOM,而 cherry 0.8.58 的 destroy() 仅移除容器与清空事件总线,不销毁编辑器、
|
|
7
|
+
* 不断开内部观察器;消息列表滚出视口→卸载、滚回→重建的机制下,被销毁实例的整棵 DOM
|
|
8
|
+
* 会持续滞留在堆上(内存泄露)。消息预览只需要 markdown→HTML。
|
|
9
|
+
*
|
|
10
|
+
* ## 为什么主入口 Cherry 还要「无 el」实例化
|
|
11
|
+
* 主入口 default 导出的是完整编辑器类 Cherry(引擎类 CherryEngine 仅在
|
|
12
|
+
* dist/cherry-markdown.engine.core.esm.js 子路径导出,无法被宿主 external 复用)。
|
|
13
|
+
* Cherry 不传 el 且不强制挂载(forceAppend 默认 false)时,init() 在创建编辑区/
|
|
14
|
+
* 工具栏之前即返回,不产生任何编辑器 DOM;此时仅借用实例内部的 Engine 完成
|
|
15
|
+
* markdown→HTML(Engine 构造与 makeHtml 均不依赖编辑器 DOM)。
|
|
16
|
+
*/
|
|
17
|
+
export interface IMarkdownPreviewTheme {
|
|
18
|
+
/**
|
|
19
|
+
* 主题(cherry themeSettings.mainTheme),默认 light
|
|
20
|
+
*/
|
|
21
|
+
mainTheme?: string;
|
|
22
|
+
/**
|
|
23
|
+
* 代码块主题(cherry themeSettings.codeBlockTheme),默认 default
|
|
24
|
+
*/
|
|
25
|
+
codeBlockTheme?: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* markdown 预览渲染器实例:每个消息组件持有一个,
|
|
29
|
+
* render 可反复调用(流式更新),容器被卸载重建后会自动重建骨架
|
|
30
|
+
*/
|
|
31
|
+
export declare class MarkdownPreview {
|
|
32
|
+
private wrapper;
|
|
33
|
+
private previewer;
|
|
34
|
+
/**
|
|
35
|
+
* 渲染 markdown 到容器:首次构建 cherry 预览骨架(class/主题属性与
|
|
36
|
+
* cherry previewOnly 结构一致,保证样式不变),后续调用仅更新内容
|
|
37
|
+
*/
|
|
38
|
+
render(container: HTMLElement, md: string, theme?: IMarkdownPreviewTheme): void;
|
|
39
|
+
/**
|
|
40
|
+
* 预览内容容器(如外部 ResizeObserver 需要测量内容高度)
|
|
41
|
+
*/
|
|
42
|
+
getPreviewerDom(): HTMLDivElement | null;
|
|
43
|
+
/**
|
|
44
|
+
* 卸载骨架(无实例资源,仅移除 DOM)
|
|
45
|
+
*/
|
|
46
|
+
destroy(): void;
|
|
47
|
+
}
|