forked from editor-js/embed
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
128 lines (104 loc) · 2.48 KB
/
index.d.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
import type {
BlockTune,
BlockTool,
BlockToolConstructable,
BlockToolConstructorOptions
} from '@editorjs/editorjs'
type WritableKeysOf<T> = {
[P in keyof T]: T[P] extends () => void ? never : P
}[keyof T]
export type EmbedData = {
service: keyof EmbedConfig['services']
source: string
embed: string
width?: number
height?: number
}
type Service = {
name: string
regex: RegExp
embedUrl: string
html: string
height?: number
width?: number
id?: (groups: string[]) => string | null
}
export type EmbedConfig = {
services?: {
facebook?: boolean
instagram?: boolean
youtube?: boolean
twitter?: boolean
'twitch-video'?: boolean
'twitch-channel'?: boolean
miro?: boolean
vimeo?: boolean
gfycat?: boolean
imgur?: boolean
vine?: boolean
aparat?: boolean
'yandex-music-track'?: boolean
'yandex-music-album'?: boolean
'yandex-music-playlist'?: boolean
coub?: boolean
codepen?: boolean
pinterest?: boolean
github?: boolean
}
}
declare class Embed implements BlockToolConstructable {
static services:
| {
[key in keyof EmbedConfig['services']]: Service
}
| undefined
new(
config: BlockToolConstructorOptions<
EmbedData,
EmbedConfig
>,
): BlockTool
set data(data: EmbedData | undefined)
get data(): EmbedData | undefined
private get CSS(): {
baseClass: string
input: string
container: string
inputEl: string
inputHolder: string
inputError: string
linkContent: string
linkContentRendered: string
linkImage: string
linkTitle: string
linkDescription: string
linkText: string
progress: string
progressLoading: string
progressLoaded: string
caption: string
content: string
}
render(): HTMLElement
private makeEmbed(): HTMLElement | null
private embedIsReady(targetNode: HTMLElement): Promise<void>
private makeInputHolder(): HTMLElement
private setData(text: string)
static prepare(props: { toolName: string, config: EmbedConfig }): void
static checkServiceConfig(config: Service): boolean
save(): ImageData
static get toolbox(): {
icon: string
title: string
}
private showProgress(): void
private hideProgress(): Promise<void>
private make(
tagName: string,
classNames?: string | string[],
attributes?: {
[key in keyof WritableKeysOf<HTMLElement>]: HTMLElement[keyof HTMLElement]
},
): HTMLElement
static get enableLineBreaks(): boolean
}