@ckeditor/ckeditor5-clipboard 38.1.0 → 38.1.1
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/package.json +6 -6
- package/src/augmentation.d.ts +16 -16
- package/src/augmentation.js +5 -5
- package/src/clipboard.d.ts +31 -31
- package/src/clipboard.js +35 -35
- package/src/clipboardobserver.d.ts +312 -312
- package/src/clipboardobserver.js +94 -94
- package/src/clipboardpipeline.d.ts +221 -221
- package/src/clipboardpipeline.js +245 -245
- package/src/dragdrop.d.ts +100 -100
- package/src/dragdrop.js +655 -655
- package/src/dragdropblocktoolbar.d.ts +47 -47
- package/src/dragdropblocktoolbar.js +114 -114
- package/src/dragdropexperimental.d.ts +101 -101
- package/src/dragdropexperimental.js +522 -522
- package/src/dragdroptarget.d.ts +94 -94
- package/src/dragdroptarget.js +362 -362
- package/src/index.d.ts +17 -17
- package/src/index.js +15 -15
- package/src/lineview.d.ts +45 -45
- package/src/lineview.js +44 -44
- package/src/pasteplaintext.d.ts +28 -28
- package/src/pasteplaintext.js +82 -82
- package/src/utils/normalizeclipboarddata.d.ts +15 -15
- package/src/utils/normalizeclipboarddata.js +27 -27
- package/src/utils/plaintexttohtml.d.ts +14 -14
- package/src/utils/plaintexttohtml.js +37 -37
- package/src/utils/viewtoplaintext.d.ts +15 -15
- package/src/utils/viewtoplaintext.js +50 -50
|
@@ -1,312 +1,312 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
import { DataTransfer, DomEventObserver, type DomEventData, type View, type ViewDocumentFragment, type ViewElement, type ViewRange } from '@ckeditor/ckeditor5-engine';
|
|
6
|
-
/**
|
|
7
|
-
* Clipboard events observer.
|
|
8
|
-
*
|
|
9
|
-
* Fires the following events:
|
|
10
|
-
*
|
|
11
|
-
* * {@link module:engine/view/document~Document#event:clipboardInput},
|
|
12
|
-
* * {@link module:engine/view/document~Document#event:paste},
|
|
13
|
-
* * {@link module:engine/view/document~Document#event:copy},
|
|
14
|
-
* * {@link module:engine/view/document~Document#event:cut},
|
|
15
|
-
* * {@link module:engine/view/document~Document#event:drop},
|
|
16
|
-
* * {@link module:engine/view/document~Document#event:dragover},
|
|
17
|
-
* * {@link module:engine/view/document~Document#event:dragging},
|
|
18
|
-
* * {@link module:engine/view/document~Document#event:dragstart},
|
|
19
|
-
* * {@link module:engine/view/document~Document#event:dragend},
|
|
20
|
-
* * {@link module:engine/view/document~Document#event:dragenter},
|
|
21
|
-
* * {@link module:engine/view/document~Document#event:dragleave}.
|
|
22
|
-
*
|
|
23
|
-
* **Note**: This observer is not available by default (ckeditor5-engine does not add it on its own).
|
|
24
|
-
* To make it available, it needs to be added to {@link module:engine/view/document~Document} by using
|
|
25
|
-
* the {@link module:engine/view/view~View#addObserver `View#addObserver()`} method. Alternatively, you can load the
|
|
26
|
-
* {@link module:clipboard/clipboard~Clipboard} plugin which adds this observer automatically (because it uses it).
|
|
27
|
-
*/
|
|
28
|
-
export default class ClipboardObserver extends DomEventObserver<'paste' | 'copy' | 'cut' | 'drop' | 'dragover' | 'dragstart' | 'dragend' | 'dragenter' | 'dragleave', ClipboardEventData> {
|
|
29
|
-
readonly domEventType: readonly ["paste", "copy", "cut", "drop", "dragover", "dragstart", "dragend", "dragenter", "dragleave"];
|
|
30
|
-
constructor(view: View);
|
|
31
|
-
onDomEvent(domEvent: ClipboardEvent | DragEvent): void;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* The data of 'paste', 'copy', 'cut', 'drop', 'dragover', 'dragstart', 'dragend', 'dragenter' and 'dragleave' events.
|
|
35
|
-
*/
|
|
36
|
-
export interface ClipboardEventData {
|
|
37
|
-
/**
|
|
38
|
-
* The data transfer instance.
|
|
39
|
-
*/
|
|
40
|
-
dataTransfer: DataTransfer;
|
|
41
|
-
/**
|
|
42
|
-
* The position into which the content is dropped.
|
|
43
|
-
*/
|
|
44
|
-
dropRange?: ViewRange | null;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Fired as a continuation of the {@link module:engine/view/document~Document#event:paste} and
|
|
48
|
-
* {@link module:engine/view/document~Document#event:drop} events.
|
|
49
|
-
*
|
|
50
|
-
* It is a part of the {@glink framework/deep-dive/clipboard#input-pipeline clipboard input pipeline}.
|
|
51
|
-
*
|
|
52
|
-
* This event carries a `dataTransfer` object which comes from the clipboard and whose content should be processed
|
|
53
|
-
* and inserted into the editor.
|
|
54
|
-
*
|
|
55
|
-
* **Note**: This event is not available by default. To make it available, {@link module:clipboard/clipboardobserver~ClipboardObserver}
|
|
56
|
-
* needs to be added to the {@link module:engine/view/document~Document} by using the {@link module:engine/view/view~View#addObserver}
|
|
57
|
-
* method. This is usually done by the {@link module:clipboard/clipboard~Clipboard} plugin, but if for some reason it is not loaded,
|
|
58
|
-
* the observer must be added manually.
|
|
59
|
-
*
|
|
60
|
-
* @see module:clipboard/clipboardobserver~ClipboardObserver
|
|
61
|
-
* @see module:clipboard/clipboard~Clipboard
|
|
62
|
-
*
|
|
63
|
-
* @eventName module:engine/view/document~Document#clipboardInput
|
|
64
|
-
* @param data The event data.
|
|
65
|
-
*/
|
|
66
|
-
export type ViewDocumentClipboardInputEvent = {
|
|
67
|
-
name: 'clipboardInput';
|
|
68
|
-
args: [data: DomEventData<ClipboardEvent | DragEvent> & ClipboardInputEventData];
|
|
69
|
-
};
|
|
70
|
-
/**
|
|
71
|
-
* The value of the {@link module:engine/view/document~Document#event:paste},
|
|
72
|
-
* {@link module:engine/view/document~Document#event:copy} and {@link module:engine/view/document~Document#event:cut} events.
|
|
73
|
-
*
|
|
74
|
-
* In order to access the clipboard data, use the `dataTransfer` property.
|
|
75
|
-
*/
|
|
76
|
-
export interface ClipboardInputEventData {
|
|
77
|
-
/**
|
|
78
|
-
* Data transfer instance.
|
|
79
|
-
*/
|
|
80
|
-
dataTransfer: DataTransfer;
|
|
81
|
-
/**
|
|
82
|
-
* Whether the event was triggered by a paste or a drop operation.
|
|
83
|
-
*/
|
|
84
|
-
method: 'paste' | 'drop';
|
|
85
|
-
/**
|
|
86
|
-
* The tree view element representing the target.
|
|
87
|
-
*/
|
|
88
|
-
target: ViewElement;
|
|
89
|
-
/**
|
|
90
|
-
* The ranges which are the target of the operation (usually – into which the content should be inserted).
|
|
91
|
-
* If the clipboard input was triggered by a paste operation, this property is not set. If by a drop operation,
|
|
92
|
-
* then it is the drop position (which can be different than the selection at the moment of the drop).
|
|
93
|
-
*/
|
|
94
|
-
targetRanges: Array<ViewRange> | null;
|
|
95
|
-
/**
|
|
96
|
-
* The content of clipboard input.
|
|
97
|
-
*/
|
|
98
|
-
content?: ViewDocumentFragment;
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Fired when the user drags the content over one of the editing roots of the editor.
|
|
102
|
-
*
|
|
103
|
-
* Introduced by {@link module:clipboard/clipboardobserver~ClipboardObserver}.
|
|
104
|
-
*
|
|
105
|
-
* **Note**: This event is not available by default. To make it available, {@link module:clipboard/clipboardobserver~ClipboardObserver}
|
|
106
|
-
* needs to be added to the {@link module:engine/view/document~Document} by using the {@link module:engine/view/view~View#addObserver}
|
|
107
|
-
* method. This is usually done by the {@link module:clipboard/clipboard~Clipboard} plugin, but if for some reason it is not loaded,
|
|
108
|
-
* the observer must be added manually.
|
|
109
|
-
*
|
|
110
|
-
* @see module:engine/view/document~Document#event:clipboardInput
|
|
111
|
-
*
|
|
112
|
-
* @eventName module:engine/view/document~Document#dragover
|
|
113
|
-
* @param data The event data.
|
|
114
|
-
*/
|
|
115
|
-
export type ViewDocumentDragOverEvent = {
|
|
116
|
-
name: 'dragover';
|
|
117
|
-
args: [data: DomEventData<DragEvent> & ClipboardEventData];
|
|
118
|
-
};
|
|
119
|
-
/**
|
|
120
|
-
* Fired when the user dropped the content into one of the editing roots of the editor.
|
|
121
|
-
*
|
|
122
|
-
* Introduced by {@link module:clipboard/clipboardobserver~ClipboardObserver}.
|
|
123
|
-
*
|
|
124
|
-
* **Note**: This event is not available by default. To make it available, {@link module:clipboard/clipboardobserver~ClipboardObserver}
|
|
125
|
-
* needs to be added to the {@link module:engine/view/document~Document} by using the {@link module:engine/view/view~View#addObserver}
|
|
126
|
-
* method. This is usually done by the {@link module:clipboard/clipboard~Clipboard} plugin, but if for some reason it is not loaded,
|
|
127
|
-
* the observer must be added manually.
|
|
128
|
-
*
|
|
129
|
-
* @see module:engine/view/document~Document#event:clipboardInput
|
|
130
|
-
*
|
|
131
|
-
* @eventName module:engine/view/document~Document#drop
|
|
132
|
-
* @param data The event data.
|
|
133
|
-
*/
|
|
134
|
-
export type ViewDocumentDropEvent = {
|
|
135
|
-
name: 'drop';
|
|
136
|
-
args: [data: DomEventData<DragEvent> & ClipboardEventData];
|
|
137
|
-
};
|
|
138
|
-
/**
|
|
139
|
-
* Fired when the user pasted the content into one of the editing roots of the editor.
|
|
140
|
-
*
|
|
141
|
-
* Introduced by {@link module:clipboard/clipboardobserver~ClipboardObserver}.
|
|
142
|
-
*
|
|
143
|
-
* **Note**: This event is not available by default. To make it available, {@link module:clipboard/clipboardobserver~ClipboardObserver}
|
|
144
|
-
* needs to be added to the {@link module:engine/view/document~Document} by using the {@link module:engine/view/view~View#addObserver}
|
|
145
|
-
* method. This is usually done by the {@link module:clipboard/clipboard~Clipboard} plugin, but if for some reason it is not loaded,
|
|
146
|
-
* the observer must be added manually.
|
|
147
|
-
*
|
|
148
|
-
* @see module:engine/view/document~Document#event:clipboardInput
|
|
149
|
-
*
|
|
150
|
-
* @eventName module:engine/view/document~Document#paste
|
|
151
|
-
* @param {module:clipboard/clipboardobserver~ClipboardEventData} data The event data.
|
|
152
|
-
*/
|
|
153
|
-
export type ViewDocumentPasteEvent = {
|
|
154
|
-
name: 'paste';
|
|
155
|
-
args: [data: DomEventData<ClipboardEvent> & ClipboardEventData];
|
|
156
|
-
};
|
|
157
|
-
/**
|
|
158
|
-
* Fired when the user copied the content from one of the editing roots of the editor.
|
|
159
|
-
*
|
|
160
|
-
* Introduced by {@link module:clipboard/clipboardobserver~ClipboardObserver}.
|
|
161
|
-
*
|
|
162
|
-
* **Note**: This event is not available by default. To make it available, {@link module:clipboard/clipboardobserver~ClipboardObserver}
|
|
163
|
-
* needs to be added to the {@link module:engine/view/document~Document} by using the {@link module:engine/view/view~View#addObserver}
|
|
164
|
-
* method. This is usually done by the {@link module:clipboard/clipboard~Clipboard} plugin, but if for some reason it is not loaded,
|
|
165
|
-
* the observer must be added manually.
|
|
166
|
-
*
|
|
167
|
-
* @see module:clipboard/clipboardobserver~ClipboardObserver
|
|
168
|
-
*
|
|
169
|
-
* @eventName module:engine/view/document~Document#copy
|
|
170
|
-
* @param data The event data.
|
|
171
|
-
*/
|
|
172
|
-
export type ViewDocumentCopyEvent = {
|
|
173
|
-
name: 'copy';
|
|
174
|
-
args: [data: DomEventData<ClipboardEvent> & ClipboardEventData];
|
|
175
|
-
};
|
|
176
|
-
/**
|
|
177
|
-
* Fired when the user cut the content from one of the editing roots of the editor.
|
|
178
|
-
*
|
|
179
|
-
* Introduced by {@link module:clipboard/clipboardobserver~ClipboardObserver}.
|
|
180
|
-
*
|
|
181
|
-
* **Note**: This event is not available by default. To make it available, {@link module:clipboard/clipboardobserver~ClipboardObserver}
|
|
182
|
-
* needs to be added to the {@link module:engine/view/document~Document} by using the {@link module:engine/view/view~View#addObserver}
|
|
183
|
-
* method. This is usually done by the {@link module:clipboard/clipboard~Clipboard} plugin, but if for some reason it is not loaded,
|
|
184
|
-
* the observer must be added manually.
|
|
185
|
-
*
|
|
186
|
-
* @see module:clipboard/clipboardobserver~ClipboardObserver
|
|
187
|
-
*
|
|
188
|
-
* @eventName module:engine/view/document~Document#cut
|
|
189
|
-
* @param data The event data.
|
|
190
|
-
*/
|
|
191
|
-
export type ViewDocumentCutEvent = {
|
|
192
|
-
name: 'cut';
|
|
193
|
-
args: [data: DomEventData<ClipboardEvent> & ClipboardEventData];
|
|
194
|
-
};
|
|
195
|
-
/**
|
|
196
|
-
* Fired as a continuation of the {@link module:engine/view/document~Document#event:dragover} event.
|
|
197
|
-
*
|
|
198
|
-
* It is a part of the {@glink framework/deep-dive/clipboard#input-pipeline clipboard input pipeline}.
|
|
199
|
-
*
|
|
200
|
-
* This event carries a `dataTransfer` object which comes from the clipboard and whose content should be processed
|
|
201
|
-
* and inserted into the editor.
|
|
202
|
-
*
|
|
203
|
-
* **Note**: This event is not available by default. To make it available, {@link module:clipboard/clipboardobserver~ClipboardObserver}
|
|
204
|
-
* needs to be added to the {@link module:engine/view/document~Document} by using the {@link module:engine/view/view~View#addObserver}
|
|
205
|
-
* method. This is usually done by the {@link module:clipboard/clipboard~Clipboard} plugin, but if for some reason it is not loaded,
|
|
206
|
-
* the observer must be added manually.
|
|
207
|
-
*
|
|
208
|
-
* @see module:clipboard/clipboardobserver~ClipboardObserver
|
|
209
|
-
* @see module:clipboard/clipboard~Clipboard
|
|
210
|
-
*
|
|
211
|
-
* @eventName module:engine/view/document~Document#dragging
|
|
212
|
-
* @param data The event data.
|
|
213
|
-
*/
|
|
214
|
-
export type ViewDocumentDraggingEvent = {
|
|
215
|
-
name: 'dragging';
|
|
216
|
-
args: [data: DomEventData<DragEvent> & DraggingEventData];
|
|
217
|
-
};
|
|
218
|
-
export interface DraggingEventData {
|
|
219
|
-
/**
|
|
220
|
-
* The data transfer instance.
|
|
221
|
-
*/
|
|
222
|
-
dataTransfer: DataTransfer;
|
|
223
|
-
/**
|
|
224
|
-
* Whether the event was triggered by a paste or a drop operation.
|
|
225
|
-
*/
|
|
226
|
-
method: 'dragover';
|
|
227
|
-
/**
|
|
228
|
-
* The tree view element representing the target.
|
|
229
|
-
*/
|
|
230
|
-
target: Element;
|
|
231
|
-
/**
|
|
232
|
-
* Ranges which are the target of the operation (usually – into which the content should be inserted).
|
|
233
|
-
* It is the drop position (which can be different than the selection at the moment of drop).
|
|
234
|
-
*/
|
|
235
|
-
targetRanges: Array<ViewRange> | null;
|
|
236
|
-
}
|
|
237
|
-
/**
|
|
238
|
-
* Fired when the user starts dragging the content in one of the editing roots of the editor.
|
|
239
|
-
*
|
|
240
|
-
* Introduced by {@link module:clipboard/clipboardobserver~ClipboardObserver}.
|
|
241
|
-
*
|
|
242
|
-
* **Note**: This event is not available by default. To make it available, {@link module:clipboard/clipboardobserver~ClipboardObserver}
|
|
243
|
-
* needs to be added to the {@link module:engine/view/document~Document} by using the {@link module:engine/view/view~View#addObserver}
|
|
244
|
-
* method. This is usually done by the {@link module:clipboard/clipboard~Clipboard} plugin, but if for some reason it is not loaded,
|
|
245
|
-
* the observer must be added manually.
|
|
246
|
-
*
|
|
247
|
-
* @see module:engine/view/document~Document#event:clipboardInput
|
|
248
|
-
*
|
|
249
|
-
* @eventName module:engine/view/document~Document#dragstart
|
|
250
|
-
* @param data The event data.
|
|
251
|
-
*/
|
|
252
|
-
export type ViewDocumentDragStartEvent = {
|
|
253
|
-
name: 'dragstart';
|
|
254
|
-
args: [data: DomEventData<DragEvent> & ClipboardEventData];
|
|
255
|
-
};
|
|
256
|
-
/**
|
|
257
|
-
* Fired when the user ended dragging the content.
|
|
258
|
-
*
|
|
259
|
-
* Introduced by {@link module:clipboard/clipboardobserver~ClipboardObserver}.
|
|
260
|
-
*
|
|
261
|
-
* **Note**: This event is not available by default. To make it available, {@link module:clipboard/clipboardobserver~ClipboardObserver}
|
|
262
|
-
* needs to be added to the {@link module:engine/view/document~Document} by using the {@link module:engine/view/view~View#addObserver}
|
|
263
|
-
* method. This is usually done by the {@link module:clipboard/clipboard~Clipboard} plugin, but if for some reason it is not loaded,
|
|
264
|
-
* the observer must be added manually.
|
|
265
|
-
*
|
|
266
|
-
* @see module:engine/view/document~Document#event:clipboardInput
|
|
267
|
-
*
|
|
268
|
-
* @eventName module:engine/view/document~Document#dragend
|
|
269
|
-
* @param data The event data.
|
|
270
|
-
*/
|
|
271
|
-
export type ViewDocumentDragEndEvent = {
|
|
272
|
-
name: 'dragend';
|
|
273
|
-
args: [data: DomEventData<DragEvent> & ClipboardEventData];
|
|
274
|
-
};
|
|
275
|
-
/**
|
|
276
|
-
* Fired when the user drags the content into one of the editing roots of the editor.
|
|
277
|
-
*
|
|
278
|
-
* Introduced by {@link module:clipboard/clipboardobserver~ClipboardObserver}.
|
|
279
|
-
*
|
|
280
|
-
* **Note**: This event is not available by default. To make it available, {@link module:clipboard/clipboardobserver~ClipboardObserver}
|
|
281
|
-
* needs to be added to the {@link module:engine/view/document~Document} by using the {@link module:engine/view/view~View#addObserver}
|
|
282
|
-
* method. This is usually done by the {@link module:clipboard/clipboard~Clipboard} plugin, but if for some reason it is not loaded,
|
|
283
|
-
* the observer must be added manually.
|
|
284
|
-
*
|
|
285
|
-
* @see module:engine/view/document~Document#event:clipboardInput
|
|
286
|
-
*
|
|
287
|
-
* @eventName module:engine/view/document~Document#dragenter
|
|
288
|
-
* @param data The event data.
|
|
289
|
-
*/
|
|
290
|
-
export type ViewDocumentDragEnterEvent = {
|
|
291
|
-
name: 'dragenter';
|
|
292
|
-
args: [data: DomEventData<DragEvent> & ClipboardEventData];
|
|
293
|
-
};
|
|
294
|
-
/**
|
|
295
|
-
* Fired when the user drags the content out of one of the editing roots of the editor.
|
|
296
|
-
*
|
|
297
|
-
* Introduced by {@link module:clipboard/clipboardobserver~ClipboardObserver}.
|
|
298
|
-
*
|
|
299
|
-
* **Note**: This event is not available by default. To make it available, {@link module:clipboard/clipboardobserver~ClipboardObserver}
|
|
300
|
-
* needs to be added to the {@link module:engine/view/document~Document} by using the {@link module:engine/view/view~View#addObserver}
|
|
301
|
-
* method. This is usually done by the {@link module:clipboard/clipboard~Clipboard} plugin, but if for some reason it is not loaded,
|
|
302
|
-
* the observer must be added manually.
|
|
303
|
-
*
|
|
304
|
-
* @see module:engine/view/document~Document#event:clipboardInput
|
|
305
|
-
*
|
|
306
|
-
* @eventName module:engine/view/document~Document#dragleave
|
|
307
|
-
* @param data The event data.
|
|
308
|
-
*/
|
|
309
|
-
export type ViewDocumentDragLeaveEvent = {
|
|
310
|
-
name: 'dragleave';
|
|
311
|
-
args: [data: DomEventData<DragEvent> & ClipboardEventData];
|
|
312
|
-
};
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
import { DataTransfer, DomEventObserver, type DomEventData, type View, type ViewDocumentFragment, type ViewElement, type ViewRange } from '@ckeditor/ckeditor5-engine';
|
|
6
|
+
/**
|
|
7
|
+
* Clipboard events observer.
|
|
8
|
+
*
|
|
9
|
+
* Fires the following events:
|
|
10
|
+
*
|
|
11
|
+
* * {@link module:engine/view/document~Document#event:clipboardInput},
|
|
12
|
+
* * {@link module:engine/view/document~Document#event:paste},
|
|
13
|
+
* * {@link module:engine/view/document~Document#event:copy},
|
|
14
|
+
* * {@link module:engine/view/document~Document#event:cut},
|
|
15
|
+
* * {@link module:engine/view/document~Document#event:drop},
|
|
16
|
+
* * {@link module:engine/view/document~Document#event:dragover},
|
|
17
|
+
* * {@link module:engine/view/document~Document#event:dragging},
|
|
18
|
+
* * {@link module:engine/view/document~Document#event:dragstart},
|
|
19
|
+
* * {@link module:engine/view/document~Document#event:dragend},
|
|
20
|
+
* * {@link module:engine/view/document~Document#event:dragenter},
|
|
21
|
+
* * {@link module:engine/view/document~Document#event:dragleave}.
|
|
22
|
+
*
|
|
23
|
+
* **Note**: This observer is not available by default (ckeditor5-engine does not add it on its own).
|
|
24
|
+
* To make it available, it needs to be added to {@link module:engine/view/document~Document} by using
|
|
25
|
+
* the {@link module:engine/view/view~View#addObserver `View#addObserver()`} method. Alternatively, you can load the
|
|
26
|
+
* {@link module:clipboard/clipboard~Clipboard} plugin which adds this observer automatically (because it uses it).
|
|
27
|
+
*/
|
|
28
|
+
export default class ClipboardObserver extends DomEventObserver<'paste' | 'copy' | 'cut' | 'drop' | 'dragover' | 'dragstart' | 'dragend' | 'dragenter' | 'dragleave', ClipboardEventData> {
|
|
29
|
+
readonly domEventType: readonly ["paste", "copy", "cut", "drop", "dragover", "dragstart", "dragend", "dragenter", "dragleave"];
|
|
30
|
+
constructor(view: View);
|
|
31
|
+
onDomEvent(domEvent: ClipboardEvent | DragEvent): void;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The data of 'paste', 'copy', 'cut', 'drop', 'dragover', 'dragstart', 'dragend', 'dragenter' and 'dragleave' events.
|
|
35
|
+
*/
|
|
36
|
+
export interface ClipboardEventData {
|
|
37
|
+
/**
|
|
38
|
+
* The data transfer instance.
|
|
39
|
+
*/
|
|
40
|
+
dataTransfer: DataTransfer;
|
|
41
|
+
/**
|
|
42
|
+
* The position into which the content is dropped.
|
|
43
|
+
*/
|
|
44
|
+
dropRange?: ViewRange | null;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Fired as a continuation of the {@link module:engine/view/document~Document#event:paste} and
|
|
48
|
+
* {@link module:engine/view/document~Document#event:drop} events.
|
|
49
|
+
*
|
|
50
|
+
* It is a part of the {@glink framework/deep-dive/clipboard#input-pipeline clipboard input pipeline}.
|
|
51
|
+
*
|
|
52
|
+
* This event carries a `dataTransfer` object which comes from the clipboard and whose content should be processed
|
|
53
|
+
* and inserted into the editor.
|
|
54
|
+
*
|
|
55
|
+
* **Note**: This event is not available by default. To make it available, {@link module:clipboard/clipboardobserver~ClipboardObserver}
|
|
56
|
+
* needs to be added to the {@link module:engine/view/document~Document} by using the {@link module:engine/view/view~View#addObserver}
|
|
57
|
+
* method. This is usually done by the {@link module:clipboard/clipboard~Clipboard} plugin, but if for some reason it is not loaded,
|
|
58
|
+
* the observer must be added manually.
|
|
59
|
+
*
|
|
60
|
+
* @see module:clipboard/clipboardobserver~ClipboardObserver
|
|
61
|
+
* @see module:clipboard/clipboard~Clipboard
|
|
62
|
+
*
|
|
63
|
+
* @eventName module:engine/view/document~Document#clipboardInput
|
|
64
|
+
* @param data The event data.
|
|
65
|
+
*/
|
|
66
|
+
export type ViewDocumentClipboardInputEvent = {
|
|
67
|
+
name: 'clipboardInput';
|
|
68
|
+
args: [data: DomEventData<ClipboardEvent | DragEvent> & ClipboardInputEventData];
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* The value of the {@link module:engine/view/document~Document#event:paste},
|
|
72
|
+
* {@link module:engine/view/document~Document#event:copy} and {@link module:engine/view/document~Document#event:cut} events.
|
|
73
|
+
*
|
|
74
|
+
* In order to access the clipboard data, use the `dataTransfer` property.
|
|
75
|
+
*/
|
|
76
|
+
export interface ClipboardInputEventData {
|
|
77
|
+
/**
|
|
78
|
+
* Data transfer instance.
|
|
79
|
+
*/
|
|
80
|
+
dataTransfer: DataTransfer;
|
|
81
|
+
/**
|
|
82
|
+
* Whether the event was triggered by a paste or a drop operation.
|
|
83
|
+
*/
|
|
84
|
+
method: 'paste' | 'drop';
|
|
85
|
+
/**
|
|
86
|
+
* The tree view element representing the target.
|
|
87
|
+
*/
|
|
88
|
+
target: ViewElement;
|
|
89
|
+
/**
|
|
90
|
+
* The ranges which are the target of the operation (usually – into which the content should be inserted).
|
|
91
|
+
* If the clipboard input was triggered by a paste operation, this property is not set. If by a drop operation,
|
|
92
|
+
* then it is the drop position (which can be different than the selection at the moment of the drop).
|
|
93
|
+
*/
|
|
94
|
+
targetRanges: Array<ViewRange> | null;
|
|
95
|
+
/**
|
|
96
|
+
* The content of clipboard input.
|
|
97
|
+
*/
|
|
98
|
+
content?: ViewDocumentFragment;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Fired when the user drags the content over one of the editing roots of the editor.
|
|
102
|
+
*
|
|
103
|
+
* Introduced by {@link module:clipboard/clipboardobserver~ClipboardObserver}.
|
|
104
|
+
*
|
|
105
|
+
* **Note**: This event is not available by default. To make it available, {@link module:clipboard/clipboardobserver~ClipboardObserver}
|
|
106
|
+
* needs to be added to the {@link module:engine/view/document~Document} by using the {@link module:engine/view/view~View#addObserver}
|
|
107
|
+
* method. This is usually done by the {@link module:clipboard/clipboard~Clipboard} plugin, but if for some reason it is not loaded,
|
|
108
|
+
* the observer must be added manually.
|
|
109
|
+
*
|
|
110
|
+
* @see module:engine/view/document~Document#event:clipboardInput
|
|
111
|
+
*
|
|
112
|
+
* @eventName module:engine/view/document~Document#dragover
|
|
113
|
+
* @param data The event data.
|
|
114
|
+
*/
|
|
115
|
+
export type ViewDocumentDragOverEvent = {
|
|
116
|
+
name: 'dragover';
|
|
117
|
+
args: [data: DomEventData<DragEvent> & ClipboardEventData];
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* Fired when the user dropped the content into one of the editing roots of the editor.
|
|
121
|
+
*
|
|
122
|
+
* Introduced by {@link module:clipboard/clipboardobserver~ClipboardObserver}.
|
|
123
|
+
*
|
|
124
|
+
* **Note**: This event is not available by default. To make it available, {@link module:clipboard/clipboardobserver~ClipboardObserver}
|
|
125
|
+
* needs to be added to the {@link module:engine/view/document~Document} by using the {@link module:engine/view/view~View#addObserver}
|
|
126
|
+
* method. This is usually done by the {@link module:clipboard/clipboard~Clipboard} plugin, but if for some reason it is not loaded,
|
|
127
|
+
* the observer must be added manually.
|
|
128
|
+
*
|
|
129
|
+
* @see module:engine/view/document~Document#event:clipboardInput
|
|
130
|
+
*
|
|
131
|
+
* @eventName module:engine/view/document~Document#drop
|
|
132
|
+
* @param data The event data.
|
|
133
|
+
*/
|
|
134
|
+
export type ViewDocumentDropEvent = {
|
|
135
|
+
name: 'drop';
|
|
136
|
+
args: [data: DomEventData<DragEvent> & ClipboardEventData];
|
|
137
|
+
};
|
|
138
|
+
/**
|
|
139
|
+
* Fired when the user pasted the content into one of the editing roots of the editor.
|
|
140
|
+
*
|
|
141
|
+
* Introduced by {@link module:clipboard/clipboardobserver~ClipboardObserver}.
|
|
142
|
+
*
|
|
143
|
+
* **Note**: This event is not available by default. To make it available, {@link module:clipboard/clipboardobserver~ClipboardObserver}
|
|
144
|
+
* needs to be added to the {@link module:engine/view/document~Document} by using the {@link module:engine/view/view~View#addObserver}
|
|
145
|
+
* method. This is usually done by the {@link module:clipboard/clipboard~Clipboard} plugin, but if for some reason it is not loaded,
|
|
146
|
+
* the observer must be added manually.
|
|
147
|
+
*
|
|
148
|
+
* @see module:engine/view/document~Document#event:clipboardInput
|
|
149
|
+
*
|
|
150
|
+
* @eventName module:engine/view/document~Document#paste
|
|
151
|
+
* @param {module:clipboard/clipboardobserver~ClipboardEventData} data The event data.
|
|
152
|
+
*/
|
|
153
|
+
export type ViewDocumentPasteEvent = {
|
|
154
|
+
name: 'paste';
|
|
155
|
+
args: [data: DomEventData<ClipboardEvent> & ClipboardEventData];
|
|
156
|
+
};
|
|
157
|
+
/**
|
|
158
|
+
* Fired when the user copied the content from one of the editing roots of the editor.
|
|
159
|
+
*
|
|
160
|
+
* Introduced by {@link module:clipboard/clipboardobserver~ClipboardObserver}.
|
|
161
|
+
*
|
|
162
|
+
* **Note**: This event is not available by default. To make it available, {@link module:clipboard/clipboardobserver~ClipboardObserver}
|
|
163
|
+
* needs to be added to the {@link module:engine/view/document~Document} by using the {@link module:engine/view/view~View#addObserver}
|
|
164
|
+
* method. This is usually done by the {@link module:clipboard/clipboard~Clipboard} plugin, but if for some reason it is not loaded,
|
|
165
|
+
* the observer must be added manually.
|
|
166
|
+
*
|
|
167
|
+
* @see module:clipboard/clipboardobserver~ClipboardObserver
|
|
168
|
+
*
|
|
169
|
+
* @eventName module:engine/view/document~Document#copy
|
|
170
|
+
* @param data The event data.
|
|
171
|
+
*/
|
|
172
|
+
export type ViewDocumentCopyEvent = {
|
|
173
|
+
name: 'copy';
|
|
174
|
+
args: [data: DomEventData<ClipboardEvent> & ClipboardEventData];
|
|
175
|
+
};
|
|
176
|
+
/**
|
|
177
|
+
* Fired when the user cut the content from one of the editing roots of the editor.
|
|
178
|
+
*
|
|
179
|
+
* Introduced by {@link module:clipboard/clipboardobserver~ClipboardObserver}.
|
|
180
|
+
*
|
|
181
|
+
* **Note**: This event is not available by default. To make it available, {@link module:clipboard/clipboardobserver~ClipboardObserver}
|
|
182
|
+
* needs to be added to the {@link module:engine/view/document~Document} by using the {@link module:engine/view/view~View#addObserver}
|
|
183
|
+
* method. This is usually done by the {@link module:clipboard/clipboard~Clipboard} plugin, but if for some reason it is not loaded,
|
|
184
|
+
* the observer must be added manually.
|
|
185
|
+
*
|
|
186
|
+
* @see module:clipboard/clipboardobserver~ClipboardObserver
|
|
187
|
+
*
|
|
188
|
+
* @eventName module:engine/view/document~Document#cut
|
|
189
|
+
* @param data The event data.
|
|
190
|
+
*/
|
|
191
|
+
export type ViewDocumentCutEvent = {
|
|
192
|
+
name: 'cut';
|
|
193
|
+
args: [data: DomEventData<ClipboardEvent> & ClipboardEventData];
|
|
194
|
+
};
|
|
195
|
+
/**
|
|
196
|
+
* Fired as a continuation of the {@link module:engine/view/document~Document#event:dragover} event.
|
|
197
|
+
*
|
|
198
|
+
* It is a part of the {@glink framework/deep-dive/clipboard#input-pipeline clipboard input pipeline}.
|
|
199
|
+
*
|
|
200
|
+
* This event carries a `dataTransfer` object which comes from the clipboard and whose content should be processed
|
|
201
|
+
* and inserted into the editor.
|
|
202
|
+
*
|
|
203
|
+
* **Note**: This event is not available by default. To make it available, {@link module:clipboard/clipboardobserver~ClipboardObserver}
|
|
204
|
+
* needs to be added to the {@link module:engine/view/document~Document} by using the {@link module:engine/view/view~View#addObserver}
|
|
205
|
+
* method. This is usually done by the {@link module:clipboard/clipboard~Clipboard} plugin, but if for some reason it is not loaded,
|
|
206
|
+
* the observer must be added manually.
|
|
207
|
+
*
|
|
208
|
+
* @see module:clipboard/clipboardobserver~ClipboardObserver
|
|
209
|
+
* @see module:clipboard/clipboard~Clipboard
|
|
210
|
+
*
|
|
211
|
+
* @eventName module:engine/view/document~Document#dragging
|
|
212
|
+
* @param data The event data.
|
|
213
|
+
*/
|
|
214
|
+
export type ViewDocumentDraggingEvent = {
|
|
215
|
+
name: 'dragging';
|
|
216
|
+
args: [data: DomEventData<DragEvent> & DraggingEventData];
|
|
217
|
+
};
|
|
218
|
+
export interface DraggingEventData {
|
|
219
|
+
/**
|
|
220
|
+
* The data transfer instance.
|
|
221
|
+
*/
|
|
222
|
+
dataTransfer: DataTransfer;
|
|
223
|
+
/**
|
|
224
|
+
* Whether the event was triggered by a paste or a drop operation.
|
|
225
|
+
*/
|
|
226
|
+
method: 'dragover';
|
|
227
|
+
/**
|
|
228
|
+
* The tree view element representing the target.
|
|
229
|
+
*/
|
|
230
|
+
target: Element;
|
|
231
|
+
/**
|
|
232
|
+
* Ranges which are the target of the operation (usually – into which the content should be inserted).
|
|
233
|
+
* It is the drop position (which can be different than the selection at the moment of drop).
|
|
234
|
+
*/
|
|
235
|
+
targetRanges: Array<ViewRange> | null;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Fired when the user starts dragging the content in one of the editing roots of the editor.
|
|
239
|
+
*
|
|
240
|
+
* Introduced by {@link module:clipboard/clipboardobserver~ClipboardObserver}.
|
|
241
|
+
*
|
|
242
|
+
* **Note**: This event is not available by default. To make it available, {@link module:clipboard/clipboardobserver~ClipboardObserver}
|
|
243
|
+
* needs to be added to the {@link module:engine/view/document~Document} by using the {@link module:engine/view/view~View#addObserver}
|
|
244
|
+
* method. This is usually done by the {@link module:clipboard/clipboard~Clipboard} plugin, but if for some reason it is not loaded,
|
|
245
|
+
* the observer must be added manually.
|
|
246
|
+
*
|
|
247
|
+
* @see module:engine/view/document~Document#event:clipboardInput
|
|
248
|
+
*
|
|
249
|
+
* @eventName module:engine/view/document~Document#dragstart
|
|
250
|
+
* @param data The event data.
|
|
251
|
+
*/
|
|
252
|
+
export type ViewDocumentDragStartEvent = {
|
|
253
|
+
name: 'dragstart';
|
|
254
|
+
args: [data: DomEventData<DragEvent> & ClipboardEventData];
|
|
255
|
+
};
|
|
256
|
+
/**
|
|
257
|
+
* Fired when the user ended dragging the content.
|
|
258
|
+
*
|
|
259
|
+
* Introduced by {@link module:clipboard/clipboardobserver~ClipboardObserver}.
|
|
260
|
+
*
|
|
261
|
+
* **Note**: This event is not available by default. To make it available, {@link module:clipboard/clipboardobserver~ClipboardObserver}
|
|
262
|
+
* needs to be added to the {@link module:engine/view/document~Document} by using the {@link module:engine/view/view~View#addObserver}
|
|
263
|
+
* method. This is usually done by the {@link module:clipboard/clipboard~Clipboard} plugin, but if for some reason it is not loaded,
|
|
264
|
+
* the observer must be added manually.
|
|
265
|
+
*
|
|
266
|
+
* @see module:engine/view/document~Document#event:clipboardInput
|
|
267
|
+
*
|
|
268
|
+
* @eventName module:engine/view/document~Document#dragend
|
|
269
|
+
* @param data The event data.
|
|
270
|
+
*/
|
|
271
|
+
export type ViewDocumentDragEndEvent = {
|
|
272
|
+
name: 'dragend';
|
|
273
|
+
args: [data: DomEventData<DragEvent> & ClipboardEventData];
|
|
274
|
+
};
|
|
275
|
+
/**
|
|
276
|
+
* Fired when the user drags the content into one of the editing roots of the editor.
|
|
277
|
+
*
|
|
278
|
+
* Introduced by {@link module:clipboard/clipboardobserver~ClipboardObserver}.
|
|
279
|
+
*
|
|
280
|
+
* **Note**: This event is not available by default. To make it available, {@link module:clipboard/clipboardobserver~ClipboardObserver}
|
|
281
|
+
* needs to be added to the {@link module:engine/view/document~Document} by using the {@link module:engine/view/view~View#addObserver}
|
|
282
|
+
* method. This is usually done by the {@link module:clipboard/clipboard~Clipboard} plugin, but if for some reason it is not loaded,
|
|
283
|
+
* the observer must be added manually.
|
|
284
|
+
*
|
|
285
|
+
* @see module:engine/view/document~Document#event:clipboardInput
|
|
286
|
+
*
|
|
287
|
+
* @eventName module:engine/view/document~Document#dragenter
|
|
288
|
+
* @param data The event data.
|
|
289
|
+
*/
|
|
290
|
+
export type ViewDocumentDragEnterEvent = {
|
|
291
|
+
name: 'dragenter';
|
|
292
|
+
args: [data: DomEventData<DragEvent> & ClipboardEventData];
|
|
293
|
+
};
|
|
294
|
+
/**
|
|
295
|
+
* Fired when the user drags the content out of one of the editing roots of the editor.
|
|
296
|
+
*
|
|
297
|
+
* Introduced by {@link module:clipboard/clipboardobserver~ClipboardObserver}.
|
|
298
|
+
*
|
|
299
|
+
* **Note**: This event is not available by default. To make it available, {@link module:clipboard/clipboardobserver~ClipboardObserver}
|
|
300
|
+
* needs to be added to the {@link module:engine/view/document~Document} by using the {@link module:engine/view/view~View#addObserver}
|
|
301
|
+
* method. This is usually done by the {@link module:clipboard/clipboard~Clipboard} plugin, but if for some reason it is not loaded,
|
|
302
|
+
* the observer must be added manually.
|
|
303
|
+
*
|
|
304
|
+
* @see module:engine/view/document~Document#event:clipboardInput
|
|
305
|
+
*
|
|
306
|
+
* @eventName module:engine/view/document~Document#dragleave
|
|
307
|
+
* @param data The event data.
|
|
308
|
+
*/
|
|
309
|
+
export type ViewDocumentDragLeaveEvent = {
|
|
310
|
+
name: 'dragleave';
|
|
311
|
+
args: [data: DomEventData<DragEvent> & ClipboardEventData];
|
|
312
|
+
};
|