-
Notifications
You must be signed in to change notification settings - Fork 147
/
BeforePasteEvent.ts
61 lines (52 loc) · 1.86 KB
/
BeforePasteEvent.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
import type BasePluginEvent from './BasePluginEvent';
import type ClipboardData from '../interface/ClipboardData';
import type HtmlSanitizerOptions from '../interface/HtmlSanitizerOptions';
import type { PluginEventType } from '../enum/PluginEventType';
import type { CompatiblePasteType } from '../compatibleEnum/PasteType';
import type { PasteType } from '../enum/PasteType';
import type { CompatiblePluginEventType } from '../compatibleEnum/PluginEventType';
/**
* Data of BeforePasteEvent
*/
export interface BeforePasteEventData {
/**
* An object contains all related data for pasting
*/
clipboardData: ClipboardData;
/**
* HTML Document Fragment which will be inserted into content
*/
fragment: DocumentFragment;
/**
* Html sanitizing options. This will be used for sanitizing the html content before paste
*/
sanitizingOption: Required<HtmlSanitizerOptions>;
/**
* Stripped HTML string before "StartFragment" comment
*/
htmlBefore: string;
/**
* Stripped HTML string after "EndFragment" comment
*/
htmlAfter: string;
/**
* Attributes of the root "HTML" tag
*/
htmlAttributes: Record<string, string>;
/**
* Paste type option (as plain text, merge format, normal, as image)
*/
readonly pasteType: PasteType | CompatiblePasteType;
}
/**
* Provides a chance for plugin to change the content before it is pasted into editor.
*/
export default interface BeforePasteEvent
extends BeforePasteEventData,
BasePluginEvent<PluginEventType.BeforePaste> {}
/**
* Provides a chance for plugin to change the content before it is pasted into editor.
*/
export interface CompatibleBeforePasteEvent
extends BeforePasteEventData,
BasePluginEvent<CompatiblePluginEventType.BeforePaste> {}