-
-
Notifications
You must be signed in to change notification settings - Fork 432
/
Copy pathconfig.ts
33 lines (29 loc) · 998 Bytes
/
config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { $ctx } from '@milkdown/utils'
import { withMeta } from '../__internal__/meta'
export interface ImageBlockConfig {
imageIcon: () => string | undefined
captionIcon: () => string | undefined
uploadButton: () => string | undefined
confirmButton: () => string | undefined
uploadPlaceholderText: string
captionPlaceholderText: string
onUpload: (file: File) => Promise<string>
proxyDomURL?: (url: string) => Promise<string> | string
}
export const defaultImageBlockConfig: ImageBlockConfig = {
imageIcon: () => '🌌',
captionIcon: () => '💬',
uploadButton: () => 'Upload file',
confirmButton: () => 'Confirm ⏎',
uploadPlaceholderText: 'or paste the image link ...',
captionPlaceholderText: 'Image caption',
onUpload: (file) => Promise.resolve(URL.createObjectURL(file)),
}
export const imageBlockConfig = $ctx(
defaultImageBlockConfig,
'imageBlockConfigCtx'
)
withMeta(imageBlockConfig, {
displayName: 'Config<image-block>',
group: 'ImageBlock',
})