tiptap-ui-kit-k 0.1.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/LICENSE +21 -0
- package/README.md +450 -0
- package/dist/IMG_8528.JPG +0 -0
- package/dist/IMG_8529.JPG +0 -0
- package/dist/index.d.ts +1397 -0
- package/dist/index.esm.js +67452 -0
- package/dist/index.js +14 -0
- package/dist/llms.txt +65 -0
- package/dist/tiptap-ui-kit-k.css +1 -0
- package/dist/websocket-DLLOwgDf.js +12 -0
- package/dist/websocket-Hm6nu9fH.cjs +1 -0
- package/package.json +166 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1397 @@
|
|
|
1
|
+
import { default as AiSuggestionPopover } from './shared/AiSuggestionPopover.vue';
|
|
2
|
+
import { Component } from 'vue';
|
|
3
|
+
import { ComponentOptionsMixin } from 'vue';
|
|
4
|
+
import { ComponentProvideOptions } from 'vue';
|
|
5
|
+
import { ComputedRef } from 'vue';
|
|
6
|
+
import { default as CustomAiPopover } from './shared/CustomAiPopover.vue';
|
|
7
|
+
import { DefineComponent } from 'vue';
|
|
8
|
+
import { DocumentType as DocumentType_2 } from '@tiptap/core';
|
|
9
|
+
import { Editor } from '@tiptap/vue-3';
|
|
10
|
+
import { Editor as Editor_2 } from '@tiptap/core';
|
|
11
|
+
import { Extension } from '@tiptap/core';
|
|
12
|
+
import { JSONContent } from '@tiptap/core';
|
|
13
|
+
import { Mark } from '@tiptap/core';
|
|
14
|
+
import { MarkType } from '@tiptap/core';
|
|
15
|
+
import { NodeType } from '@tiptap/core';
|
|
16
|
+
import { PublicProps } from 'vue';
|
|
17
|
+
import { readonly } from 'vue';
|
|
18
|
+
import { Ref } from 'vue';
|
|
19
|
+
import { ref } from 'vue';
|
|
20
|
+
import { TextType } from '@tiptap/core';
|
|
21
|
+
|
|
22
|
+
/** 提供商列表 */
|
|
23
|
+
export declare const AI_PROVIDERS: AiProviderInfo[];
|
|
24
|
+
|
|
25
|
+
/** AI adapter interface */
|
|
26
|
+
export declare interface AiAdapter {
|
|
27
|
+
/** Provider name */
|
|
28
|
+
provider: AiProvider_2;
|
|
29
|
+
/** Chat completion (non-streaming) */
|
|
30
|
+
chat(messages: AiMessage[], options?: Partial<AiConfig_2>): Promise<AiResponse>;
|
|
31
|
+
/** Chat completion (streaming) */
|
|
32
|
+
chatStream(messages: AiMessage[], callbacks: AiStreamCallbacks, options?: Partial<AiConfig_2>): Promise<void>;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** AI configuration */
|
|
36
|
+
export declare interface AiConfig {
|
|
37
|
+
provider: 'openai' | 'aliyun' | 'ollama' | 'deepseek';
|
|
38
|
+
apiKey: string;
|
|
39
|
+
model?: string;
|
|
40
|
+
baseUrl?: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** AI configuration from env */
|
|
44
|
+
declare interface AiConfig_2 {
|
|
45
|
+
provider: AiProvider_2;
|
|
46
|
+
apiKey?: string;
|
|
47
|
+
apiSecret?: string;
|
|
48
|
+
baseUrl?: string;
|
|
49
|
+
model?: string;
|
|
50
|
+
temperature?: number;
|
|
51
|
+
maxTokens?: number;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** AI 配置状态 */
|
|
55
|
+
export declare interface AiConfigState {
|
|
56
|
+
/** 用户配置 */
|
|
57
|
+
config: AiUserConfig | null;
|
|
58
|
+
/** 是否已初始化 */
|
|
59
|
+
initialized: boolean;
|
|
60
|
+
/** 连接测试状态 */
|
|
61
|
+
testStatus: 'idle' | 'testing' | 'success' | 'error';
|
|
62
|
+
/** 测试错误信息 */
|
|
63
|
+
testError: string | null;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* AI Highlight Mark Extension
|
|
68
|
+
* @description Highlights text that is being processed by AI
|
|
69
|
+
*/
|
|
70
|
+
export declare const AiHighlightMark: Mark<AiHighlightOptions, any>;
|
|
71
|
+
|
|
72
|
+
declare interface AiHighlightOptions {
|
|
73
|
+
HTMLAttributes: Record<string, any>;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export declare const AiMenuButton: DefineComponent<Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<Props> & Readonly<{}>, {
|
|
77
|
+
active: boolean;
|
|
78
|
+
placement: "top" | "bottom" | "bottomLeft" | "bottomRight" | "topLeft" | "topRight";
|
|
79
|
+
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
80
|
+
|
|
81
|
+
/** Message format */
|
|
82
|
+
export declare interface AiMessage {
|
|
83
|
+
role: 'system' | 'user' | 'assistant';
|
|
84
|
+
content: string;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* AI Configuration Types
|
|
89
|
+
* @description AI 用户配置系统类型定义
|
|
90
|
+
*/
|
|
91
|
+
/** 支持的 AI 提供商 */
|
|
92
|
+
export declare type AiProvider = 'openai' | 'deepseek' | 'anthropic' | 'aliyun' | 'ollama' | 'custom';
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* AI Types
|
|
96
|
+
* Common types for AI adapters
|
|
97
|
+
*/
|
|
98
|
+
/** Supported AI providers */
|
|
99
|
+
declare type AiProvider_2 = 'openai' | 'aliyun' | 'ollama' | 'deepseek' | 'anthropic' | 'custom';
|
|
100
|
+
|
|
101
|
+
/** AI 提供商信息 */
|
|
102
|
+
export declare interface AiProviderInfo {
|
|
103
|
+
/** 提供商 ID */
|
|
104
|
+
id: AiProvider;
|
|
105
|
+
/** 显示名称 */
|
|
106
|
+
name: string;
|
|
107
|
+
/** 描述 */
|
|
108
|
+
description: string;
|
|
109
|
+
/** 默认 API 端点 */
|
|
110
|
+
defaultEndpoint: string;
|
|
111
|
+
/** 默认模型 */
|
|
112
|
+
defaultModel: string;
|
|
113
|
+
/** 是否需要 API Key */
|
|
114
|
+
requiresApiKey: boolean;
|
|
115
|
+
/** 文档链接 */
|
|
116
|
+
docsUrl?: string;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** Non-streaming response */
|
|
120
|
+
declare interface AiResponse {
|
|
121
|
+
content: string;
|
|
122
|
+
finishReason?: string;
|
|
123
|
+
usage?: {
|
|
124
|
+
promptTokens: number;
|
|
125
|
+
completionTokens: number;
|
|
126
|
+
totalTokens: number;
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export declare const AiSettingsModal: DefineComponent<Props_3, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
131
|
+
"update:open": (value: boolean) => any;
|
|
132
|
+
saved: () => any;
|
|
133
|
+
}, string, PublicProps, Readonly<Props_3> & Readonly<{
|
|
134
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
135
|
+
onSaved?: (() => any) | undefined;
|
|
136
|
+
}>, {
|
|
137
|
+
open: boolean;
|
|
138
|
+
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
139
|
+
|
|
140
|
+
/** Streaming callbacks */
|
|
141
|
+
export declare interface AiStreamCallbacks {
|
|
142
|
+
onStart?: () => void;
|
|
143
|
+
onToken?: (token: string) => void;
|
|
144
|
+
onComplete?: (fullText: string) => void;
|
|
145
|
+
onError?: (error: Error) => void;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export declare interface AiSuggestionData {
|
|
149
|
+
originalText: string;
|
|
150
|
+
suggestedText: string;
|
|
151
|
+
isStreaming: boolean;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
declare class AiSuggestionManager {
|
|
155
|
+
private editor;
|
|
156
|
+
private popoverApp;
|
|
157
|
+
private container;
|
|
158
|
+
private state;
|
|
159
|
+
private visibleRef;
|
|
160
|
+
private originalTextRef;
|
|
161
|
+
private suggestedTextRef;
|
|
162
|
+
private isStreamingRef;
|
|
163
|
+
private isTemporarilyHidden;
|
|
164
|
+
private clickHandler;
|
|
165
|
+
/**
|
|
166
|
+
* Initialize the suggestion manager
|
|
167
|
+
*/
|
|
168
|
+
init(editor: Editor_2): void;
|
|
169
|
+
/**
|
|
170
|
+
* Setup click handler for highlighted text
|
|
171
|
+
*/
|
|
172
|
+
private setupClickHandler;
|
|
173
|
+
/**
|
|
174
|
+
* Remove click handler to prevent memory leaks
|
|
175
|
+
*/
|
|
176
|
+
private removeClickHandler;
|
|
177
|
+
/**
|
|
178
|
+
* Restore existing highlights from the document
|
|
179
|
+
*/
|
|
180
|
+
private restoreExistingHighlights;
|
|
181
|
+
/**
|
|
182
|
+
* Restore a suggestion from saved data
|
|
183
|
+
*/
|
|
184
|
+
private restoreSuggestion;
|
|
185
|
+
/**
|
|
186
|
+
* Show AI suggestion popover
|
|
187
|
+
*/
|
|
188
|
+
show(originalText: string, originalSelection: {
|
|
189
|
+
from: number;
|
|
190
|
+
to: number;
|
|
191
|
+
}, editor?: Editor_2): void;
|
|
192
|
+
/**
|
|
193
|
+
* Show the popover (for clicking on highlighted text)
|
|
194
|
+
*/
|
|
195
|
+
private showPopover;
|
|
196
|
+
/**
|
|
197
|
+
* Update suggested text (for streaming)
|
|
198
|
+
*/
|
|
199
|
+
updateSuggestion(text: string): void;
|
|
200
|
+
/**
|
|
201
|
+
* Stop streaming
|
|
202
|
+
*/
|
|
203
|
+
stopStreaming(): void;
|
|
204
|
+
/**
|
|
205
|
+
* Accept the suggestion
|
|
206
|
+
*/
|
|
207
|
+
accept(): void;
|
|
208
|
+
/**
|
|
209
|
+
* Build paragraph nodes from text with newlines
|
|
210
|
+
*/
|
|
211
|
+
private buildParagraphNodes;
|
|
212
|
+
/**
|
|
213
|
+
* Reject the suggestion
|
|
214
|
+
*/
|
|
215
|
+
reject(): void;
|
|
216
|
+
/**
|
|
217
|
+
* Cancel (temporarily hide) the suggestion
|
|
218
|
+
*/
|
|
219
|
+
cancel(): void;
|
|
220
|
+
/**
|
|
221
|
+
* Hide the popover and cleanup
|
|
222
|
+
*/
|
|
223
|
+
hide(): void;
|
|
224
|
+
/**
|
|
225
|
+
* Check if suggestion is visible
|
|
226
|
+
*/
|
|
227
|
+
isVisible(): boolean;
|
|
228
|
+
/**
|
|
229
|
+
* Get current state
|
|
230
|
+
*/
|
|
231
|
+
getState(): AiSuggestionState;
|
|
232
|
+
/**
|
|
233
|
+
* Mount the popover component
|
|
234
|
+
*/
|
|
235
|
+
private mountPopover;
|
|
236
|
+
/**
|
|
237
|
+
* Unmount the popover component
|
|
238
|
+
*/
|
|
239
|
+
private unmountPopover;
|
|
240
|
+
/**
|
|
241
|
+
* Calculate popover position based on selection
|
|
242
|
+
*/
|
|
243
|
+
private calculatePopoverPosition;
|
|
244
|
+
/**
|
|
245
|
+
* Cleanup
|
|
246
|
+
*/
|
|
247
|
+
destroy(): void;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
export declare const aiSuggestionManager: AiSuggestionManager;
|
|
251
|
+
|
|
252
|
+
export { AiSuggestionPopover }
|
|
253
|
+
|
|
254
|
+
export declare interface AiSuggestionState {
|
|
255
|
+
visible: boolean;
|
|
256
|
+
originalText: string;
|
|
257
|
+
suggestedText: string;
|
|
258
|
+
isStreaming: boolean;
|
|
259
|
+
originalSelection: {
|
|
260
|
+
from: number;
|
|
261
|
+
to: number;
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
export declare const AiToolbarMenu: DefineComponent<Props_2, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<Props_2> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
266
|
+
|
|
267
|
+
/** 用户 AI 配置 */
|
|
268
|
+
export declare interface AiUserConfig {
|
|
269
|
+
/** 选择的提供商 */
|
|
270
|
+
provider: AiProvider;
|
|
271
|
+
/** API Key(加密存储) */
|
|
272
|
+
apiKey: string;
|
|
273
|
+
/** API 端点(可选,用于自定义或代理) */
|
|
274
|
+
endpoint?: string;
|
|
275
|
+
/** 模型名称 */
|
|
276
|
+
model: string;
|
|
277
|
+
/** 请求超时(毫秒) */
|
|
278
|
+
timeout: number;
|
|
279
|
+
/** 是否启用 */
|
|
280
|
+
enabled: boolean;
|
|
281
|
+
/** 最后更新时间 */
|
|
282
|
+
updatedAt: number;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Apply custom theme variables
|
|
287
|
+
*/
|
|
288
|
+
export declare function applyCustomTheme(variables: Record<string, string>): void;
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* 协作用户信息
|
|
292
|
+
*/
|
|
293
|
+
export declare interface CollaboratorInfo {
|
|
294
|
+
id: string | number;
|
|
295
|
+
name: string;
|
|
296
|
+
color: string;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/** 连接测试结果 */
|
|
300
|
+
declare interface ConnectionTestResult {
|
|
301
|
+
success: boolean;
|
|
302
|
+
message: string;
|
|
303
|
+
latency?: number;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* Continue Writing Extension for Tiptap v3
|
|
308
|
+
* @description AI-powered text continuation based on selection
|
|
309
|
+
*/
|
|
310
|
+
export declare const ContinueWritingExtension: Extension<ContinueWritingOptions, any>;
|
|
311
|
+
|
|
312
|
+
export declare interface ContinueWritingOptions {
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Create i18n instance
|
|
317
|
+
*/
|
|
318
|
+
export declare function createI18n(options?: {
|
|
319
|
+
locale?: LocaleCode;
|
|
320
|
+
fallbackLocale?: LocaleCode;
|
|
321
|
+
messages?: Record<string, LocaleMessages>;
|
|
322
|
+
}): void;
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* Custom AI Extension for Tiptap v3
|
|
326
|
+
* @description AI-powered custom text processing with user-defined prompts
|
|
327
|
+
*/
|
|
328
|
+
export declare const CustomAiExtension: Extension<CustomAiOptions, any>;
|
|
329
|
+
|
|
330
|
+
export declare interface CustomAiOptions {
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
export { CustomAiPopover }
|
|
334
|
+
|
|
335
|
+
/** 默认配置值 */
|
|
336
|
+
export declare const DEFAULT_CONFIG: Omit<AiUserConfig, 'apiKey' | 'updatedAt'>;
|
|
337
|
+
|
|
338
|
+
/** Export device view options */
|
|
339
|
+
export declare const DEVICE_VIEWS: readonly ["pc", "pad", "mobile"];
|
|
340
|
+
|
|
341
|
+
/** Device view type */
|
|
342
|
+
export declare type DeviceView = 'pc' | 'pad' | 'mobile';
|
|
343
|
+
|
|
344
|
+
/** Editor configuration */
|
|
345
|
+
export declare interface EditorConfig {
|
|
346
|
+
/** Theme mode (light/dark/auto) */
|
|
347
|
+
theme?: ThemeMode;
|
|
348
|
+
/** Theme preset */
|
|
349
|
+
themePreset?: ThemePreset;
|
|
350
|
+
/** Custom theme CSS variables */
|
|
351
|
+
customTheme?: Record<string, string>;
|
|
352
|
+
/** Feature flags */
|
|
353
|
+
features?: FeatureFlags;
|
|
354
|
+
/** AI configuration */
|
|
355
|
+
aiConfig?: AiConfig;
|
|
356
|
+
/** Locale */
|
|
357
|
+
locale?: 'zh-CN' | 'zh-TW' | 'en-US';
|
|
358
|
+
/** Readonly mode */
|
|
359
|
+
readonly?: boolean;
|
|
360
|
+
/** Preview mode (no toolbar) */
|
|
361
|
+
previewMode?: boolean;
|
|
362
|
+
/** Initial content */
|
|
363
|
+
initialContent?: string;
|
|
364
|
+
/** Placeholder */
|
|
365
|
+
placeholder?: string;
|
|
366
|
+
/** License key */
|
|
367
|
+
licenseKey?: string;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* 编辑器实例引用
|
|
372
|
+
*/
|
|
373
|
+
export declare interface EditorInstance {
|
|
374
|
+
editor: Editor | null;
|
|
375
|
+
getEditor: () => Editor | null;
|
|
376
|
+
getJSON: () => JSONContent | null;
|
|
377
|
+
getHTML: () => string;
|
|
378
|
+
getText: () => string;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* 版本类型
|
|
383
|
+
*/
|
|
384
|
+
export declare type EditorVersion = 'basic' | 'advanced' | 'premium';
|
|
385
|
+
|
|
386
|
+
export declare const enUS: TiptapLocale;
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* 编辑器功能配置
|
|
390
|
+
*/
|
|
391
|
+
export declare interface FeatureConfig {
|
|
392
|
+
/** 是否启用拖拽功能 */
|
|
393
|
+
dragHandle?: boolean;
|
|
394
|
+
/** 是否启用六个点(拖拽手柄菜单)功能 */
|
|
395
|
+
dragHandleMenu?: boolean;
|
|
396
|
+
/** 是否启用表格功能 */
|
|
397
|
+
table?: boolean;
|
|
398
|
+
/** 是否启用表格工具栏(默认关闭,需显式开启) */
|
|
399
|
+
tableToolbar?: boolean;
|
|
400
|
+
/** 是否启用@提及功能 */
|
|
401
|
+
mention?: boolean;
|
|
402
|
+
/** 是否启用斜杠命令菜单(输入 / 弹出块类型选择) */
|
|
403
|
+
slashCommand?: boolean;
|
|
404
|
+
/** 是否启用悬浮框功能 */
|
|
405
|
+
floatingMenu?: boolean;
|
|
406
|
+
/** 是否启用图片工具栏功能 */
|
|
407
|
+
image?: boolean;
|
|
408
|
+
/** 是否启用链接悬浮框功能 */
|
|
409
|
+
linkBubbleMenu?: boolean;
|
|
410
|
+
/** 是否启用协作编辑功能 */
|
|
411
|
+
collaboration?: boolean;
|
|
412
|
+
/** 是否启用头部导航 */
|
|
413
|
+
headerNav?: boolean;
|
|
414
|
+
/** 是否启用底部导航 */
|
|
415
|
+
footerNav?: boolean;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
/** Feature flags */
|
|
419
|
+
export declare interface FeatureFlags {
|
|
420
|
+
heading?: boolean;
|
|
421
|
+
textFormat?: boolean;
|
|
422
|
+
list?: boolean;
|
|
423
|
+
align?: boolean;
|
|
424
|
+
color?: boolean;
|
|
425
|
+
image?: boolean;
|
|
426
|
+
font?: boolean;
|
|
427
|
+
link?: boolean;
|
|
428
|
+
table?: boolean;
|
|
429
|
+
codeBlock?: boolean;
|
|
430
|
+
undoRedo?: boolean;
|
|
431
|
+
formatPainter?: boolean;
|
|
432
|
+
zoom?: boolean;
|
|
433
|
+
subscriptSuperscript?: boolean;
|
|
434
|
+
clearFormat?: boolean;
|
|
435
|
+
headerNav?: boolean;
|
|
436
|
+
footerNav?: boolean;
|
|
437
|
+
dragHandleMenu?: boolean;
|
|
438
|
+
floatingMenu?: boolean;
|
|
439
|
+
linkBubbleMenu?: boolean;
|
|
440
|
+
tableToolbar?: boolean;
|
|
441
|
+
imageToolbar?: boolean;
|
|
442
|
+
ai?: boolean;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
/**
|
|
446
|
+
* 获取静态配置(非响应式,用于 API 调用)
|
|
447
|
+
*/
|
|
448
|
+
export declare function getAiRequestConfig(): {
|
|
449
|
+
endpoint: string;
|
|
450
|
+
apiKey: string;
|
|
451
|
+
model: string;
|
|
452
|
+
timeout: number;
|
|
453
|
+
provider: AiProvider;
|
|
454
|
+
} | null;
|
|
455
|
+
|
|
456
|
+
/**
|
|
457
|
+
* Get current device view
|
|
458
|
+
*/
|
|
459
|
+
export declare function getDeviceView(): DeviceView;
|
|
460
|
+
|
|
461
|
+
/**
|
|
462
|
+
* Get current orientation
|
|
463
|
+
*/
|
|
464
|
+
export declare function getOrientation(): Orientation;
|
|
465
|
+
|
|
466
|
+
/** 根据 provider ID 获取提供商信息 */
|
|
467
|
+
export declare function getProviderInfo(provider: AiProvider): AiProviderInfo | undefined;
|
|
468
|
+
|
|
469
|
+
/**
|
|
470
|
+
* Get current theme
|
|
471
|
+
*/
|
|
472
|
+
export declare function getTheme(): {
|
|
473
|
+
preset: ThemePreset;
|
|
474
|
+
mode: ThemeMode;
|
|
475
|
+
};
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* Initialize theme from system preferences
|
|
479
|
+
*/
|
|
480
|
+
export declare function initTheme(): void;
|
|
481
|
+
|
|
482
|
+
export declare type LocaleCode = 'zh-CN' | 'zh-TW' | 'en-US';
|
|
483
|
+
|
|
484
|
+
export declare type LocaleMessages = typeof zhCN;
|
|
485
|
+
|
|
486
|
+
/** 合并配置 */
|
|
487
|
+
export declare function mergeConfig(preset: PresetName | Partial<EditorConfig>, overrides?: Partial<EditorConfig>): EditorConfig;
|
|
488
|
+
|
|
489
|
+
/** Orientation type */
|
|
490
|
+
export declare type Orientation = 'portrait' | 'landscape';
|
|
491
|
+
|
|
492
|
+
/** Export orientation options */
|
|
493
|
+
export declare const ORIENTATIONS: readonly ["portrait", "landscape"];
|
|
494
|
+
|
|
495
|
+
/**
|
|
496
|
+
* Polish Extension for Tiptap v3
|
|
497
|
+
* @description AI-powered text polishing/refinement based on selection
|
|
498
|
+
*/
|
|
499
|
+
export declare const PolishExtension: Extension<PolishOptions, any>;
|
|
500
|
+
|
|
501
|
+
export declare interface PolishOptions {
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
/** Preset configurations */
|
|
505
|
+
export declare const PRESET_CONFIGS: {
|
|
506
|
+
/** 最小配置 */
|
|
507
|
+
readonly minimal: {
|
|
508
|
+
features: {
|
|
509
|
+
textFormat: true;
|
|
510
|
+
list: true;
|
|
511
|
+
undoRedo: true;
|
|
512
|
+
};
|
|
513
|
+
};
|
|
514
|
+
/** 基础配置 */
|
|
515
|
+
readonly basic: {
|
|
516
|
+
features: {
|
|
517
|
+
heading: true;
|
|
518
|
+
textFormat: true;
|
|
519
|
+
list: true;
|
|
520
|
+
align: true;
|
|
521
|
+
link: true;
|
|
522
|
+
undoRedo: true;
|
|
523
|
+
headerNav: true;
|
|
524
|
+
};
|
|
525
|
+
};
|
|
526
|
+
/** 高级配置 */
|
|
527
|
+
readonly advanced: {
|
|
528
|
+
features: {
|
|
529
|
+
heading: true;
|
|
530
|
+
textFormat: true;
|
|
531
|
+
list: true;
|
|
532
|
+
align: true;
|
|
533
|
+
color: true;
|
|
534
|
+
image: true;
|
|
535
|
+
font: true;
|
|
536
|
+
link: true;
|
|
537
|
+
table: true;
|
|
538
|
+
codeBlock: true;
|
|
539
|
+
undoRedo: true;
|
|
540
|
+
formatPainter: true;
|
|
541
|
+
zoom: true;
|
|
542
|
+
headerNav: true;
|
|
543
|
+
footerNav: true;
|
|
544
|
+
dragHandleMenu: true;
|
|
545
|
+
linkBubbleMenu: true;
|
|
546
|
+
tableToolbar: true;
|
|
547
|
+
imageToolbar: true;
|
|
548
|
+
};
|
|
549
|
+
};
|
|
550
|
+
/** 完整配置(含 AI) */
|
|
551
|
+
readonly full: {
|
|
552
|
+
features: {
|
|
553
|
+
heading: true;
|
|
554
|
+
textFormat: true;
|
|
555
|
+
list: true;
|
|
556
|
+
align: true;
|
|
557
|
+
color: true;
|
|
558
|
+
image: true;
|
|
559
|
+
font: true;
|
|
560
|
+
link: true;
|
|
561
|
+
table: true;
|
|
562
|
+
codeBlock: true;
|
|
563
|
+
undoRedo: true;
|
|
564
|
+
formatPainter: true;
|
|
565
|
+
zoom: true;
|
|
566
|
+
subscriptSuperscript: true;
|
|
567
|
+
clearFormat: true;
|
|
568
|
+
headerNav: true;
|
|
569
|
+
footerNav: true;
|
|
570
|
+
dragHandleMenu: true;
|
|
571
|
+
floatingMenu: true;
|
|
572
|
+
linkBubbleMenu: true;
|
|
573
|
+
tableToolbar: true;
|
|
574
|
+
imageToolbar: true;
|
|
575
|
+
ai: true;
|
|
576
|
+
};
|
|
577
|
+
};
|
|
578
|
+
/** Notion 风格配置 - 极简工具栏 + 浮动格式化 */
|
|
579
|
+
readonly notion: {
|
|
580
|
+
themePreset: ThemePreset;
|
|
581
|
+
features: {
|
|
582
|
+
undoRedo: true;
|
|
583
|
+
floatingMenu: true;
|
|
584
|
+
linkBubbleMenu: true;
|
|
585
|
+
dragHandleMenu: true;
|
|
586
|
+
heading: false;
|
|
587
|
+
textFormat: false;
|
|
588
|
+
list: false;
|
|
589
|
+
align: false;
|
|
590
|
+
color: false;
|
|
591
|
+
image: false;
|
|
592
|
+
font: false;
|
|
593
|
+
link: false;
|
|
594
|
+
table: false;
|
|
595
|
+
codeBlock: false;
|
|
596
|
+
formatPainter: false;
|
|
597
|
+
zoom: false;
|
|
598
|
+
headerNav: false;
|
|
599
|
+
footerNav: false;
|
|
600
|
+
};
|
|
601
|
+
};
|
|
602
|
+
};
|
|
603
|
+
|
|
604
|
+
export declare type PresetName = keyof typeof PRESET_CONFIGS;
|
|
605
|
+
|
|
606
|
+
declare interface Props {
|
|
607
|
+
editor: Editor_2;
|
|
608
|
+
icon?: Component;
|
|
609
|
+
label?: string;
|
|
610
|
+
title?: string;
|
|
611
|
+
active?: boolean;
|
|
612
|
+
placement?: 'top' | 'bottom' | 'bottomLeft' | 'bottomRight' | 'topLeft' | 'topRight';
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
declare interface Props_2 {
|
|
616
|
+
editor: Editor | null;
|
|
617
|
+
adapter: AiAdapter;
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
declare interface Props_3 {
|
|
621
|
+
open?: boolean;
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
/**
|
|
625
|
+
* Register custom theme
|
|
626
|
+
*/
|
|
627
|
+
export declare function registerTheme(name: string, variables: Record<string, string>): void;
|
|
628
|
+
|
|
629
|
+
/**
|
|
630
|
+
* Set device view
|
|
631
|
+
*/
|
|
632
|
+
export declare function setDeviceView(device: DeviceView): void;
|
|
633
|
+
|
|
634
|
+
/**
|
|
635
|
+
* Set orientation
|
|
636
|
+
*/
|
|
637
|
+
export declare function setOrientation(orientation: Orientation): void;
|
|
638
|
+
|
|
639
|
+
/**
|
|
640
|
+
* Set theme
|
|
641
|
+
*/
|
|
642
|
+
export declare function setTheme(preset: ThemePreset, mode?: ThemeMode): void;
|
|
643
|
+
|
|
644
|
+
/**
|
|
645
|
+
* Set user info (call this on app init)
|
|
646
|
+
*/
|
|
647
|
+
export declare function setUserInfo(info: UserInfo): void;
|
|
648
|
+
|
|
649
|
+
export declare const SummarizeExtension: Extension<SummarizeOptions, any>;
|
|
650
|
+
|
|
651
|
+
export declare interface SummarizeOptions {
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
/**
|
|
655
|
+
* Translate a key with optional interpolation
|
|
656
|
+
*/
|
|
657
|
+
export declare function t(key: string, params?: Record<string, string | number>): string;
|
|
658
|
+
|
|
659
|
+
/**
|
|
660
|
+
* Preferences Adapter
|
|
661
|
+
* Replaces @vben/preferences
|
|
662
|
+
*/
|
|
663
|
+
declare type Theme = 'light' | 'dark';
|
|
664
|
+
|
|
665
|
+
/** Export all presets for import */
|
|
666
|
+
export declare const THEME_PRESETS: readonly ["default", "notion", "github", "typora", "word"];
|
|
667
|
+
|
|
668
|
+
/**
|
|
669
|
+
* Editor Configuration Types
|
|
670
|
+
* Pluggable feature system
|
|
671
|
+
*/
|
|
672
|
+
/** Theme mode */
|
|
673
|
+
export declare type ThemeMode = 'light' | 'dark' | 'auto';
|
|
674
|
+
|
|
675
|
+
/** Theme preset */
|
|
676
|
+
export declare type ThemePreset = 'default' | 'notion' | 'typora' | 'word' | 'github' | 'custom';
|
|
677
|
+
|
|
678
|
+
export declare interface TiptapLocale {
|
|
679
|
+
toolbar: {
|
|
680
|
+
bold: string;
|
|
681
|
+
italic: string;
|
|
682
|
+
underline: string;
|
|
683
|
+
strikethrough: string;
|
|
684
|
+
code: string;
|
|
685
|
+
subscript: string;
|
|
686
|
+
superscript: string;
|
|
687
|
+
clear: string;
|
|
688
|
+
clearFormat: string;
|
|
689
|
+
formatPainter: string;
|
|
690
|
+
heading: string;
|
|
691
|
+
heading1: string;
|
|
692
|
+
heading2: string;
|
|
693
|
+
heading3: string;
|
|
694
|
+
heading4: string;
|
|
695
|
+
heading5: string;
|
|
696
|
+
heading6: string;
|
|
697
|
+
paragraph: string;
|
|
698
|
+
fontFamily: string;
|
|
699
|
+
fontSize: string;
|
|
700
|
+
lineHeight: string;
|
|
701
|
+
textColor: string;
|
|
702
|
+
backgroundColor: string;
|
|
703
|
+
highlightColor: string;
|
|
704
|
+
bulletList: string;
|
|
705
|
+
orderedList: string;
|
|
706
|
+
taskList: string;
|
|
707
|
+
indent: string;
|
|
708
|
+
outdent: string;
|
|
709
|
+
alignLeft: string;
|
|
710
|
+
alignCenter: string;
|
|
711
|
+
alignRight: string;
|
|
712
|
+
alignJustify: string;
|
|
713
|
+
insertLink: string;
|
|
714
|
+
insertImage: string;
|
|
715
|
+
insertTable: string;
|
|
716
|
+
insertCodeBlock: string;
|
|
717
|
+
insertHorizontalRule: string;
|
|
718
|
+
link: string;
|
|
719
|
+
linkUrl: string;
|
|
720
|
+
linkText: string;
|
|
721
|
+
openLink: string;
|
|
722
|
+
editLink: string;
|
|
723
|
+
removeLink: string;
|
|
724
|
+
undo: string;
|
|
725
|
+
redo: string;
|
|
726
|
+
undoDisabledInCollab: string;
|
|
727
|
+
redoDisabledInCollab: string;
|
|
728
|
+
more: string;
|
|
729
|
+
};
|
|
730
|
+
table: {
|
|
731
|
+
insertTable: string;
|
|
732
|
+
deleteTable: string;
|
|
733
|
+
addColumnBefore: string;
|
|
734
|
+
addColumnAfter: string;
|
|
735
|
+
deleteColumn: string;
|
|
736
|
+
addRowBefore: string;
|
|
737
|
+
addRowAfter: string;
|
|
738
|
+
deleteRow: string;
|
|
739
|
+
mergeCells: string;
|
|
740
|
+
splitCell: string;
|
|
741
|
+
toggleHeaderCell: string;
|
|
742
|
+
toggleHeaderColumn: string;
|
|
743
|
+
toggleHeaderRow: string;
|
|
744
|
+
setCellAttribute: string;
|
|
745
|
+
fixTables: string;
|
|
746
|
+
};
|
|
747
|
+
bubbleMenu: {
|
|
748
|
+
turnInto: string;
|
|
749
|
+
textStyle: string;
|
|
750
|
+
color: string;
|
|
751
|
+
};
|
|
752
|
+
dragMenu: {
|
|
753
|
+
delete: string;
|
|
754
|
+
duplicate: string;
|
|
755
|
+
copy: string;
|
|
756
|
+
cut: string;
|
|
757
|
+
moveUp: string;
|
|
758
|
+
moveDown: string;
|
|
759
|
+
};
|
|
760
|
+
codeBlock: {
|
|
761
|
+
language: string;
|
|
762
|
+
selectLanguage: string;
|
|
763
|
+
};
|
|
764
|
+
stats: {
|
|
765
|
+
characters: string;
|
|
766
|
+
words: string;
|
|
767
|
+
pages: string;
|
|
768
|
+
zoom: string;
|
|
769
|
+
reset: string;
|
|
770
|
+
total: string;
|
|
771
|
+
};
|
|
772
|
+
placeholder: {
|
|
773
|
+
default: string;
|
|
774
|
+
heading: string;
|
|
775
|
+
paragraph: string;
|
|
776
|
+
};
|
|
777
|
+
messages: {
|
|
778
|
+
imageUploadFailed: string;
|
|
779
|
+
imageUploadSuccess: string;
|
|
780
|
+
invalidImageFormat: string;
|
|
781
|
+
imageTooLarge: string;
|
|
782
|
+
networkError: string;
|
|
783
|
+
pasteCleanedUp: string;
|
|
784
|
+
linkRequired: string;
|
|
785
|
+
linkInvalid: string;
|
|
786
|
+
translationFailed: string;
|
|
787
|
+
polishFailed: string;
|
|
788
|
+
summarizeFailed: string;
|
|
789
|
+
continueWritingFailed: string;
|
|
790
|
+
customAiFailed: string;
|
|
791
|
+
};
|
|
792
|
+
editor: {
|
|
793
|
+
h1: string;
|
|
794
|
+
h2: string;
|
|
795
|
+
h3: string;
|
|
796
|
+
h4: string;
|
|
797
|
+
h5: string;
|
|
798
|
+
h6: string;
|
|
799
|
+
paragraph: string;
|
|
800
|
+
heading: string;
|
|
801
|
+
heading1: string;
|
|
802
|
+
heading2: string;
|
|
803
|
+
heading3: string;
|
|
804
|
+
heading4: string;
|
|
805
|
+
heading5: string;
|
|
806
|
+
heading6: string;
|
|
807
|
+
bold: string;
|
|
808
|
+
italic: string;
|
|
809
|
+
underline: string;
|
|
810
|
+
strike: string;
|
|
811
|
+
inlineCode: string;
|
|
812
|
+
superscript: string;
|
|
813
|
+
subscript: string;
|
|
814
|
+
bulletList: string;
|
|
815
|
+
orderedList: string;
|
|
816
|
+
taskList: string;
|
|
817
|
+
align: string;
|
|
818
|
+
alignLeft: string;
|
|
819
|
+
alignCenter: string;
|
|
820
|
+
alignRight: string;
|
|
821
|
+
alignJustify: string;
|
|
822
|
+
indent: string;
|
|
823
|
+
outdent: string;
|
|
824
|
+
indentAndAlign: string;
|
|
825
|
+
colors: string;
|
|
826
|
+
text: string;
|
|
827
|
+
highlight: string;
|
|
828
|
+
textColor: string;
|
|
829
|
+
backgroundColor: string;
|
|
830
|
+
defaultColors: string;
|
|
831
|
+
standardColors: string;
|
|
832
|
+
showAdvanced: string;
|
|
833
|
+
hideAdvanced: string;
|
|
834
|
+
clearColor: string;
|
|
835
|
+
actions: string;
|
|
836
|
+
cut: string;
|
|
837
|
+
copy: string;
|
|
838
|
+
delete: string;
|
|
839
|
+
undo: string;
|
|
840
|
+
redo: string;
|
|
841
|
+
undoDisabledInCollab: string;
|
|
842
|
+
redoDisabledInCollab: string;
|
|
843
|
+
clearFormat: string;
|
|
844
|
+
formatPainter: string;
|
|
845
|
+
font: string;
|
|
846
|
+
fontSize: string;
|
|
847
|
+
lineHeight: string;
|
|
848
|
+
insertLink: string;
|
|
849
|
+
insertImage: string;
|
|
850
|
+
insertTable: string;
|
|
851
|
+
image: string;
|
|
852
|
+
link: string;
|
|
853
|
+
editLink: string;
|
|
854
|
+
openLink: string;
|
|
855
|
+
removeLink: string;
|
|
856
|
+
linkPlaceholder: string;
|
|
857
|
+
imagePlaceholder: string;
|
|
858
|
+
deleteTable: string;
|
|
859
|
+
includeHeader: string;
|
|
860
|
+
localUpload: string;
|
|
861
|
+
localUploadImage: string;
|
|
862
|
+
webUpload: string;
|
|
863
|
+
clickOrDragUpload: string;
|
|
864
|
+
onlySupportImage: string;
|
|
865
|
+
video: string;
|
|
866
|
+
localUploadVideo: string;
|
|
867
|
+
uploadVideo: string;
|
|
868
|
+
onlySupportVideo: string;
|
|
869
|
+
supportImageAndVideo: string;
|
|
870
|
+
word: string;
|
|
871
|
+
importWord: string;
|
|
872
|
+
exportWord: string;
|
|
873
|
+
clickOrDragUploadWord: string;
|
|
874
|
+
onlySupportDocx: string;
|
|
875
|
+
importing: string;
|
|
876
|
+
exporting: string;
|
|
877
|
+
exportFilenamePlaceholder: string;
|
|
878
|
+
importSuccess: string;
|
|
879
|
+
exportSuccess: string;
|
|
880
|
+
importFailed: string;
|
|
881
|
+
exportFailed: string;
|
|
882
|
+
more: string;
|
|
883
|
+
aiTool: string;
|
|
884
|
+
ai: string;
|
|
885
|
+
pleaseSelectTextToSample: string;
|
|
886
|
+
pleaseSelectTextToSampleShort: string;
|
|
887
|
+
pleaseSelectTextToSampleDouble: string;
|
|
888
|
+
sampleSuccessSingle: string;
|
|
889
|
+
sampleSuccessContinuous: string;
|
|
890
|
+
formatPainterExited: string;
|
|
891
|
+
collaborationNoFormatPainter: string;
|
|
892
|
+
enterValidLink: string;
|
|
893
|
+
math: string;
|
|
894
|
+
mathInline: string;
|
|
895
|
+
mathBlock: string;
|
|
896
|
+
mathPlaceholder: string;
|
|
897
|
+
mathEmpty: string;
|
|
898
|
+
insertTemplate: string;
|
|
899
|
+
templateMeetingMinutes: string;
|
|
900
|
+
templateMeetingMinutesDesc: string;
|
|
901
|
+
templateWeeklyReport: string;
|
|
902
|
+
templateWeeklyReportDesc: string;
|
|
903
|
+
templateDailyReport: string;
|
|
904
|
+
templateDailyReportDesc: string;
|
|
905
|
+
templateProjectPlan: string;
|
|
906
|
+
templateProjectPlanDesc: string;
|
|
907
|
+
templateProductRequirement: string;
|
|
908
|
+
templateProductRequirementDesc: string;
|
|
909
|
+
imageGallery: string;
|
|
910
|
+
galleryEmpty: string;
|
|
911
|
+
galleryEmptyHint: string;
|
|
912
|
+
galleryCount: string;
|
|
913
|
+
galleryInsert: string;
|
|
914
|
+
continueWriting: string;
|
|
915
|
+
polish: string;
|
|
916
|
+
summarize: string;
|
|
917
|
+
translate: string;
|
|
918
|
+
translateTo: string;
|
|
919
|
+
customAi: string;
|
|
920
|
+
selectLanguage: string;
|
|
921
|
+
aiSuggestion: string;
|
|
922
|
+
aiContinueWriting: string;
|
|
923
|
+
originalText: string;
|
|
924
|
+
suggestedText: string;
|
|
925
|
+
generatedContent: string;
|
|
926
|
+
generating: string;
|
|
927
|
+
selectedContent: string;
|
|
928
|
+
currentStatus: string;
|
|
929
|
+
noTextSelected: string;
|
|
930
|
+
pleaseSelectText: string;
|
|
931
|
+
continueWritingRequiresSelection: string;
|
|
932
|
+
polishRequiresSelection: string;
|
|
933
|
+
summarizeRequiresSelection: string;
|
|
934
|
+
translateRequiresSelection: string;
|
|
935
|
+
customAiRequiresSelection: string;
|
|
936
|
+
aiPrompt: string;
|
|
937
|
+
aiPromptPlaceholder: string;
|
|
938
|
+
customAiCommand: string;
|
|
939
|
+
customAiPromptPlaceholder: string;
|
|
940
|
+
execute: string;
|
|
941
|
+
cancel: string;
|
|
942
|
+
reject: string;
|
|
943
|
+
accept: string;
|
|
944
|
+
lang: {
|
|
945
|
+
'zh-CN': string;
|
|
946
|
+
'zh-TW': string;
|
|
947
|
+
zh: string;
|
|
948
|
+
en: string;
|
|
949
|
+
ja: string;
|
|
950
|
+
th: string;
|
|
951
|
+
fr: string;
|
|
952
|
+
es: string;
|
|
953
|
+
pt: string;
|
|
954
|
+
ko: string;
|
|
955
|
+
vi: string;
|
|
956
|
+
ru: string;
|
|
957
|
+
de: string;
|
|
958
|
+
hi: string;
|
|
959
|
+
id: string;
|
|
960
|
+
ar: string;
|
|
961
|
+
};
|
|
962
|
+
};
|
|
963
|
+
versionHistory: {
|
|
964
|
+
title: string;
|
|
965
|
+
saveVersion: string;
|
|
966
|
+
noVersions: string;
|
|
967
|
+
autoSave: string;
|
|
968
|
+
words: string;
|
|
969
|
+
justNow: string;
|
|
970
|
+
minutesAgo: string;
|
|
971
|
+
hoursAgo: string;
|
|
972
|
+
daysAgo: string;
|
|
973
|
+
restore: string;
|
|
974
|
+
compare: string;
|
|
975
|
+
rename: string;
|
|
976
|
+
delete: string;
|
|
977
|
+
comparing: string;
|
|
978
|
+
clearCompare: string;
|
|
979
|
+
versionName: string;
|
|
980
|
+
saved: string;
|
|
981
|
+
restored: string;
|
|
982
|
+
deleted: string;
|
|
983
|
+
noDiff: string;
|
|
984
|
+
};
|
|
985
|
+
slashCommand: {
|
|
986
|
+
noResults: string;
|
|
987
|
+
basicBlocks: string;
|
|
988
|
+
lists: string;
|
|
989
|
+
advanced: string;
|
|
990
|
+
paragraph: string;
|
|
991
|
+
paragraphDesc: string;
|
|
992
|
+
heading1: string;
|
|
993
|
+
heading1Desc: string;
|
|
994
|
+
heading2: string;
|
|
995
|
+
heading2Desc: string;
|
|
996
|
+
heading3: string;
|
|
997
|
+
heading3Desc: string;
|
|
998
|
+
bulletList: string;
|
|
999
|
+
bulletListDesc: string;
|
|
1000
|
+
orderedList: string;
|
|
1001
|
+
orderedListDesc: string;
|
|
1002
|
+
taskList: string;
|
|
1003
|
+
taskListDesc: string;
|
|
1004
|
+
blockquote: string;
|
|
1005
|
+
blockquoteDesc: string;
|
|
1006
|
+
codeBlock: string;
|
|
1007
|
+
codeBlockDesc: string;
|
|
1008
|
+
table: string;
|
|
1009
|
+
tableDesc: string;
|
|
1010
|
+
image: string;
|
|
1011
|
+
imageDesc: string;
|
|
1012
|
+
imageUrlPrompt: string;
|
|
1013
|
+
horizontalRule: string;
|
|
1014
|
+
horizontalRuleDesc: string;
|
|
1015
|
+
};
|
|
1016
|
+
aiSettings: {
|
|
1017
|
+
title: string;
|
|
1018
|
+
provider: string;
|
|
1019
|
+
apiKeyPlaceholder: string;
|
|
1020
|
+
apiKeyHint: string;
|
|
1021
|
+
endpoint: string;
|
|
1022
|
+
model: string;
|
|
1023
|
+
enableAi: string;
|
|
1024
|
+
testConnection: string;
|
|
1025
|
+
testing: string;
|
|
1026
|
+
testSuccess: string;
|
|
1027
|
+
testFailed: string;
|
|
1028
|
+
viewDocs: string;
|
|
1029
|
+
save: string;
|
|
1030
|
+
cancel: string;
|
|
1031
|
+
clear: string;
|
|
1032
|
+
};
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
export declare const TiptapProEditor: DefineComponent<TiptapProEditorProps, {
|
|
1036
|
+
getEditor: () => Editor | null;
|
|
1037
|
+
getJSON: () => DocumentType_2<Record<string, any> | undefined, NodeType<string, Record<string, any> | undefined, any, (NodeType<any, any, any, any> | TextType<MarkType<any, any>>)[]>[]> | null;
|
|
1038
|
+
getHTML: () => string;
|
|
1039
|
+
getText: () => string;
|
|
1040
|
+
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
1041
|
+
update: (content: any) => any;
|
|
1042
|
+
collaboratorsChange: (count: number) => any;
|
|
1043
|
+
collaboratorsListChange: (users: {
|
|
1044
|
+
id: string | number;
|
|
1045
|
+
name: string;
|
|
1046
|
+
color: string;
|
|
1047
|
+
}[]) => any;
|
|
1048
|
+
}, string, PublicProps, Readonly<TiptapProEditorProps> & Readonly<{
|
|
1049
|
+
onUpdate?: ((content: any) => any) | undefined;
|
|
1050
|
+
onCollaboratorsChange?: ((count: number) => any) | undefined;
|
|
1051
|
+
onCollaboratorsListChange?: ((users: {
|
|
1052
|
+
id: string | number;
|
|
1053
|
+
name: string;
|
|
1054
|
+
color: string;
|
|
1055
|
+
}[]) => any) | undefined;
|
|
1056
|
+
}>, {
|
|
1057
|
+
readonly: boolean;
|
|
1058
|
+
version: EditorVersion;
|
|
1059
|
+
initialContent: string | object;
|
|
1060
|
+
zoomBarPlacement: "bottom" | "belowToolbar";
|
|
1061
|
+
previewMode: boolean;
|
|
1062
|
+
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
1063
|
+
|
|
1064
|
+
/**
|
|
1065
|
+
* 编辑器暴露的方法
|
|
1066
|
+
*/
|
|
1067
|
+
export declare interface TiptapProEditorExpose {
|
|
1068
|
+
getEditor: () => Editor | null;
|
|
1069
|
+
getJSON: () => JSONContent | null;
|
|
1070
|
+
getHTML: () => string;
|
|
1071
|
+
getText: () => string;
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
/**
|
|
1075
|
+
* 编辑器 Props
|
|
1076
|
+
*/
|
|
1077
|
+
export declare interface TiptapProEditorProps {
|
|
1078
|
+
/** 版本配置 */
|
|
1079
|
+
version?: EditorVersion;
|
|
1080
|
+
/** 版本配置对象(与 version 二选一) */
|
|
1081
|
+
versionConfig?: VersionConfig;
|
|
1082
|
+
/** 缩放条位置:底部固定或工具栏下方 */
|
|
1083
|
+
zoomBarPlacement?: 'bottom' | 'belowToolbar';
|
|
1084
|
+
/** 是否为只读模式 */
|
|
1085
|
+
readonly?: boolean;
|
|
1086
|
+
/** 是否为预览模式(无头部/底部导航,不可编辑,不可点击) */
|
|
1087
|
+
previewMode?: boolean;
|
|
1088
|
+
/** 文档ID(用于加载和保存以及协同房间) */
|
|
1089
|
+
documentId?: string;
|
|
1090
|
+
/** 初始内容 - 可以是 HTML 字符串或 JSON 对象(ProseMirror 格式) */
|
|
1091
|
+
initialContent?: string | object;
|
|
1092
|
+
/** 表格悬浮框显示模式:1=聚焦显示;2=单元格选中显示 */
|
|
1093
|
+
tableMenuShowMode?: 1 | 2;
|
|
1094
|
+
/** 功能配置(兼容旧版) */
|
|
1095
|
+
features?: FeatureConfig;
|
|
1096
|
+
/** 语言设置 */
|
|
1097
|
+
locale?: string;
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1100
|
+
/**
|
|
1101
|
+
* Toggle between light and dark mode
|
|
1102
|
+
*/
|
|
1103
|
+
export declare function toggleThemeMode(): ThemeMode;
|
|
1104
|
+
|
|
1105
|
+
export declare const TranslationExtension: Extension<TranslationOptions, any>;
|
|
1106
|
+
|
|
1107
|
+
export declare interface TranslationOptions {
|
|
1108
|
+
defaultTargetLang?: string;
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
export declare function useAi(options: UseAiOptions): UseAiReturn;
|
|
1112
|
+
|
|
1113
|
+
/**
|
|
1114
|
+
* useAiConfig Composable
|
|
1115
|
+
*/
|
|
1116
|
+
export declare function useAiConfig(): {
|
|
1117
|
+
config: Readonly<Ref< {
|
|
1118
|
+
readonly provider: AiProvider;
|
|
1119
|
+
readonly apiKey: string;
|
|
1120
|
+
readonly endpoint?: string | undefined;
|
|
1121
|
+
readonly model: string;
|
|
1122
|
+
readonly timeout: number;
|
|
1123
|
+
readonly enabled: boolean;
|
|
1124
|
+
readonly updatedAt: number;
|
|
1125
|
+
} | null, {
|
|
1126
|
+
readonly provider: AiProvider;
|
|
1127
|
+
readonly apiKey: string;
|
|
1128
|
+
readonly endpoint?: string | undefined;
|
|
1129
|
+
readonly model: string;
|
|
1130
|
+
readonly timeout: number;
|
|
1131
|
+
readonly enabled: boolean;
|
|
1132
|
+
readonly updatedAt: number;
|
|
1133
|
+
} | null>>;
|
|
1134
|
+
isConfigured: Readonly<Ref<boolean, boolean>>;
|
|
1135
|
+
isEnabled: Readonly<Ref<boolean, boolean>>;
|
|
1136
|
+
currentProvider: Readonly<Ref<AiProvider, AiProvider>>;
|
|
1137
|
+
currentProviderInfo: Readonly<Ref< {
|
|
1138
|
+
readonly id: AiProvider;
|
|
1139
|
+
readonly name: string;
|
|
1140
|
+
readonly description: string;
|
|
1141
|
+
readonly defaultEndpoint: string;
|
|
1142
|
+
readonly defaultModel: string;
|
|
1143
|
+
readonly requiresApiKey: boolean;
|
|
1144
|
+
readonly docsUrl?: string | undefined;
|
|
1145
|
+
} | undefined, {
|
|
1146
|
+
readonly id: AiProvider;
|
|
1147
|
+
readonly name: string;
|
|
1148
|
+
readonly description: string;
|
|
1149
|
+
readonly defaultEndpoint: string;
|
|
1150
|
+
readonly defaultModel: string;
|
|
1151
|
+
readonly requiresApiKey: boolean;
|
|
1152
|
+
readonly docsUrl?: string | undefined;
|
|
1153
|
+
} | undefined>>;
|
|
1154
|
+
testStatus: Readonly<Ref<"error" | "idle" | "testing" | "success", "error" | "idle" | "testing" | "success">>;
|
|
1155
|
+
testError: Readonly<Ref<string | null, string | null>>;
|
|
1156
|
+
providers: AiProviderInfo[];
|
|
1157
|
+
saveConfig: (newConfig: AiUserConfig) => void;
|
|
1158
|
+
updateConfig: (partial: Partial<AiUserConfig>) => void;
|
|
1159
|
+
setProvider: (provider: AiProvider) => void;
|
|
1160
|
+
testConnection: () => Promise<ConnectionTestResult>;
|
|
1161
|
+
clearConfig: () => void;
|
|
1162
|
+
getRequestConfig: () => {
|
|
1163
|
+
endpoint: string;
|
|
1164
|
+
apiKey: string;
|
|
1165
|
+
model: string;
|
|
1166
|
+
timeout: number;
|
|
1167
|
+
} | null;
|
|
1168
|
+
};
|
|
1169
|
+
|
|
1170
|
+
export declare interface UseAiOptions {
|
|
1171
|
+
adapter: AiAdapter;
|
|
1172
|
+
onError?: (error: Error) => void;
|
|
1173
|
+
}
|
|
1174
|
+
|
|
1175
|
+
export declare interface UseAiReturn {
|
|
1176
|
+
isLoading: Readonly<ReturnType<typeof readonly<ReturnType<typeof ref<boolean>>>>>;
|
|
1177
|
+
result: Readonly<ReturnType<typeof readonly<ReturnType<typeof ref<string>>>>>;
|
|
1178
|
+
error: Readonly<ReturnType<typeof readonly<ReturnType<typeof ref<Error | null>>>>>;
|
|
1179
|
+
continueWriting: (text: string) => Promise<string>;
|
|
1180
|
+
polish: (text: string) => Promise<string>;
|
|
1181
|
+
summarize: (text: string) => Promise<string>;
|
|
1182
|
+
translate: (text: string, targetLang: string) => Promise<string>;
|
|
1183
|
+
customAi: (text: string, instruction: string) => Promise<string>;
|
|
1184
|
+
continueWritingStream: (text: string, callbacks: AiStreamCallbacks) => Promise<void>;
|
|
1185
|
+
polishStream: (text: string, callbacks: AiStreamCallbacks) => Promise<void>;
|
|
1186
|
+
summarizeStream: (text: string, callbacks: AiStreamCallbacks) => Promise<void>;
|
|
1187
|
+
translateStream: (text: string, targetLang: string, callbacks: AiStreamCallbacks) => Promise<void>;
|
|
1188
|
+
customAiStream: (text: string, instruction: string, callbacks: AiStreamCallbacks) => Promise<void>;
|
|
1189
|
+
abort: () => void;
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
/**
|
|
1193
|
+
* Use i18n composable
|
|
1194
|
+
*/
|
|
1195
|
+
export declare function useI18n(): {
|
|
1196
|
+
t: typeof t;
|
|
1197
|
+
locale: ComputedRef<LocaleCode>;
|
|
1198
|
+
setLocale: (locale: LocaleCode) => void;
|
|
1199
|
+
availableLocales: LocaleCode[];
|
|
1200
|
+
};
|
|
1201
|
+
|
|
1202
|
+
/**
|
|
1203
|
+
* Use preferences (compatible with @vben/preferences)
|
|
1204
|
+
*/
|
|
1205
|
+
export declare function usePreferences(): {
|
|
1206
|
+
theme: Readonly<Ref<Theme, Theme>>;
|
|
1207
|
+
isDark: Readonly<Ref<boolean, boolean>>;
|
|
1208
|
+
setTheme: (t: Theme) => void;
|
|
1209
|
+
toggleTheme: () => void;
|
|
1210
|
+
};
|
|
1211
|
+
|
|
1212
|
+
/**
|
|
1213
|
+
* User Adapter
|
|
1214
|
+
* Replaces @vben/stores useUserStore
|
|
1215
|
+
*/
|
|
1216
|
+
export declare interface UserInfo {
|
|
1217
|
+
userId: string | number;
|
|
1218
|
+
realName: string;
|
|
1219
|
+
userName: string;
|
|
1220
|
+
avatar?: string;
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1223
|
+
/**
|
|
1224
|
+
* Get user store (compatible with @vben/stores)
|
|
1225
|
+
*/
|
|
1226
|
+
export declare function useUserStore(): {
|
|
1227
|
+
userInfo: {
|
|
1228
|
+
readonly userId: string | number;
|
|
1229
|
+
readonly realName: string;
|
|
1230
|
+
readonly userName: string;
|
|
1231
|
+
readonly avatar?: string | undefined;
|
|
1232
|
+
} | null;
|
|
1233
|
+
setUserInfo: typeof setUserInfo;
|
|
1234
|
+
getUserInfo: () => {
|
|
1235
|
+
userId: string | number;
|
|
1236
|
+
realName: string;
|
|
1237
|
+
userName: string;
|
|
1238
|
+
avatar?: string | undefined;
|
|
1239
|
+
} | null;
|
|
1240
|
+
};
|
|
1241
|
+
|
|
1242
|
+
/**
|
|
1243
|
+
* 版本配置接口
|
|
1244
|
+
*/
|
|
1245
|
+
export declare interface VersionConfig {
|
|
1246
|
+
/** 版本类型(基础版/进阶版/高级版) */
|
|
1247
|
+
version?: EditorVersion;
|
|
1248
|
+
/** 功能开关配置 */
|
|
1249
|
+
features?: {
|
|
1250
|
+
/** 基础版功能 */
|
|
1251
|
+
basic?: boolean;
|
|
1252
|
+
/** 进阶版功能 */
|
|
1253
|
+
advanced?: boolean;
|
|
1254
|
+
/** AI功能 */
|
|
1255
|
+
ai?: boolean;
|
|
1256
|
+
/** 协作编辑 */
|
|
1257
|
+
collaboration?: boolean;
|
|
1258
|
+
/** 头部导航 */
|
|
1259
|
+
headerNav?: boolean;
|
|
1260
|
+
/** 底部导航 */
|
|
1261
|
+
footerNav?: boolean;
|
|
1262
|
+
/** 预览模式 */
|
|
1263
|
+
previewMode?: boolean;
|
|
1264
|
+
};
|
|
1265
|
+
}
|
|
1266
|
+
|
|
1267
|
+
/**
|
|
1268
|
+
* Watch system theme changes
|
|
1269
|
+
*/
|
|
1270
|
+
export declare function watchSystemTheme(callback: (mode: 'light' | 'dark') => void): () => void;
|
|
1271
|
+
|
|
1272
|
+
export declare const zhCN: TiptapLocale;
|
|
1273
|
+
|
|
1274
|
+
export declare const zhTW: TiptapLocale;
|
|
1275
|
+
|
|
1276
|
+
export { }
|
|
1277
|
+
|
|
1278
|
+
|
|
1279
|
+
declare module '@tiptap/core' {
|
|
1280
|
+
interface Commands<ReturnType> {
|
|
1281
|
+
polish: {
|
|
1282
|
+
/**
|
|
1283
|
+
* Trigger AI polish (refine) text
|
|
1284
|
+
*/
|
|
1285
|
+
polish: () => ReturnType;
|
|
1286
|
+
};
|
|
1287
|
+
}
|
|
1288
|
+
}
|
|
1289
|
+
|
|
1290
|
+
|
|
1291
|
+
declare module '@tiptap/core' {
|
|
1292
|
+
interface Commands<ReturnType> {
|
|
1293
|
+
customAi: {
|
|
1294
|
+
/**
|
|
1295
|
+
* Trigger custom AI command
|
|
1296
|
+
*/
|
|
1297
|
+
customAi: () => ReturnType;
|
|
1298
|
+
};
|
|
1299
|
+
}
|
|
1300
|
+
}
|
|
1301
|
+
|
|
1302
|
+
|
|
1303
|
+
declare module '@tiptap/core' {
|
|
1304
|
+
interface Commands<ReturnType> {
|
|
1305
|
+
summarize: {
|
|
1306
|
+
summarize: () => ReturnType;
|
|
1307
|
+
};
|
|
1308
|
+
}
|
|
1309
|
+
}
|
|
1310
|
+
|
|
1311
|
+
|
|
1312
|
+
declare module '@tiptap/core' {
|
|
1313
|
+
interface Commands<ReturnType> {
|
|
1314
|
+
translation: {
|
|
1315
|
+
translate: (targetLang?: string) => ReturnType;
|
|
1316
|
+
};
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1319
|
+
|
|
1320
|
+
|
|
1321
|
+
declare module '@tiptap/core' {
|
|
1322
|
+
interface Commands<ReturnType> {
|
|
1323
|
+
continueWriting: {
|
|
1324
|
+
/**
|
|
1325
|
+
* Trigger AI continue writing
|
|
1326
|
+
*/
|
|
1327
|
+
continueWriting: () => ReturnType;
|
|
1328
|
+
};
|
|
1329
|
+
}
|
|
1330
|
+
}
|
|
1331
|
+
|
|
1332
|
+
|
|
1333
|
+
declare module '@tiptap/core' {
|
|
1334
|
+
interface Commands<ReturnType> {
|
|
1335
|
+
aiHighlight: {
|
|
1336
|
+
/**
|
|
1337
|
+
* Set AI highlight mark with suggestion data
|
|
1338
|
+
*/
|
|
1339
|
+
setAiHighlight: (data?: AiSuggestionData) => ReturnType;
|
|
1340
|
+
/**
|
|
1341
|
+
* Unset AI highlight mark
|
|
1342
|
+
*/
|
|
1343
|
+
unsetAiHighlight: () => ReturnType;
|
|
1344
|
+
};
|
|
1345
|
+
}
|
|
1346
|
+
}
|
|
1347
|
+
|
|
1348
|
+
|
|
1349
|
+
declare module '@tiptap/core' {
|
|
1350
|
+
interface Commands<ReturnType> {
|
|
1351
|
+
video: {
|
|
1352
|
+
/**
|
|
1353
|
+
* 插入视频
|
|
1354
|
+
*/
|
|
1355
|
+
setVideo: (options: {
|
|
1356
|
+
src: string;
|
|
1357
|
+
width?: number;
|
|
1358
|
+
height?: number;
|
|
1359
|
+
}) => ReturnType;
|
|
1360
|
+
};
|
|
1361
|
+
}
|
|
1362
|
+
}
|
|
1363
|
+
|
|
1364
|
+
|
|
1365
|
+
declare module '@tiptap/core' {
|
|
1366
|
+
interface Commands<ReturnType> {
|
|
1367
|
+
math: {
|
|
1368
|
+
/** 插入行内公式 */
|
|
1369
|
+
insertInlineMath: (latex?: string) => ReturnType;
|
|
1370
|
+
/** 插入块级公式 */
|
|
1371
|
+
insertBlockMath: (latex?: string) => ReturnType;
|
|
1372
|
+
/** 更新公式内容 */
|
|
1373
|
+
updateMath: (latex: string) => ReturnType;
|
|
1374
|
+
};
|
|
1375
|
+
}
|
|
1376
|
+
}
|
|
1377
|
+
|
|
1378
|
+
|
|
1379
|
+
declare module '@tiptap/core' {
|
|
1380
|
+
interface Commands<ReturnType> {
|
|
1381
|
+
formatPainter: {
|
|
1382
|
+
/**
|
|
1383
|
+
* 开启格式刷并采样当前选区样式
|
|
1384
|
+
* @param mode - 模式:1 为单次模式(默认),2 为连续模式
|
|
1385
|
+
*/
|
|
1386
|
+
startFormatPainting: (mode?: 1 | 2) => ReturnType;
|
|
1387
|
+
/** 开启格式刷连续应用模式 */
|
|
1388
|
+
startContinuousFormatPainting: () => ReturnType;
|
|
1389
|
+
/** 将采样到的样式应用到当前选区 */
|
|
1390
|
+
applyFormat: () => ReturnType;
|
|
1391
|
+
/** 取消格式刷状态并清除缓存 */
|
|
1392
|
+
cancelFormatPainting: () => ReturnType;
|
|
1393
|
+
/** 切换连续应用模式 */
|
|
1394
|
+
toggleContinuousMode: () => ReturnType;
|
|
1395
|
+
};
|
|
1396
|
+
}
|
|
1397
|
+
}
|