@umoteam/editor 9.0.1 → 10.0.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/types/index.d.ts DELETED
@@ -1,274 +0,0 @@
1
- import type { Extension, HTMLContent, JSONContent } from '@tiptap/core'
2
- import type { FocusPosition } from '@tiptap/core'
3
- import { Fragment, Node as ProseMirrorNode } from '@tiptap/pm/model'
4
-
5
- export type SupportedLocale = 'en-US' | 'zh-CN'
6
- export type LayoutOption = 'web' | 'page'
7
- export interface MarginOption {
8
- left: number
9
- right: number
10
- top: number
11
- bottom: number
12
- }
13
- export interface WatermarkOption {
14
- type?: string
15
- alpha?: number
16
- fontColor?: string
17
- fontSize?: number
18
- fontFamily?: string
19
- fontWeight?: string
20
- text?: string
21
- }
22
- export interface PageOption {
23
- layouts: LayoutOption[]
24
- defaultMargin?: MarginOption
25
- defaultOrientation?: string
26
- defaultBackground?: string
27
- showBreakMarks?: boolean
28
- showBookmark?: boolean
29
- watermark?: WatermarkOption
30
- size?: {
31
- width: number
32
- height: number
33
- label?: LocaleLabel
34
- }
35
- margin?: {
36
- right: number
37
- left: number
38
- bottom: number
39
- top: number
40
- layout?: 'narrow' | 'moderate' | 'wide' | 'custom'
41
- }
42
- orientation?: string
43
- background?: string
44
- header?: boolean
45
- footer?: boolean
46
- showLineNumber?: boolean
47
- showToc?: boolean
48
- zoomLevel?: number
49
- bodyHeight?: number
50
- autoWidth?: boolean
51
- preview?: {
52
- enabled?: boolean
53
- laserPointer?: boolean
54
- }
55
- }
56
-
57
- export type ToolbarMenu =
58
- | 'base'
59
- | 'insert'
60
- | 'table'
61
- | 'tools'
62
- | 'page'
63
- | 'export'
64
- | 'advanced'
65
- | 'custom'
66
-
67
- export interface ToolbarOptions {
68
- showSaveLabel?: boolean
69
- defaultMode?: 'classic' | 'ribbon'
70
- menus?: ToolbarMenu[]
71
- }
72
-
73
- export interface ImportWordOptions {
74
- enabled?: boolean
75
- maxSize?: number
76
- options?: unknown
77
- useCustomMethod?: boolean
78
- onCustomImportMethod?: (file: File) => Promise<{
79
- id: string
80
- url: string
81
- value: string
82
- messages: { type: string; message: string }
83
- }>
84
- }
85
-
86
- export interface AutoSaveOptions {
87
- enabled?: boolean
88
- interval?: number
89
- }
90
-
91
- export interface DocumentOptions {
92
- id?: string
93
- title?: string
94
- content?: string
95
- placeholder?: Record<string, string>
96
- enableSpellcheck?: boolean
97
- enableMarkdown?: boolean
98
- enableBubbleMenu?: boolean
99
- enableBlockMenu?: boolean
100
- readOnly?: boolean
101
- autofocus?: 'start' | 'end' | 'all' | number | boolean | null
102
- characterLimit?: number
103
- typographyRules?: Record<string, unknown>
104
- editorProps?: Record<string, unknown>
105
- parseOptions?: Record<string, unknown>
106
- autoSave?: AutoSaveOptions
107
- }
108
-
109
- export type LocaleLabel = string | { en_US: string; zh_CN: string }
110
-
111
- export interface PageSize {
112
- label: LocaleLabel
113
- width: number
114
- height: number
115
- default?: boolean
116
- }
117
-
118
- export interface Font {
119
- label: LocaleLabel
120
- value: string | null
121
- }
122
-
123
- export interface LineHeight {
124
- label: LocaleLabel
125
- value: number
126
- default?: boolean
127
- }
128
-
129
- export interface GraphicSymbol {
130
- label: LocaleLabel
131
- items: string
132
- }
133
-
134
- export interface Emoji {
135
- label: LocaleLabel
136
- items: string
137
- }
138
-
139
- export interface Template {
140
- title: string
141
- content: string
142
- description?: string
143
- value?: string
144
- divider?: boolean
145
- }
146
-
147
- export interface AssistantOptions {
148
- enabled?: boolean
149
- maxlength?: number
150
- commands?: CommandItem[]
151
- onMessage?: (
152
- payload: AssistantPayload,
153
- content: AssistantContent,
154
- ) => Promise<ReadableStream | string>
155
- }
156
-
157
- export interface EchartsOptions {
158
- mode?: number
159
- renderImage?: boolean
160
- onCustomSettings?: CallableFunction
161
- }
162
-
163
- export interface UserItem {
164
- id: string
165
- label: string
166
- avatar?: string
167
- }
168
-
169
- export interface WebPageItem {
170
- label?: LocaleLabel
171
- icon?: string
172
- validate?(url: string): boolean
173
- transformURL?(url: string): string
174
- }
175
-
176
- export interface CommandItem {
177
- label?: LocaleLabel
178
- value?: LocaleLabel
179
- autoSend?: boolean
180
- }
181
-
182
- export interface AssistantPayload {
183
- lang?: string
184
- input?: string
185
- command?: string
186
- output?: string
187
- }
188
-
189
- export interface AssistantContent {
190
- html: HTMLContent
191
- json: JSONContent
192
- text: string
193
- }
194
- export interface AssistantResult {
195
- prompt?: string
196
- content?: string
197
- error?: boolean
198
- command?: string
199
- }
200
-
201
- export interface FileOptions {
202
- allowedMimeTypes?: string[]
203
- maxSize?: number
204
- preview?: {
205
- extensions?: string[]
206
- url?: string
207
- }[]
208
- }
209
-
210
- export type InsterContentType = string | Fragment | ProseMirrorNode
211
-
212
- export interface SetContentOptions {
213
- emitUpdate: boolean
214
- focusPosition: FocusPosition
215
- focusOptions: { scrollIntoView: boolean }
216
- }
217
- export type InsterContentOptions = Omit<SetContentOptions, 'emitUpdate'> & {
218
- updateSelection: boolean
219
- }
220
-
221
- export type SetContentType = InsterContentType | JSONContent | JSONContent[]
222
-
223
- type OnSaveFunction = (
224
- content: {
225
- html: HTMLContent
226
- json: JSONContent
227
- text: string
228
- },
229
- page: PageOption,
230
- document: DocumentOptions,
231
- ) => Promise<unknown>
232
-
233
- type DeleteFileType = 'image' | 'video' | 'audio' | 'file' | 'inlineImage'
234
-
235
- export interface UmoEditorOptions {
236
- editorKey?: string
237
- locale?: SupportedLocale
238
- theme?: 'light' | 'dark'
239
- height?: string
240
- fullscreenZIndex?: number
241
- dicts?: {
242
- pageSizes?: PageSize[]
243
- fonts?: Font[]
244
- colors?: string[]
245
- lineHeights?: LineHeight[]
246
- symbols?: GraphicSymbol[]
247
- emojis?: Emoji[]
248
- }
249
- toolbar?: ToolbarOptions
250
- page?: PageOption
251
- document?: DocumentOptions
252
- ai?: {
253
- assistant?: AssistantOptions
254
- }
255
- echarts?: EchartsOptions
256
- webPages?: WebPageItem[]
257
- templates?: Template[]
258
- cdnUrl?: string
259
- shareUrl?: string
260
- diagrams?: Record<string, unknown>
261
- importWord?: ImportWordOptions
262
- file?: FileOptions
263
- user?: Record<string, unknown>
264
- users?: UserItem[]
265
- extensions?: Extension[]
266
- disableExtensions?: string[]
267
- translations?: Record<string, unknown>
268
- onSave?: OnSaveFunction
269
- onFileUpload?: (file: File) => Promise<{ id: string; url: string }>
270
- onFileDelete?: (id: string, url: string, type?: DeleteFileType) => void
271
- }
272
-
273
- // 组件类型声明
274
- export * from './src/components'
@@ -1,9 +0,0 @@
1
- import { UmoEditorOptions } from '../../../types';
2
- import { default as UmoEditor } from './index.vue';
3
- import { default as UmoMenuButton } from './menus/button.vue';
4
- import { default as UmoDialog } from './modal.vue';
5
- import { default as UmoTooltip } from './tooltip.vue';
6
- declare const useUmoEditor: {
7
- install: (app: any, options?: Partial<UmoEditorOptions>) => void;
8
- };
9
- export { UmoEditor as default, UmoDialog, UmoEditor, UmoMenuButton, UmoTooltip, useUmoEditor, };