@umoteam/editor 6.1.0 → 7.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umoteam/editor",
3
- "version": "6.1.0",
3
+ "version": "7.0.0",
4
4
  "type": "module",
5
5
  "description": "Umo Editor is open-source document editor based on Vue3 and Tiptap. Umo Editor provides comprehensive document editing capabilities and AI creation features, supports pagination, supports Markdown syntax, offers basic rich text editing functions, allows for the insertion of various node types in multiple formats, provides a variety of practical tools, and supports setting page styles. It also supports exporting in various formats, printing and print preview, block-level document editing, adding custom extensions, multi-language settings, and a dark theme.",
6
6
  "keywords": [
@@ -42,6 +42,7 @@
42
42
  ],
43
43
  "exports": {
44
44
  ".": {
45
+ "types": "./types/index.d.ts",
45
46
  "import": "./dist/umo-editor.js"
46
47
  },
47
48
  "./style": {
package/types/index.d.ts CHANGED
@@ -9,13 +9,13 @@ export interface MarginOption {
9
9
  bottom: number
10
10
  }
11
11
  export interface WatermarkOption {
12
- type: string
13
- alpha: number
14
- fontColor: string
15
- fontSize: number
16
- fontFamily: string
17
- fontWeight: string
18
- text: string
12
+ type?: string
13
+ alpha?: number
14
+ fontColor?: string
15
+ fontSize?: number
16
+ fontFamily?: string
17
+ fontWeight?: string
18
+ text?: string
19
19
  }
20
20
  export interface PageOption {
21
21
  defaultMargin?: MarginOption
@@ -62,12 +62,13 @@ export type ToolbarMenu =
62
62
  | 'custom'
63
63
 
64
64
  export interface ToolbarOptions {
65
- defaultMode: 'classic' | 'ribbon'
66
- menus: ToolbarMenu[]
67
- disableMenuItems: string[]
68
- importWord: {
69
- enabled: boolean
70
- options: unknown
65
+ defaultMode?: 'classic' | 'ribbon'
66
+ menus?: ToolbarMenu[]
67
+ disableMenuItems?: string[]
68
+ importWord?: {
69
+ enabled?: boolean
70
+ maxSize?: number
71
+ options?: unknown
71
72
  useCustomMethod?: boolean
72
73
  onCustomImportMethod?: (file: File) => Promise<{
73
74
  id: string
@@ -79,20 +80,19 @@ export interface ToolbarOptions {
79
80
  }
80
81
 
81
82
  export interface AutoSaveOptions {
82
- enabled: boolean
83
- interval: number
83
+ enabled?: boolean
84
+ interval?: number
84
85
  }
85
86
 
86
87
  export interface DocumentOptions {
87
88
  id?: string
88
- title: string
89
- content: string
89
+ title?: string
90
+ content?: string
90
91
  placeholder?: Record<string, string>
91
92
  enableSpellcheck?: boolean
92
93
  enableMarkdown?: boolean
93
94
  enableBubbleMenu?: boolean
94
95
  enableBlockMenu?: boolean
95
- // enableComment?: boolean
96
96
  readOnly?: boolean
97
97
  autofocus?: 'start' | 'end' | 'all' | number | boolean | null
98
98
  characterLimit?: number
@@ -138,20 +138,20 @@ export interface Template {
138
138
  title: string
139
139
  content: string
140
140
  description?: string
141
- value: string
141
+ value?: string
142
142
  divider?: boolean
143
143
  }
144
144
 
145
145
  export interface AssistantOptions {
146
- enabled: boolean
147
- maxlength: number
148
- commands: CommandItem[]
146
+ enabled?: boolean
147
+ maxlength?: number
148
+ commands?: CommandItem[]
149
149
  onMessage?: AsyncFunction
150
150
  }
151
151
 
152
152
  export interface EchartsOptions {
153
- mode: number
154
- renderImage: boolean
153
+ mode?: number
154
+ renderImage?: boolean
155
155
  onCustomSettings?: CallableFunction
156
156
  }
157
157
 
@@ -162,65 +162,65 @@ export interface UserItem {
162
162
  }
163
163
 
164
164
  export interface WebPageItem {
165
- label: LocaleLabel
166
- icon: string
167
- validate(url: string): boolean
165
+ label?: LocaleLabel
166
+ icon?: string
167
+ validate?(url: string): boolean
168
168
  transformURL?(url: string): string
169
169
  }
170
170
 
171
171
  export interface CommandItem {
172
- label: LocaleLabel
173
- value: LocaleLabel
172
+ label?: LocaleLabel
173
+ value?: LocaleLabel
174
174
  autoSend?: boolean
175
175
  }
176
176
 
177
177
  export interface AssistantPayload {
178
- lang: string
179
- input: string
180
- command: string
181
- output: string
178
+ lang?: string
179
+ input?: string
180
+ command?: string
181
+ output?: string
182
182
  }
183
183
 
184
184
  export interface AssistantContent {
185
- html: string
186
- text: string
187
- json: unknown
185
+ html?: string
186
+ text?: string
187
+ json?: unknown
188
188
  }
189
189
  export interface AssistantResult {
190
- prompt: string
191
- content: string
192
- error: boolean
190
+ prompt?: string
191
+ content?: string
192
+ error?: boolean
193
193
  command?: string
194
194
  }
195
195
 
196
196
  export interface FileOptions {
197
- allowedMimeTypes: string[]
198
- maxSize: number
199
- preview: {
197
+ allowedMimeTypes?: string[]
198
+ maxSize?: number
199
+ preview?: {
200
200
  extensions?: string[]
201
- url: string
201
+ url?: string
202
202
  }[]
203
203
  }
204
204
 
205
205
  export interface UmoEditorOptions {
206
- editorKey: string
207
- locale: SupportedLocale
208
- theme: 'light' | 'dark'
209
- height: string
210
- fullscreenZIndex: number
206
+ editorKey?: string
207
+ locale?: SupportedLocale
208
+ theme?: 'light' | 'dark'
209
+ height?: string
210
+ fullscreenZIndex?: number
211
211
  dicts?: {
212
- pageSizes: PageSize[]
213
- fonts: Font[]
214
- colors: string[]
215
- lineHeights: LineHeight[]
216
- symbols: GraphicSymbol[]
217
- emojis: Emoji[]
212
+ pageSizes?: PageSize[]
213
+ fonts?: Font[]
214
+ colors?: string[]
215
+ lineHeights?: LineHeight[]
216
+ symbols?: GraphicSymbol[]
217
+ emojis?: Emoji[]
218
218
  }
219
219
  toolbar?: ToolbarOptions
220
- page: PageOption
220
+ page?: PageOption
221
221
  document?: DocumentOptions
222
222
  ai?: {
223
- assistant: AssistantOptions
223
+ assistant?: AssistantOptions
224
224
  }
225
225
  echarts?: EchartsOptions
226
226
  webPages?: WebPageItem[]
@@ -237,3 +237,6 @@ export interface UmoEditorOptions {
237
237
  onFileUpload?: (file: File) => Promise<{ id: string; url: string }>
238
238
  onFileDelete?: CallableFunction
239
239
  }
240
+
241
+ // 组件类型声明
242
+ export * from '../dist/umo-editor'