kindy-editor 1.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/LICENSE +22 -0
- package/README.md +269 -0
- package/README.zh-CN.md +193 -0
- package/dist/kindy-editor.cjs +148 -0
- package/dist/kindy-editor.css +1 -0
- package/dist/kindy-editor.d.ts +185 -0
- package/dist/kindy-editor.iife.js +148 -0
- package/dist/kindy-editor.js +65944 -0
- package/package.json +154 -0
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import type { App, Component, DefineComponent } from 'vue'
|
|
2
|
+
|
|
3
|
+
// ─────────────────────────────────────────────────
|
|
4
|
+
// Option Types
|
|
5
|
+
// ─────────────────────────────────────────────────
|
|
6
|
+
|
|
7
|
+
export interface KindyToolbarOptions {
|
|
8
|
+
/** 'classic' | 'ribbon' */
|
|
9
|
+
mode?: 'classic' | 'ribbon'
|
|
10
|
+
show?: boolean
|
|
11
|
+
menus?: string[]
|
|
12
|
+
defaultMode?: 'classic' | 'ribbon'
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface KindyPageMargin {
|
|
16
|
+
top?: number
|
|
17
|
+
bottom?: number
|
|
18
|
+
left?: number
|
|
19
|
+
right?: number
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface KindyPageSize {
|
|
23
|
+
label: string
|
|
24
|
+
width: number
|
|
25
|
+
height: number
|
|
26
|
+
default?: boolean
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface KindyWatermark {
|
|
30
|
+
text?: string
|
|
31
|
+
alpha?: number
|
|
32
|
+
type?: 'compact' | 'spacious'
|
|
33
|
+
fontColor?: string
|
|
34
|
+
fontSize?: number
|
|
35
|
+
fontFamily?: string | null
|
|
36
|
+
fontWeight?: 'normal' | 'bold' | 'bolder'
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface KindyAutoSave {
|
|
40
|
+
enabled: boolean
|
|
41
|
+
interval?: number
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface KindyDocumentOptions {
|
|
45
|
+
title?: string
|
|
46
|
+
content?: string
|
|
47
|
+
readOnly?: boolean
|
|
48
|
+
enableMarkdown?: boolean
|
|
49
|
+
autoSave?: KindyAutoSave
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface KindyPageOptions {
|
|
53
|
+
layouts?: string[]
|
|
54
|
+
defaultBackground?: string
|
|
55
|
+
defaultMargin?: KindyPageMargin
|
|
56
|
+
defaultOrientation?: 'portrait' | 'landscape'
|
|
57
|
+
watermark?: KindyWatermark
|
|
58
|
+
showBreakMarks?: boolean
|
|
59
|
+
showBookmark?: boolean
|
|
60
|
+
showLineNumber?: boolean
|
|
61
|
+
showToc?: boolean
|
|
62
|
+
size?: KindyPageSize
|
|
63
|
+
pageSizes?: KindyPageSize[]
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface KindyEditorOptions {
|
|
67
|
+
editorKey?: string
|
|
68
|
+
locale?: string
|
|
69
|
+
theme?: 'light' | 'dark' | 'auto'
|
|
70
|
+
skin?: 'default' | 'modern'
|
|
71
|
+
height?: string
|
|
72
|
+
toolbar?: KindyToolbarOptions
|
|
73
|
+
page?: KindyPageOptions
|
|
74
|
+
document?: KindyDocumentOptions
|
|
75
|
+
translations?: Record<string, Record<string, string>>
|
|
76
|
+
fullscreenZIndex?: number
|
|
77
|
+
dicts?: {
|
|
78
|
+
pageSizes?: KindyPageSize[]
|
|
79
|
+
[key: string]: unknown
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// ─────────────────────────────────────────────────
|
|
84
|
+
// Comment Types
|
|
85
|
+
// ─────────────────────────────────────────────────
|
|
86
|
+
|
|
87
|
+
export interface KindyCommentReply {
|
|
88
|
+
id: string
|
|
89
|
+
user: string
|
|
90
|
+
text: string
|
|
91
|
+
createdAt: number
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface KindyComment {
|
|
95
|
+
id: string
|
|
96
|
+
user: string
|
|
97
|
+
color?: string
|
|
98
|
+
text?: string
|
|
99
|
+
resolved?: boolean
|
|
100
|
+
createdAt: number
|
|
101
|
+
replies?: KindyCommentReply[]
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// ─────────────────────────────────────────────────
|
|
105
|
+
// Editor Instance Methods (exposed via ref)
|
|
106
|
+
// ─────────────────────────────────────────────────
|
|
107
|
+
|
|
108
|
+
export interface KindyEditorInstance {
|
|
109
|
+
setContent(content: string | object, options?: object): void
|
|
110
|
+
insertContent(content: string | object, options?: object): void
|
|
111
|
+
getContent(type?: 'html' | 'json' | 'text'): string | object
|
|
112
|
+
exportPdf(filename?: string): Promise<void>
|
|
113
|
+
exportImage(type?: 'png' | 'jpeg', filename?: string): Promise<void>
|
|
114
|
+
print(): void
|
|
115
|
+
setOptions(options: Partial<KindyEditorOptions>): void
|
|
116
|
+
setToolbar(params: { mode?: 'classic' | 'ribbon'; show?: boolean }): void
|
|
117
|
+
setLayout(layout: string): void
|
|
118
|
+
setPage(params: Partial<KindyPageOptions>): void
|
|
119
|
+
setWatermark(params: KindyWatermark): void
|
|
120
|
+
setDocument(params: Partial<KindyDocumentOptions>): void
|
|
121
|
+
setTheme(theme: 'light' | 'dark' | 'auto'): void
|
|
122
|
+
setSkin(skin: 'default' | 'modern'): void
|
|
123
|
+
saveContent(): Promise<void>
|
|
124
|
+
focus(): void
|
|
125
|
+
destroy(): void
|
|
126
|
+
startTypewriter(content: object, options?: object): void
|
|
127
|
+
stopTypewriter(): void
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// ─────────────────────────────────────────────────
|
|
131
|
+
// Main Component
|
|
132
|
+
// ─────────────────────────────────────────────────
|
|
133
|
+
|
|
134
|
+
export declare const KindyEditor: DefineComponent<
|
|
135
|
+
KindyEditorOptions,
|
|
136
|
+
KindyEditorInstance,
|
|
137
|
+
object
|
|
138
|
+
>
|
|
139
|
+
|
|
140
|
+
// ─────────────────────────────────────────────────
|
|
141
|
+
// Helper Components
|
|
142
|
+
// ─────────────────────────────────────────────────
|
|
143
|
+
|
|
144
|
+
export declare const KindyMenuButton: Component
|
|
145
|
+
export declare const KindyDialog: Component
|
|
146
|
+
export declare const KindyTooltip: Component
|
|
147
|
+
|
|
148
|
+
// ─────────────────────────────────────────────────
|
|
149
|
+
// Mount Helper (Pure JS / React / Next.js / Angular / Svelte)
|
|
150
|
+
// ─────────────────────────────────────────────────
|
|
151
|
+
|
|
152
|
+
export declare const mountKindyEditor: (
|
|
153
|
+
container: HTMLElement | string,
|
|
154
|
+
props?: Partial<KindyEditorOptions>
|
|
155
|
+
) => {
|
|
156
|
+
unmount: () => void
|
|
157
|
+
app: App
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// ─────────────────────────────────────────────────
|
|
161
|
+
// Plugin
|
|
162
|
+
// ─────────────────────────────────────────────────
|
|
163
|
+
|
|
164
|
+
export declare const useKindyEditor: {
|
|
165
|
+
install(app: App, options?: Partial<KindyEditorOptions>): void
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// ─────────────────────────────────────────────────
|
|
169
|
+
// Default export
|
|
170
|
+
// ─────────────────────────────────────────────────
|
|
171
|
+
|
|
172
|
+
export default KindyEditor
|
|
173
|
+
|
|
174
|
+
// ─────────────────────────────────────────────────
|
|
175
|
+
// Vue Global Component Types
|
|
176
|
+
// ─────────────────────────────────────────────────
|
|
177
|
+
|
|
178
|
+
declare module '@vue/runtime-core' {
|
|
179
|
+
export interface GlobalComponents {
|
|
180
|
+
KindyEditor: typeof KindyEditor
|
|
181
|
+
KindyMenuButton: typeof KindyMenuButton
|
|
182
|
+
KindyDialog: typeof KindyDialog
|
|
183
|
+
KindyTooltip: typeof KindyTooltip
|
|
184
|
+
}
|
|
185
|
+
}
|