@henryx/pagely 0.1.1 → 0.2.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/dist/components/DotFlowPadBlockView.vue.d.ts +44 -2
- package/dist/components/PagelyEditor.vue.d.ts +2 -0
- package/dist/components/PagelyPage.vue.d.ts +476 -0
- package/dist/components/PagelyToc.vue.d.ts +17 -0
- package/dist/components/PagelyViewer.vue.d.ts +2 -0
- package/dist/composables/useFileUpload.d.ts +6 -1
- package/dist/composables/useHeadingCollapse.d.ts +2 -2
- package/dist/composables/useLinkOps.d.ts +1 -1
- package/dist/composables/usePagelyEditor.d.ts +2 -0
- package/dist/composables/usePagelyToc.d.ts +50 -0
- package/dist/config/insertMenu/commands.d.ts +3 -0
- package/dist/extensions/Image.d.ts +9 -2
- package/dist/index.d.ts +5 -0
- package/dist/pagely.cjs +64 -69
- package/dist/pagely.js +8206 -11579
- package/dist/style.css +1 -1
- package/dist/utils/attachmentUpload.d.ts +3 -0
- package/package.json +4 -1
|
@@ -101,8 +101,50 @@ declare const _default: import('vue').DefineComponent<NodeViewProps, {}, {}, {},
|
|
|
101
101
|
};
|
|
102
102
|
}) | null;
|
|
103
103
|
inlineWrap: HTMLDivElement;
|
|
104
|
-
inlineRef:
|
|
104
|
+
inlineRef: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<{
|
|
105
|
+
initialData?: unknown;
|
|
106
|
+
readonly?: boolean;
|
|
107
|
+
}>, {
|
|
108
|
+
getData: () => unknown;
|
|
109
|
+
setData: (data: unknown) => void;
|
|
110
|
+
fitView?: () => void;
|
|
111
|
+
}, {}, import('vue').ComputedOptions, import('vue').MethodOptions, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {}, true, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, any, import('vue').ComponentProvideOptions, {
|
|
112
|
+
P: {};
|
|
113
|
+
B: {};
|
|
114
|
+
D: {};
|
|
115
|
+
C: {};
|
|
116
|
+
M: {};
|
|
117
|
+
Defaults: {};
|
|
118
|
+
}, Readonly<{
|
|
119
|
+
initialData?: unknown;
|
|
120
|
+
readonly?: boolean;
|
|
121
|
+
}>, {
|
|
122
|
+
getData: () => unknown;
|
|
123
|
+
setData: (data: unknown) => void;
|
|
124
|
+
fitView?: () => void;
|
|
125
|
+
}, {}, import('vue').ComputedOptions, import('vue').MethodOptions, {}> | null;
|
|
105
126
|
fullscreenWrap: HTMLDivElement;
|
|
106
|
-
fullscreenRef:
|
|
127
|
+
fullscreenRef: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<{
|
|
128
|
+
initialData?: unknown;
|
|
129
|
+
readonly?: boolean;
|
|
130
|
+
}>, {
|
|
131
|
+
getData: () => unknown;
|
|
132
|
+
setData: (data: unknown) => void;
|
|
133
|
+
fitView?: () => void;
|
|
134
|
+
}, {}, import('vue').ComputedOptions, import('vue').MethodOptions, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {}, true, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, any, import('vue').ComponentProvideOptions, {
|
|
135
|
+
P: {};
|
|
136
|
+
B: {};
|
|
137
|
+
D: {};
|
|
138
|
+
C: {};
|
|
139
|
+
M: {};
|
|
140
|
+
Defaults: {};
|
|
141
|
+
}, Readonly<{
|
|
142
|
+
initialData?: unknown;
|
|
143
|
+
readonly?: boolean;
|
|
144
|
+
}>, {
|
|
145
|
+
getData: () => unknown;
|
|
146
|
+
setData: (data: unknown) => void;
|
|
147
|
+
fitView?: () => void;
|
|
148
|
+
}, {}, import('vue').ComputedOptions, import('vue').MethodOptions, {}> | null;
|
|
107
149
|
}, any>;
|
|
108
150
|
export default _default;
|
|
@@ -3,9 +3,11 @@ import { AnchorSpec, CommentAnchor, CommentClickPayload, CommentCreateSpec, Comm
|
|
|
3
3
|
import { MentionAnchor, MentionTriggerPayload } from '../composables/useMention';
|
|
4
4
|
import { MentionAttrs } from '../extensions/Mention';
|
|
5
5
|
import { FileUploadHandler } from '../composables/useFileUpload';
|
|
6
|
+
import { ImageUrlResolver } from '../extensions/Image';
|
|
6
7
|
type __VLS_Props = {
|
|
7
8
|
initialContent?: string;
|
|
8
9
|
fileUploadHandler?: FileUploadHandler;
|
|
10
|
+
imageUrlResolver?: ImageUrlResolver;
|
|
9
11
|
enableComment?: boolean;
|
|
10
12
|
};
|
|
11
13
|
declare const _default: import('vue').DefineComponent<__VLS_Props, {
|
|
@@ -0,0 +1,476 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/vue-3';
|
|
2
|
+
import { AnchorSpec, CommentAnchor, CommentClickPayload, CommentCreateSpec, CommentHoverPayload } from '../composables/useCommentAnchors';
|
|
3
|
+
import { FileUploadHandler } from '../composables/useFileUpload';
|
|
4
|
+
import { MentionAnchor, MentionTriggerPayload } from '../composables/useMention';
|
|
5
|
+
import { MentionAttrs } from '../extensions/Mention';
|
|
6
|
+
import { ImageUrlResolver } from '../extensions/Image';
|
|
7
|
+
type PagelyPageMode = 'edit' | 'view';
|
|
8
|
+
type PagelyPageFormat = 'html' | 'markdown';
|
|
9
|
+
type __VLS_Props = {
|
|
10
|
+
mode?: PagelyPageMode;
|
|
11
|
+
content?: string;
|
|
12
|
+
format?: PagelyPageFormat;
|
|
13
|
+
initialContent?: string;
|
|
14
|
+
fileUploadHandler?: FileUploadHandler;
|
|
15
|
+
imageUrlResolver?: ImageUrlResolver;
|
|
16
|
+
enableComment?: boolean;
|
|
17
|
+
tocMaxLevel?: number;
|
|
18
|
+
};
|
|
19
|
+
declare function refreshToc(): void;
|
|
20
|
+
declare function getHtml(): string;
|
|
21
|
+
declare function getMarkdown(): string;
|
|
22
|
+
declare function setMarkdown(md: string): void;
|
|
23
|
+
declare function setHtml(html: string): void;
|
|
24
|
+
declare function setContent(content: string, format?: PagelyPageFormat): void;
|
|
25
|
+
declare function getEditor(): Editor | undefined;
|
|
26
|
+
declare function __VLS_template(): {
|
|
27
|
+
attrs: Partial<{}>;
|
|
28
|
+
slots: {
|
|
29
|
+
after?(_: {}): any;
|
|
30
|
+
};
|
|
31
|
+
refs: {
|
|
32
|
+
scrollRef: HTMLElement;
|
|
33
|
+
editorRef: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<{
|
|
34
|
+
initialContent?: string;
|
|
35
|
+
fileUploadHandler?: FileUploadHandler;
|
|
36
|
+
imageUrlResolver?: ImageUrlResolver;
|
|
37
|
+
enableComment?: boolean;
|
|
38
|
+
}> & Readonly<{
|
|
39
|
+
"onUpdate:markdown"?: ((md: string) => any) | undefined;
|
|
40
|
+
"onUpdate:html"?: ((html: string) => any) | undefined;
|
|
41
|
+
"onComment:create"?: ((spec: CommentCreateSpec) => any) | undefined;
|
|
42
|
+
"onComment:click"?: ((payload: CommentClickPayload) => any) | undefined;
|
|
43
|
+
"onComment:hover"?: ((payload: CommentHoverPayload | null) => any) | undefined;
|
|
44
|
+
"onComment:orphaned"?: ((payload: {
|
|
45
|
+
commentId: string;
|
|
46
|
+
}) => any) | undefined;
|
|
47
|
+
"onComment:anchor-drift"?: ((payload: {
|
|
48
|
+
commentId: string;
|
|
49
|
+
}) => any) | undefined;
|
|
50
|
+
"onAnchors-changed"?: ((anchors: CommentAnchor[]) => any) | undefined;
|
|
51
|
+
"onMention:trigger"?: ((payload: MentionTriggerPayload) => any) | undefined;
|
|
52
|
+
"onMention:cancel"?: (() => any) | undefined;
|
|
53
|
+
}>, {
|
|
54
|
+
getHtml: () => string;
|
|
55
|
+
getMarkdown: () => string;
|
|
56
|
+
setMarkdown: (md: string) => void;
|
|
57
|
+
setHtml: (html: string) => void;
|
|
58
|
+
getEditor: () => Editor | undefined;
|
|
59
|
+
getCommentAnchors: () => CommentAnchor[];
|
|
60
|
+
applyCommentAnchors: (anchors: CommentAnchor[]) => boolean;
|
|
61
|
+
addComment: (commentId: string, spec: AnchorSpec) => boolean;
|
|
62
|
+
removeCommentAnchor: (commentId: string) => boolean;
|
|
63
|
+
getMentions: () => MentionAnchor[];
|
|
64
|
+
applyMentions: (mentions: MentionAnchor[]) => boolean;
|
|
65
|
+
insertMention: (attrs: MentionAttrs) => boolean;
|
|
66
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
67
|
+
"update:markdown": (md: string) => any;
|
|
68
|
+
"update:html": (html: string) => any;
|
|
69
|
+
"comment:create": (spec: CommentCreateSpec) => any;
|
|
70
|
+
"comment:click": (payload: CommentClickPayload) => any;
|
|
71
|
+
"comment:hover": (payload: CommentHoverPayload | null) => any;
|
|
72
|
+
"comment:orphaned": (payload: {
|
|
73
|
+
commentId: string;
|
|
74
|
+
}) => any;
|
|
75
|
+
"comment:anchor-drift": (payload: {
|
|
76
|
+
commentId: string;
|
|
77
|
+
}) => any;
|
|
78
|
+
"anchors-changed": (anchors: CommentAnchor[]) => any;
|
|
79
|
+
"mention:trigger": (payload: MentionTriggerPayload) => any;
|
|
80
|
+
"mention:cancel": () => any;
|
|
81
|
+
}, import('vue').PublicProps, {
|
|
82
|
+
enableComment: boolean;
|
|
83
|
+
initialContent: string;
|
|
84
|
+
}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {
|
|
85
|
+
wrapRef: HTMLDivElement;
|
|
86
|
+
insertBtnRef: HTMLButtonElement;
|
|
87
|
+
pillRef: HTMLDivElement;
|
|
88
|
+
linkToolbarRef: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<{
|
|
89
|
+
editor: Editor | undefined;
|
|
90
|
+
}> & Readonly<{}>, {
|
|
91
|
+
show: (url: string, text: string, anchorRect: DOMRect) => void;
|
|
92
|
+
hide: (immediate?: boolean) => void;
|
|
93
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {
|
|
94
|
+
toolbarEl: HTMLDivElement;
|
|
95
|
+
viewWrapEl: HTMLDivElement;
|
|
96
|
+
editInputEl: HTMLInputElement;
|
|
97
|
+
}, any, import('vue').ComponentProvideOptions, {
|
|
98
|
+
P: {};
|
|
99
|
+
B: {};
|
|
100
|
+
D: {};
|
|
101
|
+
C: {};
|
|
102
|
+
M: {};
|
|
103
|
+
Defaults: {};
|
|
104
|
+
}, Readonly<{
|
|
105
|
+
editor: Editor | undefined;
|
|
106
|
+
}> & Readonly<{}>, {
|
|
107
|
+
show: (url: string, text: string, anchorRect: DOMRect) => void;
|
|
108
|
+
hide: (immediate?: boolean) => void;
|
|
109
|
+
}, {}, {}, {}, {}> | null;
|
|
110
|
+
selToolbarRef: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<{
|
|
111
|
+
editor: Editor | undefined;
|
|
112
|
+
enableComment?: boolean;
|
|
113
|
+
}> & Readonly<{
|
|
114
|
+
onComment?: (() => any) | undefined;
|
|
115
|
+
}>, {
|
|
116
|
+
show: (rect: DOMRect) => void;
|
|
117
|
+
hide: () => void;
|
|
118
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
119
|
+
comment: () => any;
|
|
120
|
+
}, import('vue').PublicProps, {
|
|
121
|
+
enableComment: boolean;
|
|
122
|
+
}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {
|
|
123
|
+
toolbarEl: HTMLDivElement;
|
|
124
|
+
linkInputEl: HTMLInputElement;
|
|
125
|
+
typeWrapEl: HTMLDivElement;
|
|
126
|
+
colorWrapEl: HTMLDivElement;
|
|
127
|
+
}, any, import('vue').ComponentProvideOptions, {
|
|
128
|
+
P: {};
|
|
129
|
+
B: {};
|
|
130
|
+
D: {};
|
|
131
|
+
C: {};
|
|
132
|
+
M: {};
|
|
133
|
+
Defaults: {};
|
|
134
|
+
}, Readonly<{
|
|
135
|
+
editor: Editor | undefined;
|
|
136
|
+
enableComment?: boolean;
|
|
137
|
+
}> & Readonly<{
|
|
138
|
+
onComment?: (() => any) | undefined;
|
|
139
|
+
}>, {
|
|
140
|
+
show: (rect: DOMRect) => void;
|
|
141
|
+
hide: () => void;
|
|
142
|
+
}, {}, {}, {}, {
|
|
143
|
+
enableComment: boolean;
|
|
144
|
+
}> | null;
|
|
145
|
+
}, HTMLDivElement, import('vue').ComponentProvideOptions, {
|
|
146
|
+
P: {};
|
|
147
|
+
B: {};
|
|
148
|
+
D: {};
|
|
149
|
+
C: {};
|
|
150
|
+
M: {};
|
|
151
|
+
Defaults: {};
|
|
152
|
+
}, Readonly<{
|
|
153
|
+
initialContent?: string;
|
|
154
|
+
fileUploadHandler?: FileUploadHandler;
|
|
155
|
+
imageUrlResolver?: ImageUrlResolver;
|
|
156
|
+
enableComment?: boolean;
|
|
157
|
+
}> & Readonly<{
|
|
158
|
+
"onUpdate:markdown"?: ((md: string) => any) | undefined;
|
|
159
|
+
"onUpdate:html"?: ((html: string) => any) | undefined;
|
|
160
|
+
"onComment:create"?: ((spec: CommentCreateSpec) => any) | undefined;
|
|
161
|
+
"onComment:click"?: ((payload: CommentClickPayload) => any) | undefined;
|
|
162
|
+
"onComment:hover"?: ((payload: CommentHoverPayload | null) => any) | undefined;
|
|
163
|
+
"onComment:orphaned"?: ((payload: {
|
|
164
|
+
commentId: string;
|
|
165
|
+
}) => any) | undefined;
|
|
166
|
+
"onComment:anchor-drift"?: ((payload: {
|
|
167
|
+
commentId: string;
|
|
168
|
+
}) => any) | undefined;
|
|
169
|
+
"onAnchors-changed"?: ((anchors: CommentAnchor[]) => any) | undefined;
|
|
170
|
+
"onMention:trigger"?: ((payload: MentionTriggerPayload) => any) | undefined;
|
|
171
|
+
"onMention:cancel"?: (() => any) | undefined;
|
|
172
|
+
}>, {
|
|
173
|
+
getHtml: () => string;
|
|
174
|
+
getMarkdown: () => string;
|
|
175
|
+
setMarkdown: (md: string) => void;
|
|
176
|
+
setHtml: (html: string) => void;
|
|
177
|
+
getEditor: () => Editor | undefined;
|
|
178
|
+
getCommentAnchors: () => CommentAnchor[];
|
|
179
|
+
applyCommentAnchors: (anchors: CommentAnchor[]) => boolean;
|
|
180
|
+
addComment: (commentId: string, spec: AnchorSpec) => boolean;
|
|
181
|
+
removeCommentAnchor: (commentId: string) => boolean;
|
|
182
|
+
getMentions: () => MentionAnchor[];
|
|
183
|
+
applyMentions: (mentions: MentionAnchor[]) => boolean;
|
|
184
|
+
insertMention: (attrs: MentionAttrs) => boolean;
|
|
185
|
+
}, {}, {}, {}, {
|
|
186
|
+
enableComment: boolean;
|
|
187
|
+
initialContent: string;
|
|
188
|
+
}> | null;
|
|
189
|
+
viewerRef: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<{
|
|
190
|
+
content: string;
|
|
191
|
+
format?: "markdown" | "html";
|
|
192
|
+
imageUrlResolver?: ImageUrlResolver;
|
|
193
|
+
}> & Readonly<{}>, {
|
|
194
|
+
getHtml: () => string;
|
|
195
|
+
getMarkdown: () => string;
|
|
196
|
+
setContent: (content: string, format?: "markdown" | "html") => void;
|
|
197
|
+
getEditor: () => Editor | undefined;
|
|
198
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {
|
|
199
|
+
format: "markdown" | "html";
|
|
200
|
+
}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, HTMLDivElement, import('vue').ComponentProvideOptions, {
|
|
201
|
+
P: {};
|
|
202
|
+
B: {};
|
|
203
|
+
D: {};
|
|
204
|
+
C: {};
|
|
205
|
+
M: {};
|
|
206
|
+
Defaults: {};
|
|
207
|
+
}, Readonly<{
|
|
208
|
+
content: string;
|
|
209
|
+
format?: "markdown" | "html";
|
|
210
|
+
imageUrlResolver?: ImageUrlResolver;
|
|
211
|
+
}> & Readonly<{}>, {
|
|
212
|
+
getHtml: () => string;
|
|
213
|
+
getMarkdown: () => string;
|
|
214
|
+
setContent: (content: string, format?: "markdown" | "html") => void;
|
|
215
|
+
getEditor: () => Editor | undefined;
|
|
216
|
+
}, {}, {}, {}, {
|
|
217
|
+
format: "markdown" | "html";
|
|
218
|
+
}> | null;
|
|
219
|
+
};
|
|
220
|
+
rootEl: HTMLDivElement;
|
|
221
|
+
};
|
|
222
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
223
|
+
declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {
|
|
224
|
+
getHtml: typeof getHtml;
|
|
225
|
+
getMarkdown: typeof getMarkdown;
|
|
226
|
+
setMarkdown: typeof setMarkdown;
|
|
227
|
+
setHtml: typeof setHtml;
|
|
228
|
+
setContent: typeof setContent;
|
|
229
|
+
getEditor: typeof getEditor;
|
|
230
|
+
refreshToc: typeof refreshToc;
|
|
231
|
+
getTocItems: () => {
|
|
232
|
+
id: string;
|
|
233
|
+
text: string;
|
|
234
|
+
level: number;
|
|
235
|
+
pos: number;
|
|
236
|
+
}[];
|
|
237
|
+
getCommentAnchors: () => CommentAnchor[];
|
|
238
|
+
applyCommentAnchors: (anchors: CommentAnchor[]) => boolean | undefined;
|
|
239
|
+
addComment: (commentId: string, spec: AnchorSpec) => boolean | undefined;
|
|
240
|
+
removeCommentAnchor: (commentId: string) => boolean | undefined;
|
|
241
|
+
getMentions: () => MentionAnchor[];
|
|
242
|
+
applyMentions: (mentions: MentionAnchor[]) => boolean | undefined;
|
|
243
|
+
insertMention: (attrs: MentionAttrs) => boolean | undefined;
|
|
244
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
245
|
+
"update:markdown": (md: string) => any;
|
|
246
|
+
"update:html": (html: string) => any;
|
|
247
|
+
"comment:create": (spec: CommentCreateSpec) => any;
|
|
248
|
+
"comment:click": (payload: CommentClickPayload) => any;
|
|
249
|
+
"comment:hover": (payload: CommentHoverPayload | null) => any;
|
|
250
|
+
"comment:orphaned": (payload: {
|
|
251
|
+
commentId: string;
|
|
252
|
+
}) => any;
|
|
253
|
+
"comment:anchor-drift": (payload: {
|
|
254
|
+
commentId: string;
|
|
255
|
+
}) => any;
|
|
256
|
+
"anchors-changed": (anchors: CommentAnchor[]) => any;
|
|
257
|
+
"mention:trigger": (payload: MentionTriggerPayload) => any;
|
|
258
|
+
"mention:cancel": () => any;
|
|
259
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
260
|
+
"onUpdate:markdown"?: ((md: string) => any) | undefined;
|
|
261
|
+
"onUpdate:html"?: ((html: string) => any) | undefined;
|
|
262
|
+
"onComment:create"?: ((spec: CommentCreateSpec) => any) | undefined;
|
|
263
|
+
"onComment:click"?: ((payload: CommentClickPayload) => any) | undefined;
|
|
264
|
+
"onComment:hover"?: ((payload: CommentHoverPayload | null) => any) | undefined;
|
|
265
|
+
"onComment:orphaned"?: ((payload: {
|
|
266
|
+
commentId: string;
|
|
267
|
+
}) => any) | undefined;
|
|
268
|
+
"onComment:anchor-drift"?: ((payload: {
|
|
269
|
+
commentId: string;
|
|
270
|
+
}) => any) | undefined;
|
|
271
|
+
"onAnchors-changed"?: ((anchors: CommentAnchor[]) => any) | undefined;
|
|
272
|
+
"onMention:trigger"?: ((payload: MentionTriggerPayload) => any) | undefined;
|
|
273
|
+
"onMention:cancel"?: (() => any) | undefined;
|
|
274
|
+
}>, {
|
|
275
|
+
mode: PagelyPageMode;
|
|
276
|
+
format: PagelyPageFormat;
|
|
277
|
+
content: string;
|
|
278
|
+
enableComment: boolean;
|
|
279
|
+
initialContent: string;
|
|
280
|
+
tocMaxLevel: number;
|
|
281
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
282
|
+
scrollRef: HTMLElement;
|
|
283
|
+
editorRef: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<{
|
|
284
|
+
initialContent?: string;
|
|
285
|
+
fileUploadHandler?: FileUploadHandler;
|
|
286
|
+
imageUrlResolver?: ImageUrlResolver;
|
|
287
|
+
enableComment?: boolean;
|
|
288
|
+
}> & Readonly<{
|
|
289
|
+
"onUpdate:markdown"?: ((md: string) => any) | undefined;
|
|
290
|
+
"onUpdate:html"?: ((html: string) => any) | undefined;
|
|
291
|
+
"onComment:create"?: ((spec: CommentCreateSpec) => any) | undefined;
|
|
292
|
+
"onComment:click"?: ((payload: CommentClickPayload) => any) | undefined;
|
|
293
|
+
"onComment:hover"?: ((payload: CommentHoverPayload | null) => any) | undefined;
|
|
294
|
+
"onComment:orphaned"?: ((payload: {
|
|
295
|
+
commentId: string;
|
|
296
|
+
}) => any) | undefined;
|
|
297
|
+
"onComment:anchor-drift"?: ((payload: {
|
|
298
|
+
commentId: string;
|
|
299
|
+
}) => any) | undefined;
|
|
300
|
+
"onAnchors-changed"?: ((anchors: CommentAnchor[]) => any) | undefined;
|
|
301
|
+
"onMention:trigger"?: ((payload: MentionTriggerPayload) => any) | undefined;
|
|
302
|
+
"onMention:cancel"?: (() => any) | undefined;
|
|
303
|
+
}>, {
|
|
304
|
+
getHtml: () => string;
|
|
305
|
+
getMarkdown: () => string;
|
|
306
|
+
setMarkdown: (md: string) => void;
|
|
307
|
+
setHtml: (html: string) => void;
|
|
308
|
+
getEditor: () => Editor | undefined;
|
|
309
|
+
getCommentAnchors: () => CommentAnchor[];
|
|
310
|
+
applyCommentAnchors: (anchors: CommentAnchor[]) => boolean;
|
|
311
|
+
addComment: (commentId: string, spec: AnchorSpec) => boolean;
|
|
312
|
+
removeCommentAnchor: (commentId: string) => boolean;
|
|
313
|
+
getMentions: () => MentionAnchor[];
|
|
314
|
+
applyMentions: (mentions: MentionAnchor[]) => boolean;
|
|
315
|
+
insertMention: (attrs: MentionAttrs) => boolean;
|
|
316
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
317
|
+
"update:markdown": (md: string) => any;
|
|
318
|
+
"update:html": (html: string) => any;
|
|
319
|
+
"comment:create": (spec: CommentCreateSpec) => any;
|
|
320
|
+
"comment:click": (payload: CommentClickPayload) => any;
|
|
321
|
+
"comment:hover": (payload: CommentHoverPayload | null) => any;
|
|
322
|
+
"comment:orphaned": (payload: {
|
|
323
|
+
commentId: string;
|
|
324
|
+
}) => any;
|
|
325
|
+
"comment:anchor-drift": (payload: {
|
|
326
|
+
commentId: string;
|
|
327
|
+
}) => any;
|
|
328
|
+
"anchors-changed": (anchors: CommentAnchor[]) => any;
|
|
329
|
+
"mention:trigger": (payload: MentionTriggerPayload) => any;
|
|
330
|
+
"mention:cancel": () => any;
|
|
331
|
+
}, import('vue').PublicProps, {
|
|
332
|
+
enableComment: boolean;
|
|
333
|
+
initialContent: string;
|
|
334
|
+
}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {
|
|
335
|
+
wrapRef: HTMLDivElement;
|
|
336
|
+
insertBtnRef: HTMLButtonElement;
|
|
337
|
+
pillRef: HTMLDivElement;
|
|
338
|
+
linkToolbarRef: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<{
|
|
339
|
+
editor: Editor | undefined;
|
|
340
|
+
}> & Readonly<{}>, {
|
|
341
|
+
show: (url: string, text: string, anchorRect: DOMRect) => void;
|
|
342
|
+
hide: (immediate?: boolean) => void;
|
|
343
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {
|
|
344
|
+
toolbarEl: HTMLDivElement;
|
|
345
|
+
viewWrapEl: HTMLDivElement;
|
|
346
|
+
editInputEl: HTMLInputElement;
|
|
347
|
+
}, any, import('vue').ComponentProvideOptions, {
|
|
348
|
+
P: {};
|
|
349
|
+
B: {};
|
|
350
|
+
D: {};
|
|
351
|
+
C: {};
|
|
352
|
+
M: {};
|
|
353
|
+
Defaults: {};
|
|
354
|
+
}, Readonly<{
|
|
355
|
+
editor: Editor | undefined;
|
|
356
|
+
}> & Readonly<{}>, {
|
|
357
|
+
show: (url: string, text: string, anchorRect: DOMRect) => void;
|
|
358
|
+
hide: (immediate?: boolean) => void;
|
|
359
|
+
}, {}, {}, {}, {}> | null;
|
|
360
|
+
selToolbarRef: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<{
|
|
361
|
+
editor: Editor | undefined;
|
|
362
|
+
enableComment?: boolean;
|
|
363
|
+
}> & Readonly<{
|
|
364
|
+
onComment?: (() => any) | undefined;
|
|
365
|
+
}>, {
|
|
366
|
+
show: (rect: DOMRect) => void;
|
|
367
|
+
hide: () => void;
|
|
368
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
369
|
+
comment: () => any;
|
|
370
|
+
}, import('vue').PublicProps, {
|
|
371
|
+
enableComment: boolean;
|
|
372
|
+
}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {
|
|
373
|
+
toolbarEl: HTMLDivElement;
|
|
374
|
+
linkInputEl: HTMLInputElement;
|
|
375
|
+
typeWrapEl: HTMLDivElement;
|
|
376
|
+
colorWrapEl: HTMLDivElement;
|
|
377
|
+
}, any, import('vue').ComponentProvideOptions, {
|
|
378
|
+
P: {};
|
|
379
|
+
B: {};
|
|
380
|
+
D: {};
|
|
381
|
+
C: {};
|
|
382
|
+
M: {};
|
|
383
|
+
Defaults: {};
|
|
384
|
+
}, Readonly<{
|
|
385
|
+
editor: Editor | undefined;
|
|
386
|
+
enableComment?: boolean;
|
|
387
|
+
}> & Readonly<{
|
|
388
|
+
onComment?: (() => any) | undefined;
|
|
389
|
+
}>, {
|
|
390
|
+
show: (rect: DOMRect) => void;
|
|
391
|
+
hide: () => void;
|
|
392
|
+
}, {}, {}, {}, {
|
|
393
|
+
enableComment: boolean;
|
|
394
|
+
}> | null;
|
|
395
|
+
}, HTMLDivElement, import('vue').ComponentProvideOptions, {
|
|
396
|
+
P: {};
|
|
397
|
+
B: {};
|
|
398
|
+
D: {};
|
|
399
|
+
C: {};
|
|
400
|
+
M: {};
|
|
401
|
+
Defaults: {};
|
|
402
|
+
}, Readonly<{
|
|
403
|
+
initialContent?: string;
|
|
404
|
+
fileUploadHandler?: FileUploadHandler;
|
|
405
|
+
imageUrlResolver?: ImageUrlResolver;
|
|
406
|
+
enableComment?: boolean;
|
|
407
|
+
}> & Readonly<{
|
|
408
|
+
"onUpdate:markdown"?: ((md: string) => any) | undefined;
|
|
409
|
+
"onUpdate:html"?: ((html: string) => any) | undefined;
|
|
410
|
+
"onComment:create"?: ((spec: CommentCreateSpec) => any) | undefined;
|
|
411
|
+
"onComment:click"?: ((payload: CommentClickPayload) => any) | undefined;
|
|
412
|
+
"onComment:hover"?: ((payload: CommentHoverPayload | null) => any) | undefined;
|
|
413
|
+
"onComment:orphaned"?: ((payload: {
|
|
414
|
+
commentId: string;
|
|
415
|
+
}) => any) | undefined;
|
|
416
|
+
"onComment:anchor-drift"?: ((payload: {
|
|
417
|
+
commentId: string;
|
|
418
|
+
}) => any) | undefined;
|
|
419
|
+
"onAnchors-changed"?: ((anchors: CommentAnchor[]) => any) | undefined;
|
|
420
|
+
"onMention:trigger"?: ((payload: MentionTriggerPayload) => any) | undefined;
|
|
421
|
+
"onMention:cancel"?: (() => any) | undefined;
|
|
422
|
+
}>, {
|
|
423
|
+
getHtml: () => string;
|
|
424
|
+
getMarkdown: () => string;
|
|
425
|
+
setMarkdown: (md: string) => void;
|
|
426
|
+
setHtml: (html: string) => void;
|
|
427
|
+
getEditor: () => Editor | undefined;
|
|
428
|
+
getCommentAnchors: () => CommentAnchor[];
|
|
429
|
+
applyCommentAnchors: (anchors: CommentAnchor[]) => boolean;
|
|
430
|
+
addComment: (commentId: string, spec: AnchorSpec) => boolean;
|
|
431
|
+
removeCommentAnchor: (commentId: string) => boolean;
|
|
432
|
+
getMentions: () => MentionAnchor[];
|
|
433
|
+
applyMentions: (mentions: MentionAnchor[]) => boolean;
|
|
434
|
+
insertMention: (attrs: MentionAttrs) => boolean;
|
|
435
|
+
}, {}, {}, {}, {
|
|
436
|
+
enableComment: boolean;
|
|
437
|
+
initialContent: string;
|
|
438
|
+
}> | null;
|
|
439
|
+
viewerRef: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<{
|
|
440
|
+
content: string;
|
|
441
|
+
format?: "markdown" | "html";
|
|
442
|
+
imageUrlResolver?: ImageUrlResolver;
|
|
443
|
+
}> & Readonly<{}>, {
|
|
444
|
+
getHtml: () => string;
|
|
445
|
+
getMarkdown: () => string;
|
|
446
|
+
setContent: (content: string, format?: "markdown" | "html") => void;
|
|
447
|
+
getEditor: () => Editor | undefined;
|
|
448
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {
|
|
449
|
+
format: "markdown" | "html";
|
|
450
|
+
}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, HTMLDivElement, import('vue').ComponentProvideOptions, {
|
|
451
|
+
P: {};
|
|
452
|
+
B: {};
|
|
453
|
+
D: {};
|
|
454
|
+
C: {};
|
|
455
|
+
M: {};
|
|
456
|
+
Defaults: {};
|
|
457
|
+
}, Readonly<{
|
|
458
|
+
content: string;
|
|
459
|
+
format?: "markdown" | "html";
|
|
460
|
+
imageUrlResolver?: ImageUrlResolver;
|
|
461
|
+
}> & Readonly<{}>, {
|
|
462
|
+
getHtml: () => string;
|
|
463
|
+
getMarkdown: () => string;
|
|
464
|
+
setContent: (content: string, format?: "markdown" | "html") => void;
|
|
465
|
+
getEditor: () => Editor | undefined;
|
|
466
|
+
}, {}, {}, {}, {
|
|
467
|
+
format: "markdown" | "html";
|
|
468
|
+
}> | null;
|
|
469
|
+
}, HTMLDivElement>;
|
|
470
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
471
|
+
export default _default;
|
|
472
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
473
|
+
new (): {
|
|
474
|
+
$slots: S;
|
|
475
|
+
};
|
|
476
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { PagelyTocItem } from '../composables/usePagelyToc';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
items: PagelyTocItem[];
|
|
4
|
+
activeId?: string;
|
|
5
|
+
collapsed?: boolean;
|
|
6
|
+
};
|
|
7
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
8
|
+
"update:collapsed": (collapsed: boolean) => any;
|
|
9
|
+
"item-click": (item: PagelyTocItem) => any;
|
|
10
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
11
|
+
"onUpdate:collapsed"?: ((collapsed: boolean) => any) | undefined;
|
|
12
|
+
"onItem-click"?: ((item: PagelyTocItem) => any) | undefined;
|
|
13
|
+
}>, {
|
|
14
|
+
collapsed: boolean;
|
|
15
|
+
activeId: string;
|
|
16
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLElement>;
|
|
17
|
+
export default _default;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Editor } from '@tiptap/vue-3';
|
|
2
|
+
import { ImageUrlResolver } from '../extensions/Image';
|
|
2
3
|
type ViewerFormat = 'html' | 'markdown';
|
|
3
4
|
type __VLS_Props = {
|
|
4
5
|
content: string;
|
|
5
6
|
format?: ViewerFormat;
|
|
7
|
+
imageUrlResolver?: ImageUrlResolver;
|
|
6
8
|
};
|
|
7
9
|
declare const _default: import('vue').DefineComponent<__VLS_Props, {
|
|
8
10
|
getHtml: () => string;
|
|
@@ -3,11 +3,16 @@ export declare const IMAGE_FILE_ACCEPT = "image/*,.png,.jpg,.jpeg,.gif,.webp,.bm
|
|
|
3
3
|
export { DEFAULT_ATTACHMENT_ACCEPT, defaultAttachmentUpload, type FileUploadHandler, type FileUploadResult, };
|
|
4
4
|
export interface ImageFilePayload {
|
|
5
5
|
src: string;
|
|
6
|
-
|
|
6
|
+
attachmentId?: string | number | null;
|
|
7
|
+
fileName?: string | null;
|
|
8
|
+
mimeType?: string | null;
|
|
9
|
+
alt?: string | null;
|
|
10
|
+
title?: string | null;
|
|
7
11
|
}
|
|
8
12
|
export interface UseImageFileUploadOptions {
|
|
9
13
|
onBeforeSelect?: () => void;
|
|
10
14
|
onInsert: (payload: ImageFilePayload) => void;
|
|
15
|
+
uploadHandler?: FileUploadHandler;
|
|
11
16
|
}
|
|
12
17
|
export interface UseDocFileUploadOptions {
|
|
13
18
|
onBeforeSelect?: () => void;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Ref } from 'vue';
|
|
2
2
|
import { Editor } from '@tiptap/vue-3';
|
|
3
3
|
import { Extension } from '@tiptap/core';
|
|
4
|
-
import { DecorationSet } from '
|
|
5
|
-
import { PluginKey } from '
|
|
4
|
+
import { DecorationSet } from '@tiptap/pm/view';
|
|
5
|
+
import { PluginKey } from '@tiptap/pm/state';
|
|
6
6
|
interface CollapseState {
|
|
7
7
|
collapsed: Set<number>;
|
|
8
8
|
decorations: DecorationSet;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Ref } from 'vue';
|
|
2
2
|
import { Content, Extension } from '@tiptap/core';
|
|
3
|
+
import { ImageUrlResolver } from '../extensions/Image';
|
|
3
4
|
import { ExtensionProfile } from '../config/extensionProfiles';
|
|
4
5
|
import { FileUploadHandler } from '../utils/attachmentUpload';
|
|
5
6
|
export interface UsePagelyEditorOptions {
|
|
@@ -13,5 +14,6 @@ export interface UsePagelyEditorOptions {
|
|
|
13
14
|
onOpenMathPopover?: (node: unknown, pos: number, kind: 'inline' | 'block') => void;
|
|
14
15
|
onOpenSlashInsert?: (blockPos: number, rect: DOMRect) => void;
|
|
15
16
|
fileUploadHandler?: FileUploadHandler;
|
|
17
|
+
imageUrlResolver?: ImageUrlResolver;
|
|
16
18
|
}
|
|
17
19
|
export declare function usePagelyEditor(options: UsePagelyEditorOptions): import('vue').ShallowRef<import('@tiptap/vue-3').Editor | undefined, import('@tiptap/vue-3').Editor | undefined>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ComputedRef, Ref } from 'vue';
|
|
2
|
+
import { Editor } from '@tiptap/vue-3';
|
|
3
|
+
type MaybeRef<T> = T | Ref<T> | ComputedRef<T>;
|
|
4
|
+
export interface PagelyTocItem {
|
|
5
|
+
id: string;
|
|
6
|
+
text: string;
|
|
7
|
+
level: number;
|
|
8
|
+
pos: number;
|
|
9
|
+
}
|
|
10
|
+
export interface PagelyTocExtractOptions {
|
|
11
|
+
minLevel?: number;
|
|
12
|
+
maxLevel?: number;
|
|
13
|
+
}
|
|
14
|
+
export interface PagelyTocSourceNode {
|
|
15
|
+
type: {
|
|
16
|
+
name: string;
|
|
17
|
+
};
|
|
18
|
+
attrs?: Record<string, unknown>;
|
|
19
|
+
textContent?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface PagelyTocSourceDoc {
|
|
22
|
+
descendants: (callback: (node: PagelyTocSourceNode, pos: number) => boolean | void) => void;
|
|
23
|
+
}
|
|
24
|
+
export interface UsePagelyTocOptions extends PagelyTocExtractOptions {
|
|
25
|
+
scrollContainer?: MaybeRef<HTMLElement | Window | null | undefined>;
|
|
26
|
+
scrollOffset?: MaybeRef<number | undefined>;
|
|
27
|
+
activeOffset?: MaybeRef<number | undefined>;
|
|
28
|
+
behavior?: MaybeRef<ScrollBehavior | undefined>;
|
|
29
|
+
}
|
|
30
|
+
export declare function slugifyTocId(value: string, fallback?: string): string;
|
|
31
|
+
export declare function extractPagelyTocItemsFromDoc(doc: PagelyTocSourceDoc, options?: PagelyTocExtractOptions): PagelyTocItem[];
|
|
32
|
+
export declare function extractPagelyTocItems(editor: Editor | null | undefined, options?: PagelyTocExtractOptions): PagelyTocItem[];
|
|
33
|
+
export declare function usePagelyToc(editorSource: MaybeRef<Editor | null | undefined>, options?: UsePagelyTocOptions): {
|
|
34
|
+
items: Ref<{
|
|
35
|
+
id: string;
|
|
36
|
+
text: string;
|
|
37
|
+
level: number;
|
|
38
|
+
pos: number;
|
|
39
|
+
}[], PagelyTocItem[] | {
|
|
40
|
+
id: string;
|
|
41
|
+
text: string;
|
|
42
|
+
level: number;
|
|
43
|
+
pos: number;
|
|
44
|
+
}[]>;
|
|
45
|
+
activeId: Ref<string, string>;
|
|
46
|
+
refresh: () => void;
|
|
47
|
+
scrollToItem: (item: PagelyTocItem) => void;
|
|
48
|
+
updateActiveFromScroll: () => void;
|
|
49
|
+
};
|
|
50
|
+
export {};
|