bg-editor 0.0.1
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 +8 -0
- package/README.md +51 -0
- package/README.zh-CN.md +51 -0
- package/dist/_basePickBy-4kmg42pS.js +158 -0
- package/dist/_baseUniq-WOvvCHTI.js +621 -0
- package/dist/arc-wItjmL5I.js +90 -0
- package/dist/architecture-U656AL7Q-FYDwFSxk.js +12 -0
- package/dist/architectureDiagram-VXUJARFQ-iG5MkBjx.js +4666 -0
- package/dist/blockDiagram-VD42YOAC-i2GlXmWy.js +2268 -0
- package/dist/c4Diagram-YG6GDRKO-IufO7T1R.js +1587 -0
- package/dist/channel-Dah4F59k.js +12 -0
- package/dist/chunk-4BX2VUAB-5_v9rnje.js +15 -0
- package/dist/chunk-55IACEB6-BDNtSypP.js +15 -0
- package/dist/chunk-B4BG7PRW-DzaYPsfW.js +1382 -0
- package/dist/chunk-DI55MBZ5-Buwrprkw.js +1377 -0
- package/dist/chunk-FMBD7UC4-BaEPEIWb.js +26 -0
- package/dist/chunk-QN33PNHL-DhbA7i5G.js +26 -0
- package/dist/chunk-QZHKN3VN-BAb_D1oz.js +22 -0
- package/dist/chunk-TZMSLE5B-OU1MJ2do.js +71 -0
- package/dist/classDiagram-2ON5EDUG-KStC8v09.js +23 -0
- package/dist/classDiagram-v2-WZHVMYZB-KStC8v09.js +23 -0
- package/dist/clone-C74UiRbr.js +15 -0
- package/dist/cose-bilkent-S5V4N54A-eRXCoix2.js +2612 -0
- package/dist/cytoscape.esm-BG3R4uVs.js +18738 -0
- package/dist/dagre-6UL2VRFP-Bi83jPQf.js +451 -0
- package/dist/defaultLocale-DgmhL6Re.js +178 -0
- package/dist/diagram-PSM6KHXK-aW98k2-4.js +539 -0
- package/dist/diagram-QEK2KX5R-BR--iNM5.js +224 -0
- package/dist/diagram-S2PKOQOG-NTnEy5_O.js +149 -0
- package/dist/erDiagram-Q2GNP2WA-C8oZ5c-S.js +848 -0
- package/dist/flowDiagram-NV44I4VS-DiKad3Bb.js +1627 -0
- package/dist/ganttDiagram-LVOFAZNH-CthzjjJq.js +2506 -0
- package/dist/gitGraph-F6HP7TQM-CuXAC0XT.js +12 -0
- package/dist/gitGraphDiagram-NY62KEGX-d4KszKqi.js +706 -0
- package/dist/graph-CnOTx4E0.js +254 -0
- package/dist/index-D6-Wf75-.js +122127 -0
- package/dist/info-NVLQJR56-Dhmtdc7O.js +12 -0
- package/dist/infoDiagram-ER5ION4S-DedidjTu.js +31 -0
- package/dist/init-d639unba.js +23 -0
- package/dist/journeyDiagram-XKPGCS4Q-BylvmUWL.js +843 -0
- package/dist/kanban-definition-3W4ZIXB7-DGV_aVgU.js +725 -0
- package/dist/layout-OXk4OSoz.js +1342 -0
- package/dist/linear-CO_vz87n.js +266 -0
- package/dist/mermaid-parser.core-CYtF6phW.js +12928 -0
- package/dist/mindmap-definition-VGOIOE7T-BU05Y6Vz.js +790 -0
- package/dist/ordinal-CofNqUw2.js +68 -0
- package/dist/packet-BFZMPI3H-D7H_8Q-U.js +12 -0
- package/dist/pie-7BOR55EZ-BNWNcO5Z.js +12 -0
- package/dist/pieDiagram-ADFJNKIX-reGTUsiW.js +168 -0
- package/dist/quadrantDiagram-AYHSOK5B-NeHOJ0lX.js +1029 -0
- package/dist/radar-NHE76QYJ-DrVEcvh1.js +12 -0
- package/dist/requirementDiagram-UZGBJVZJ-BE76XNaT.js +857 -0
- package/dist/sankeyDiagram-TZEHDZUN-UHfMLEKl.js +817 -0
- package/dist/sequenceDiagram-WL72ISMW-62KWnVbh.js +2518 -0
- package/dist/stateDiagram-FKZM4ZOC--_CkWvu6.js +270 -0
- package/dist/stateDiagram-v2-4FDKWEC3-Dj7ZjAmI.js +23 -0
- package/dist/style.css +1 -0
- package/dist/timeline-definition-IT6M3QCI-C3Wb0xMN.js +804 -0
- package/dist/treemap-KMMF4GRG-Bc8F2dFd.js +12 -0
- package/dist/umo-editor.js +16 -0
- package/dist/xychartDiagram-PRI3JC2R-D2J307cO.js +1347 -0
- package/package.json +200 -0
- package/types/index.d.ts +277 -0
- package/types/src/components/index.d.ts +9 -0
- package/types/src/components/menus/button.vue.d.ts +583 -0
- package/types/src/components/modal.vue.d.ts +2 -0
- package/types/src/components/tooltip.vue.d.ts +27 -0
package/package.json
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "bg-editor",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "open-source document editor based on Vue3 and Tiptap. 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
|
+
"keywords": [
|
|
7
|
+
"document editor",
|
|
8
|
+
"docs editor",
|
|
9
|
+
"word editor",
|
|
10
|
+
"office edtior",
|
|
11
|
+
"web editor",
|
|
12
|
+
"richtext editor",
|
|
13
|
+
"wysiwyg editor",
|
|
14
|
+
"vue editor",
|
|
15
|
+
"vue3 editor",
|
|
16
|
+
"ai editor",
|
|
17
|
+
"editor",
|
|
18
|
+
"web office",
|
|
19
|
+
"online office",
|
|
20
|
+
"tiptap"
|
|
21
|
+
],
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"files": [
|
|
24
|
+
"dist",
|
|
25
|
+
"types/index.d.ts",
|
|
26
|
+
"types/src/*"
|
|
27
|
+
],
|
|
28
|
+
"main": "./dist/umo-editor.js",
|
|
29
|
+
"module": "./dist/umo-editor.js",
|
|
30
|
+
"exports": {
|
|
31
|
+
".": {
|
|
32
|
+
"types": "./types/index.d.ts",
|
|
33
|
+
"import": "./dist/umo-editor.js",
|
|
34
|
+
"default": "./dist/umo-editor.js"
|
|
35
|
+
},
|
|
36
|
+
"./style": {
|
|
37
|
+
"import": "./dist/style.css",
|
|
38
|
+
"default": "./dist/style.css"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"types": "./types/index.d.ts",
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@eslint/object-schema": "^2.1.4",
|
|
44
|
+
"@tiptap-extend/columns": "^2.1.6",
|
|
45
|
+
"@tiptap/core": "2.11.5",
|
|
46
|
+
"@tiptap/extension-bold": "2.11.5",
|
|
47
|
+
"@tiptap/extension-bubble-menu": "2.11.5",
|
|
48
|
+
"@tiptap/extension-bullet-list": "2.11.5",
|
|
49
|
+
"@tiptap/extension-character-count": "2.11.5",
|
|
50
|
+
"@tiptap/extension-code-block": "2.11.5",
|
|
51
|
+
"@tiptap/extension-code-block-lowlight": "2.11.5",
|
|
52
|
+
"@tiptap/extension-collaboration": "2.11.5",
|
|
53
|
+
"@tiptap/extension-color": "2.11.5",
|
|
54
|
+
"@tiptap/extension-document": "2.11.5",
|
|
55
|
+
"@tiptap/extension-dropcursor": "2.11.5",
|
|
56
|
+
"@tiptap/extension-focus": "2.11.5",
|
|
57
|
+
"@tiptap/extension-font-family": "2.11.5",
|
|
58
|
+
"@tiptap/extension-heading": "2.11.5",
|
|
59
|
+
"@tiptap/extension-highlight": "2.11.5",
|
|
60
|
+
"@tiptap/extension-history": "2.11.5",
|
|
61
|
+
"@tiptap/extension-horizontal-rule": "2.11.5",
|
|
62
|
+
"@tiptap/extension-image": "2.11.5",
|
|
63
|
+
"@tiptap/extension-link": "2.11.5",
|
|
64
|
+
"@tiptap/extension-mention": "2.11.5",
|
|
65
|
+
"@tiptap/extension-ordered-list": "2.11.5",
|
|
66
|
+
"@tiptap/extension-placeholder": "2.11.5",
|
|
67
|
+
"@tiptap/extension-subscript": "2.11.5",
|
|
68
|
+
"@tiptap/extension-superscript": "2.11.5",
|
|
69
|
+
"@tiptap/extension-table": "2.11.5",
|
|
70
|
+
"@tiptap/extension-table-cell": "2.11.5",
|
|
71
|
+
"@tiptap/extension-table-header": "2.11.5",
|
|
72
|
+
"@tiptap/extension-table-row": "2.11.5",
|
|
73
|
+
"@tiptap/extension-task-item": "2.11.5",
|
|
74
|
+
"@tiptap/extension-task-list": "2.11.5",
|
|
75
|
+
"@tiptap/extension-text-align": "2.11.5",
|
|
76
|
+
"@tiptap/extension-text-style": "2.11.5",
|
|
77
|
+
"@tiptap/extension-typography": "2.11.5",
|
|
78
|
+
"@tiptap/extension-underline": "2.11.5",
|
|
79
|
+
"@tiptap/pm": "2.11.5",
|
|
80
|
+
"@tiptap/starter-kit": "2.11.5",
|
|
81
|
+
"@tiptap/suggestion": "2.11.5",
|
|
82
|
+
"@tiptap/vue-3": "2.11.5",
|
|
83
|
+
"@tool-belt/type-predicates": "^1.3.0",
|
|
84
|
+
"@types/svg64": "^1.1.2",
|
|
85
|
+
"@umoteam/editor-external": "^9.0.0",
|
|
86
|
+
"@umoteam/viewer": "^0.3.0",
|
|
87
|
+
"@vueuse/core": "^11.0.3",
|
|
88
|
+
"buffer-image-size": "^0.6.4",
|
|
89
|
+
"dom-to-image-more": "^3.4.3",
|
|
90
|
+
"es-drager": "1.2.11",
|
|
91
|
+
"file-saver": "^2.0.5",
|
|
92
|
+
"file64": "^1.0.4",
|
|
93
|
+
"highlight.js": "^11.11.1",
|
|
94
|
+
"hotkeys-js": "^3.13.7",
|
|
95
|
+
"jsbarcode": "^3.11.6",
|
|
96
|
+
"katex": "^0.16.11",
|
|
97
|
+
"lowlight": "^3.3.0",
|
|
98
|
+
"mermaid": "^11.2.0",
|
|
99
|
+
"nzh": "^1.0.13",
|
|
100
|
+
"plyr": "^3.7.8",
|
|
101
|
+
"pretty-bytes": "^6.1.1",
|
|
102
|
+
"prosemirror-transform": "^1.10.0",
|
|
103
|
+
"pure-svg-code": "^1.0.6",
|
|
104
|
+
"sign-canvas-plus": "^2.0.3",
|
|
105
|
+
"smooth-signature": "^1.0.15",
|
|
106
|
+
"svg64": "^2.0.0",
|
|
107
|
+
"tippy.js": "^6.3.7",
|
|
108
|
+
"vue-i18n": "^10.0.0",
|
|
109
|
+
"y-prosemirror": "^1.2.15",
|
|
110
|
+
"y-protocols": "^1.0.6",
|
|
111
|
+
"yjs": "^13.6.23"
|
|
112
|
+
},
|
|
113
|
+
"devDependencies": {
|
|
114
|
+
"@eslint/eslintrc": "^3.1.0",
|
|
115
|
+
"@eslint/js": "^9.10.0",
|
|
116
|
+
"@intlify/unplugin-vue-i18n": "^5.0.0",
|
|
117
|
+
"@sereneinserenade/tiptap-search-and-replace": "^0.1.1",
|
|
118
|
+
"@testing-library/vue": "^8.1.0",
|
|
119
|
+
"@tiptap-pro/extension-drag-handle": "2.17.5",
|
|
120
|
+
"@tiptap-pro/extension-drag-handle-vue-3": "2.17.5",
|
|
121
|
+
"@tiptap-pro/extension-invisible-characters": "2.17.5",
|
|
122
|
+
"@tiptap-pro/extension-mathematics": "2.17.5",
|
|
123
|
+
"@tiptap-pro/extension-node-range": "2.17.5",
|
|
124
|
+
"@tiptap-pro/extension-table-of-contents": "2.17.5",
|
|
125
|
+
"@types/dom-to-image": "^2.6.7",
|
|
126
|
+
"@types/eslint-config-prettier": "^6.11.3",
|
|
127
|
+
"@types/file-saver": "^2.0.7",
|
|
128
|
+
"@types/node": "^22.5.4",
|
|
129
|
+
"@types/qrcode-svg": "^1.1.5",
|
|
130
|
+
"@typescript-eslint/eslint-plugin": "^8.5.0",
|
|
131
|
+
"@typescript-eslint/parser": "^8.5.0",
|
|
132
|
+
"@vitejs/plugin-vue": "^4.6.2",
|
|
133
|
+
"@vue-macros/reactivity-transform": "^1.0.4",
|
|
134
|
+
"@vue-macros/volar": "^0.29.1",
|
|
135
|
+
"@vue/eslint-config-prettier": "^9.0.0",
|
|
136
|
+
"eslint": "^9.21.0",
|
|
137
|
+
"eslint-config-prettier": "^9.1.0",
|
|
138
|
+
"eslint-plugin-functional": "^5.0.8",
|
|
139
|
+
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
140
|
+
"eslint-plugin-unused-imports": "^4.1.3",
|
|
141
|
+
"eslint-plugin-vue": "^9.28.0",
|
|
142
|
+
"globals": "^15.9.0",
|
|
143
|
+
"husky": "^9.1.5",
|
|
144
|
+
"jiti": "^2.4.2",
|
|
145
|
+
"jsdom": "^25.0.0",
|
|
146
|
+
"less": "^4.2.0",
|
|
147
|
+
"less-loader": "^12.2.0",
|
|
148
|
+
"lint-staged": "^15.2.10",
|
|
149
|
+
"postcss": "^8.3.3",
|
|
150
|
+
"postcss-html": "^1.7.0",
|
|
151
|
+
"prettier": "^3.3.3",
|
|
152
|
+
"stylelint": "^16.9.0",
|
|
153
|
+
"stylelint-config-recommended-less": "^3.0.1",
|
|
154
|
+
"stylelint-config-recommended-vue": "^1.5.0",
|
|
155
|
+
"stylelint-less": "^3.0.1",
|
|
156
|
+
"tdesign-vue-next": "1.9.8",
|
|
157
|
+
"typescript": "5.5.4",
|
|
158
|
+
"typescript-eslint": "^8.5.0",
|
|
159
|
+
"unplugin-auto-import": "^0.18.2",
|
|
160
|
+
"unplugin-vue": "^5.1.5",
|
|
161
|
+
"unplugin-vue-components": "^0.27.4",
|
|
162
|
+
"unplugin-vue-macros": "^2.11.11",
|
|
163
|
+
"vite": "^5.0.0",
|
|
164
|
+
"vite-plugin-dts": "^4.5.4",
|
|
165
|
+
"vite-plugin-inspect": "^0.8.7",
|
|
166
|
+
"vite-plugin-svg-icons": "^2.0.1",
|
|
167
|
+
"vite-tsconfig-paths": "^5.0.1",
|
|
168
|
+
"vitest": "^2.0.5",
|
|
169
|
+
"vue": "^3.0.11",
|
|
170
|
+
"vue-tsc": "^2.1.6"
|
|
171
|
+
},
|
|
172
|
+
"engines": {
|
|
173
|
+
"node": ">=18.0.0"
|
|
174
|
+
},
|
|
175
|
+
"lint-staged": {
|
|
176
|
+
"*.{js,jsx,mjs,cjs,ts,tsx,mts,cts,vue,less,css,yml,yaml,json,md,html}": [
|
|
177
|
+
"prettier --write src"
|
|
178
|
+
],
|
|
179
|
+
"*.{css,less,vue}": [
|
|
180
|
+
"stylelint --write src/**/*.{css,less,vue}"
|
|
181
|
+
],
|
|
182
|
+
"*.{js,jsx,mjs,cjs,ts,tsx,mts,cts,vue}": [
|
|
183
|
+
"eslint --fix src"
|
|
184
|
+
]
|
|
185
|
+
},
|
|
186
|
+
"scripts": {
|
|
187
|
+
"build": "vue-tsc --noEmit && vite build",
|
|
188
|
+
"dev": "vite --port 9000 --open --force",
|
|
189
|
+
"format": "prettier --write .",
|
|
190
|
+
"check:code": "eslint --cache src",
|
|
191
|
+
"check:style": "stylelint src/**/*.{css,less,vue}",
|
|
192
|
+
"check:types": "vue-tsc --noEmit",
|
|
193
|
+
"lint:code": "eslint --cache --fix src",
|
|
194
|
+
"lint:style": "stylelint --fix src/**/*.{css,less,vue}",
|
|
195
|
+
"test": "NODE_NO_WARNINGS=1 vitest",
|
|
196
|
+
"test:coverage": "npm run test --coverage",
|
|
197
|
+
"test:watch": "npm run test --watch --coverage",
|
|
198
|
+
"push": "pnpm build && pnpm publish --no-git-checks --registry https://registry.npmjs.org/"
|
|
199
|
+
}
|
|
200
|
+
}
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,277 @@
|
|
|
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
|
+
showDefaultCommands?: boolean
|
|
152
|
+
onMessage?: (
|
|
153
|
+
payload: AssistantPayload,
|
|
154
|
+
content: AssistantContent,
|
|
155
|
+
) => Promise<ReadableStream | string>
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export interface EchartsOptions {
|
|
159
|
+
mode?: number
|
|
160
|
+
renderImage?: boolean
|
|
161
|
+
onCustomSettings?: CallableFunction
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export interface UserItem {
|
|
165
|
+
id: string
|
|
166
|
+
label: string
|
|
167
|
+
avatar?: string
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export interface WebPageItem {
|
|
171
|
+
label?: LocaleLabel
|
|
172
|
+
icon?: string
|
|
173
|
+
validate?(url: string): boolean
|
|
174
|
+
transformURL?(url: string): string
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export interface CommandItem {
|
|
178
|
+
label?: LocaleLabel
|
|
179
|
+
value?: LocaleLabel
|
|
180
|
+
icon?: string
|
|
181
|
+
autoSend?: boolean
|
|
182
|
+
children?: CommandItem[]
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export interface AssistantPayload {
|
|
186
|
+
lang?: string
|
|
187
|
+
input?: string
|
|
188
|
+
command?: string
|
|
189
|
+
output?: string
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export interface AssistantContent {
|
|
193
|
+
html: HTMLContent
|
|
194
|
+
json: JSONContent
|
|
195
|
+
text: string
|
|
196
|
+
}
|
|
197
|
+
export interface AssistantResult {
|
|
198
|
+
prompt?: string
|
|
199
|
+
content?: string
|
|
200
|
+
error?: boolean
|
|
201
|
+
command?: string
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
export interface FileOptions {
|
|
205
|
+
allowedMimeTypes?: string[]
|
|
206
|
+
maxSize?: number
|
|
207
|
+
preview?: {
|
|
208
|
+
extensions?: string[]
|
|
209
|
+
url?: string
|
|
210
|
+
}[]
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export type InsterContentType = string | Fragment | ProseMirrorNode
|
|
214
|
+
|
|
215
|
+
export interface SetContentOptions {
|
|
216
|
+
emitUpdate: boolean
|
|
217
|
+
focusPosition: FocusPosition
|
|
218
|
+
focusOptions: { scrollIntoView: boolean }
|
|
219
|
+
}
|
|
220
|
+
export type InsterContentOptions = Omit<SetContentOptions, 'emitUpdate'> & {
|
|
221
|
+
updateSelection: boolean
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
export type SetContentType = InsterContentType | JSONContent | JSONContent[]
|
|
225
|
+
|
|
226
|
+
type OnSaveFunction = (
|
|
227
|
+
content: {
|
|
228
|
+
html: HTMLContent
|
|
229
|
+
json: JSONContent
|
|
230
|
+
text: string
|
|
231
|
+
},
|
|
232
|
+
page: PageOption,
|
|
233
|
+
document: DocumentOptions,
|
|
234
|
+
) => Promise<unknown>
|
|
235
|
+
|
|
236
|
+
type DeleteFileType = 'image' | 'video' | 'audio' | 'file' | 'inlineImage'
|
|
237
|
+
|
|
238
|
+
export interface UmoEditorOptions {
|
|
239
|
+
editorKey?: string
|
|
240
|
+
locale?: SupportedLocale
|
|
241
|
+
theme?: 'light' | 'dark'
|
|
242
|
+
height?: string
|
|
243
|
+
fullscreenZIndex?: number
|
|
244
|
+
dicts?: {
|
|
245
|
+
pageSizes?: PageSize[]
|
|
246
|
+
fonts?: Font[]
|
|
247
|
+
colors?: string[]
|
|
248
|
+
lineHeights?: LineHeight[]
|
|
249
|
+
symbols?: GraphicSymbol[]
|
|
250
|
+
emojis?: Emoji[]
|
|
251
|
+
}
|
|
252
|
+
toolbar?: ToolbarOptions
|
|
253
|
+
page?: PageOption
|
|
254
|
+
document?: DocumentOptions
|
|
255
|
+
ai?: {
|
|
256
|
+
assistant?: AssistantOptions
|
|
257
|
+
}
|
|
258
|
+
echarts?: EchartsOptions
|
|
259
|
+
webPages?: WebPageItem[]
|
|
260
|
+
templates?: Template[]
|
|
261
|
+
cdnUrl?: string
|
|
262
|
+
shareUrl?: string
|
|
263
|
+
diagrams?: Record<string, unknown>
|
|
264
|
+
importWord?: ImportWordOptions
|
|
265
|
+
file?: FileOptions
|
|
266
|
+
user?: Record<string, unknown>
|
|
267
|
+
users?: UserItem[]
|
|
268
|
+
extensions?: Extension[]
|
|
269
|
+
disableExtensions?: string[]
|
|
270
|
+
translations?: Record<string, unknown>
|
|
271
|
+
onSave?: OnSaveFunction
|
|
272
|
+
onFileUpload?: (file: File) => Promise<{ id: string; url: string }>
|
|
273
|
+
onFileDelete?: (id: string, url: string, type?: DeleteFileType) => void
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
// 组件类型声明
|
|
277
|
+
export * from './src/components'
|
|
@@ -0,0 +1,9 @@
|
|
|
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, };
|