@ckeditor/ckeditor5-clipboard 40.0.0 → 40.1.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.
@@ -1,266 +1,266 @@
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
- /**
6
- * @module clipboard/clipboardpipeline
7
- */
8
- import { Plugin } from '@ckeditor/ckeditor5-core';
9
- import { EventInfo } from '@ckeditor/ckeditor5-utils';
10
- import ClipboardObserver from './clipboardobserver';
11
- import plainTextToHtml from './utils/plaintexttohtml';
12
- import normalizeClipboardHtml from './utils/normalizeclipboarddata';
13
- import viewToPlainText from './utils/viewtoplaintext';
14
- // Input pipeline events overview:
15
- //
16
- // ┌──────────────────────┐ ┌──────────────────────┐
17
- // │ view.Document │ │ view.Document │
18
- // │ paste │ │ drop │
19
- // └───────────┬──────────┘ └───────────┬──────────┘
20
- // │ │
21
- // └────────────────┌────────────────┘
22
- // │
23
- // ┌─────────V────────┐
24
- // │ view.Document │ Retrieves text/html or text/plain from data.dataTransfer
25
- // │ clipboardInput │ and processes it to view.DocumentFragment.
26
- // └─────────┬────────┘
27
- // │
28
- // ┌───────────V───────────┐
29
- // │ ClipboardPipeline │ Converts view.DocumentFragment to model.DocumentFragment.
30
- // │ inputTransformation │
31
- // └───────────┬───────────┘
32
- // │
33
- // ┌──────────V──────────┐
34
- // │ ClipboardPipeline │ Calls model.insertContent().
35
- // │ contentInsertion │
36
- // └─────────────────────┘
37
- //
38
- //
39
- // Output pipeline events overview:
40
- //
41
- // ┌──────────────────────┐ ┌──────────────────────┐
42
- // │ view.Document │ │ view.Document │ Retrieves the selected model.DocumentFragment
43
- // │ copy │ │ cut │ and fires `outputTransformation` event.
44
- // └───────────┬──────────┘ └───────────┬──────────┘
45
- // │ │
46
- // └────────────────┌────────────────┘
47
- // │
48
- // ┌───────────V───────────┐
49
- // │ ClipboardPipeline │ Processes model.DocumentFragment and converts it to
50
- // │ outputTransformation │ view.DocumentFragment.
51
- // └───────────┬───────────┘
52
- // │
53
- // ┌─────────V────────┐
54
- // │ view.Document │ Processes view.DocumentFragment to text/html and text/plain
55
- // │ clipboardOutput │ and stores the results in data.dataTransfer.
56
- // └──────────────────┘
57
- //
58
- /**
59
- * The clipboard pipeline feature. It is responsible for intercepting the `paste` and `drop` events and
60
- * passing the pasted content through a series of events in order to insert it into the editor's content.
61
- * It also handles the `cut` and `copy` events to fill the native clipboard with the serialized editor's data.
62
- *
63
- * # Input pipeline
64
- *
65
- * The behavior of the default handlers (all at a `low` priority):
66
- *
67
- * ## Event: `paste` or `drop`
68
- *
69
- * 1. Translates the event data.
70
- * 2. Fires the {@link module:engine/view/document~Document#event:clipboardInput `view.Document#clipboardInput`} event.
71
- *
72
- * ## Event: `view.Document#clipboardInput`
73
- *
74
- * 1. If the `data.content` event field is already set (by some listener on a higher priority), it takes this content and fires the event
75
- * from the last point.
76
- * 2. Otherwise, it retrieves `text/html` or `text/plain` from `data.dataTransfer`.
77
- * 3. Normalizes the raw data by applying simple filters on string data.
78
- * 4. Processes the raw data to {@link module:engine/view/documentfragment~DocumentFragment `view.DocumentFragment`} with the
79
- * {@link module:engine/controller/datacontroller~DataController#htmlProcessor `DataController#htmlProcessor`}.
80
- * 5. Fires the {@link module:clipboard/clipboardpipeline~ClipboardPipeline#event:inputTransformation
81
- * `ClipboardPipeline#inputTransformation`} event with the view document fragment in the `data.content` event field.
82
- *
83
- * ## Event: `ClipboardPipeline#inputTransformation`
84
- *
85
- * 1. Converts {@link module:engine/view/documentfragment~DocumentFragment `view.DocumentFragment`} from the `data.content` field to
86
- * {@link module:engine/model/documentfragment~DocumentFragment `model.DocumentFragment`}.
87
- * 2. Fires the {@link module:clipboard/clipboardpipeline~ClipboardPipeline#event:contentInsertion `ClipboardPipeline#contentInsertion`}
88
- * event with the model document fragment in the `data.content` event field.
89
- * **Note**: The `ClipboardPipeline#contentInsertion` event is fired within a model change block to allow other handlers
90
- * to run in the same block without post-fixers called in between (i.e., the selection post-fixer).
91
- *
92
- * ## Event: `ClipboardPipeline#contentInsertion`
93
- *
94
- * 1. Calls {@link module:engine/model/model~Model#insertContent `model.insertContent()`} to insert `data.content`
95
- * at the current selection position.
96
- *
97
- * # Output pipeline
98
- *
99
- * The behavior of the default handlers (all at a `low` priority):
100
- *
101
- * ## Event: `copy`, `cut` or `dragstart`
102
- *
103
- * 1. Retrieves the selected {@link module:engine/model/documentfragment~DocumentFragment `model.DocumentFragment`} by calling
104
- * {@link module:engine/model/model~Model#getSelectedContent `model#getSelectedContent()`}.
105
- * 2. Converts the model document fragment to {@link module:engine/view/documentfragment~DocumentFragment `view.DocumentFragment`}.
106
- * 3. Fires the {@link module:engine/view/document~Document#event:clipboardOutput `view.Document#clipboardOutput`} event
107
- * with the view document fragment in the `data.content` event field.
108
- *
109
- * ## Event: `view.Document#clipboardOutput`
110
- *
111
- * 1. Processes `data.content` to HTML and plain text with the
112
- * {@link module:engine/controller/datacontroller~DataController#htmlProcessor `DataController#htmlProcessor`}.
113
- * 2. Updates the `data.dataTransfer` data for `text/html` and `text/plain` with the processed data.
114
- * 3. For the `cut` method, calls {@link module:engine/model/model~Model#deleteContent `model.deleteContent()`}
115
- * on the current selection.
116
- *
117
- * Read more about the clipboard integration in the {@glink framework/deep-dive/clipboard clipboard deep-dive} guide.
118
- */
119
- export default class ClipboardPipeline extends Plugin {
120
- /**
121
- * @inheritDoc
122
- */
123
- static get pluginName() {
124
- return 'ClipboardPipeline';
125
- }
126
- /**
127
- * @inheritDoc
128
- */
129
- init() {
130
- const editor = this.editor;
131
- const view = editor.editing.view;
132
- view.addObserver(ClipboardObserver);
133
- this._setupPasteDrop();
134
- this._setupCopyCut();
135
- }
136
- /**
137
- * Fires Clipboard `'outputTransformation'` event for given parameters.
138
- *
139
- * @internal
140
- */
141
- _fireOutputTransformationEvent(dataTransfer, selection, method) {
142
- const content = this.editor.model.getSelectedContent(selection);
143
- this.fire('outputTransformation', {
144
- dataTransfer,
145
- content,
146
- method
147
- });
148
- }
149
- /**
150
- * The clipboard paste pipeline.
151
- */
152
- _setupPasteDrop() {
153
- const editor = this.editor;
154
- const model = editor.model;
155
- const view = editor.editing.view;
156
- const viewDocument = view.document;
157
- // Pasting is disabled when selection is in non-editable place.
158
- // Dropping is disabled in drag and drop handler.
159
- this.listenTo(viewDocument, 'clipboardInput', (evt, data) => {
160
- if (data.method == 'paste' && !editor.model.canEditAt(editor.model.document.selection)) {
161
- evt.stop();
162
- }
163
- }, { priority: 'highest' });
164
- this.listenTo(viewDocument, 'clipboardInput', (evt, data) => {
165
- const dataTransfer = data.dataTransfer;
166
- let content;
167
- // Some feature could already inject content in the higher priority event handler (i.e., codeBlock).
168
- if (data.content) {
169
- content = data.content;
170
- }
171
- else {
172
- let contentData = '';
173
- if (dataTransfer.getData('text/html')) {
174
- contentData = normalizeClipboardHtml(dataTransfer.getData('text/html'));
175
- }
176
- else if (dataTransfer.getData('text/plain')) {
177
- contentData = plainTextToHtml(dataTransfer.getData('text/plain'));
178
- }
179
- content = this.editor.data.htmlProcessor.toView(contentData);
180
- }
181
- const eventInfo = new EventInfo(this, 'inputTransformation');
182
- this.fire(eventInfo, {
183
- content,
184
- dataTransfer,
185
- targetRanges: data.targetRanges,
186
- method: data.method
187
- });
188
- // If CKEditor handled the input, do not bubble the original event any further.
189
- // This helps external integrations recognize this fact and act accordingly.
190
- // https://github.com/ckeditor/ckeditor5-upload/issues/92
191
- if (eventInfo.stop.called) {
192
- evt.stop();
193
- }
194
- view.scrollToTheSelection();
195
- }, { priority: 'low' });
196
- this.listenTo(this, 'inputTransformation', (evt, data) => {
197
- if (data.content.isEmpty) {
198
- return;
199
- }
200
- const dataController = this.editor.data;
201
- // Convert the pasted content into a model document fragment.
202
- // The conversion is contextual, but in this case an "all allowed" context is needed
203
- // and for that we use the $clipboardHolder item.
204
- const modelFragment = dataController.toModel(data.content, '$clipboardHolder');
205
- if (modelFragment.childCount == 0) {
206
- return;
207
- }
208
- evt.stop();
209
- // Fire content insertion event in a single change block to allow other handlers to run in the same block
210
- // without post-fixers called in between (i.e., the selection post-fixer).
211
- model.change(() => {
212
- this.fire('contentInsertion', {
213
- content: modelFragment,
214
- method: data.method,
215
- dataTransfer: data.dataTransfer,
216
- targetRanges: data.targetRanges
217
- });
218
- });
219
- }, { priority: 'low' });
220
- this.listenTo(this, 'contentInsertion', (evt, data) => {
221
- data.resultRange = model.insertContent(data.content);
222
- }, { priority: 'low' });
223
- }
224
- /**
225
- * The clipboard copy/cut pipeline.
226
- */
227
- _setupCopyCut() {
228
- const editor = this.editor;
229
- const modelDocument = editor.model.document;
230
- const view = editor.editing.view;
231
- const viewDocument = view.document;
232
- const onCopyCut = (evt, data) => {
233
- const dataTransfer = data.dataTransfer;
234
- data.preventDefault();
235
- this._fireOutputTransformationEvent(dataTransfer, modelDocument.selection, evt.name);
236
- };
237
- this.listenTo(viewDocument, 'copy', onCopyCut, { priority: 'low' });
238
- this.listenTo(viewDocument, 'cut', (evt, data) => {
239
- // Cutting is disabled when selection is in non-editable place.
240
- // See: https://github.com/ckeditor/ckeditor5-clipboard/issues/26.
241
- if (!editor.model.canEditAt(editor.model.document.selection)) {
242
- data.preventDefault();
243
- }
244
- else {
245
- onCopyCut(evt, data);
246
- }
247
- }, { priority: 'low' });
248
- this.listenTo(this, 'outputTransformation', (evt, data) => {
249
- const content = editor.data.toView(data.content);
250
- viewDocument.fire('clipboardOutput', {
251
- dataTransfer: data.dataTransfer,
252
- content,
253
- method: data.method
254
- });
255
- }, { priority: 'low' });
256
- this.listenTo(viewDocument, 'clipboardOutput', (evt, data) => {
257
- if (!data.content.isEmpty) {
258
- data.dataTransfer.setData('text/html', this.editor.data.htmlProcessor.toData(data.content));
259
- data.dataTransfer.setData('text/plain', viewToPlainText(data.content));
260
- }
261
- if (data.method == 'cut') {
262
- editor.model.deleteContent(modelDocument.selection);
263
- }
264
- }, { priority: 'low' });
265
- }
266
- }
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
+ /**
6
+ * @module clipboard/clipboardpipeline
7
+ */
8
+ import { Plugin } from '@ckeditor/ckeditor5-core';
9
+ import { EventInfo } from '@ckeditor/ckeditor5-utils';
10
+ import ClipboardObserver from './clipboardobserver';
11
+ import plainTextToHtml from './utils/plaintexttohtml';
12
+ import normalizeClipboardHtml from './utils/normalizeclipboarddata';
13
+ import viewToPlainText from './utils/viewtoplaintext';
14
+ // Input pipeline events overview:
15
+ //
16
+ // ┌──────────────────────┐ ┌──────────────────────┐
17
+ // │ view.Document │ │ view.Document │
18
+ // │ paste │ │ drop │
19
+ // └───────────┬──────────┘ └───────────┬──────────┘
20
+ // │ │
21
+ // └────────────────┌────────────────┘
22
+ // │
23
+ // ┌─────────V────────┐
24
+ // │ view.Document │ Retrieves text/html or text/plain from data.dataTransfer
25
+ // │ clipboardInput │ and processes it to view.DocumentFragment.
26
+ // └─────────┬────────┘
27
+ // │
28
+ // ┌───────────V───────────┐
29
+ // │ ClipboardPipeline │ Converts view.DocumentFragment to model.DocumentFragment.
30
+ // │ inputTransformation │
31
+ // └───────────┬───────────┘
32
+ // │
33
+ // ┌──────────V──────────┐
34
+ // │ ClipboardPipeline │ Calls model.insertContent().
35
+ // │ contentInsertion │
36
+ // └─────────────────────┘
37
+ //
38
+ //
39
+ // Output pipeline events overview:
40
+ //
41
+ // ┌──────────────────────┐ ┌──────────────────────┐
42
+ // │ view.Document │ │ view.Document │ Retrieves the selected model.DocumentFragment
43
+ // │ copy │ │ cut │ and fires the `outputTransformation` event.
44
+ // └───────────┬──────────┘ └───────────┬──────────┘
45
+ // │ │
46
+ // └────────────────┌────────────────┘
47
+ // │
48
+ // ┌───────────V───────────┐
49
+ // │ ClipboardPipeline │ Processes model.DocumentFragment and converts it to
50
+ // │ outputTransformation │ view.DocumentFragment.
51
+ // └───────────┬───────────┘
52
+ // │
53
+ // ┌─────────V────────┐
54
+ // │ view.Document │ Processes view.DocumentFragment to text/html and text/plain
55
+ // │ clipboardOutput │ and stores the results in data.dataTransfer.
56
+ // └──────────────────┘
57
+ //
58
+ /**
59
+ * The clipboard pipeline feature. It is responsible for intercepting the `paste` and `drop` events and
60
+ * passing the pasted content through a series of events in order to insert it into the editor's content.
61
+ * It also handles the `cut` and `copy` events to fill the native clipboard with the serialized editor's data.
62
+ *
63
+ * # Input pipeline
64
+ *
65
+ * The behavior of the default handlers (all at a `low` priority):
66
+ *
67
+ * ## Event: `paste` or `drop`
68
+ *
69
+ * 1. Translates the event data.
70
+ * 2. Fires the {@link module:engine/view/document~Document#event:clipboardInput `view.Document#clipboardInput`} event.
71
+ *
72
+ * ## Event: `view.Document#clipboardInput`
73
+ *
74
+ * 1. If the `data.content` event field is already set (by some listener on a higher priority), it takes this content and fires the event
75
+ * from the last point.
76
+ * 2. Otherwise, it retrieves `text/html` or `text/plain` from `data.dataTransfer`.
77
+ * 3. Normalizes the raw data by applying simple filters on string data.
78
+ * 4. Processes the raw data to {@link module:engine/view/documentfragment~DocumentFragment `view.DocumentFragment`} with the
79
+ * {@link module:engine/controller/datacontroller~DataController#htmlProcessor `DataController#htmlProcessor`}.
80
+ * 5. Fires the {@link module:clipboard/clipboardpipeline~ClipboardPipeline#event:inputTransformation
81
+ * `ClipboardPipeline#inputTransformation`} event with the view document fragment in the `data.content` event field.
82
+ *
83
+ * ## Event: `ClipboardPipeline#inputTransformation`
84
+ *
85
+ * 1. Converts {@link module:engine/view/documentfragment~DocumentFragment `view.DocumentFragment`} from the `data.content` field to
86
+ * {@link module:engine/model/documentfragment~DocumentFragment `model.DocumentFragment`}.
87
+ * 2. Fires the {@link module:clipboard/clipboardpipeline~ClipboardPipeline#event:contentInsertion `ClipboardPipeline#contentInsertion`}
88
+ * event with the model document fragment in the `data.content` event field.
89
+ * **Note**: The `ClipboardPipeline#contentInsertion` event is fired within a model change block to allow other handlers
90
+ * to run in the same block without post-fixers called in between (i.e., the selection post-fixer).
91
+ *
92
+ * ## Event: `ClipboardPipeline#contentInsertion`
93
+ *
94
+ * 1. Calls {@link module:engine/model/model~Model#insertContent `model.insertContent()`} to insert `data.content`
95
+ * at the current selection position.
96
+ *
97
+ * # Output pipeline
98
+ *
99
+ * The behavior of the default handlers (all at a `low` priority):
100
+ *
101
+ * ## Event: `copy`, `cut` or `dragstart`
102
+ *
103
+ * 1. Retrieves the selected {@link module:engine/model/documentfragment~DocumentFragment `model.DocumentFragment`} by calling
104
+ * {@link module:engine/model/model~Model#getSelectedContent `model#getSelectedContent()`}.
105
+ * 2. Converts the model document fragment to {@link module:engine/view/documentfragment~DocumentFragment `view.DocumentFragment`}.
106
+ * 3. Fires the {@link module:engine/view/document~Document#event:clipboardOutput `view.Document#clipboardOutput`} event
107
+ * with the view document fragment in the `data.content` event field.
108
+ *
109
+ * ## Event: `view.Document#clipboardOutput`
110
+ *
111
+ * 1. Processes `data.content` to HTML and plain text with the
112
+ * {@link module:engine/controller/datacontroller~DataController#htmlProcessor `DataController#htmlProcessor`}.
113
+ * 2. Updates the `data.dataTransfer` data for `text/html` and `text/plain` with the processed data.
114
+ * 3. For the `cut` method, calls {@link module:engine/model/model~Model#deleteContent `model.deleteContent()`}
115
+ * on the current selection.
116
+ *
117
+ * Read more about the clipboard integration in the {@glink framework/deep-dive/clipboard clipboard deep-dive} guide.
118
+ */
119
+ export default class ClipboardPipeline extends Plugin {
120
+ /**
121
+ * @inheritDoc
122
+ */
123
+ static get pluginName() {
124
+ return 'ClipboardPipeline';
125
+ }
126
+ /**
127
+ * @inheritDoc
128
+ */
129
+ init() {
130
+ const editor = this.editor;
131
+ const view = editor.editing.view;
132
+ view.addObserver(ClipboardObserver);
133
+ this._setupPasteDrop();
134
+ this._setupCopyCut();
135
+ }
136
+ /**
137
+ * Fires Clipboard `'outputTransformation'` event for given parameters.
138
+ *
139
+ * @internal
140
+ */
141
+ _fireOutputTransformationEvent(dataTransfer, selection, method) {
142
+ const content = this.editor.model.getSelectedContent(selection);
143
+ this.fire('outputTransformation', {
144
+ dataTransfer,
145
+ content,
146
+ method
147
+ });
148
+ }
149
+ /**
150
+ * The clipboard paste pipeline.
151
+ */
152
+ _setupPasteDrop() {
153
+ const editor = this.editor;
154
+ const model = editor.model;
155
+ const view = editor.editing.view;
156
+ const viewDocument = view.document;
157
+ // Pasting is disabled when selection is in non-editable place.
158
+ // Dropping is disabled in drag and drop handler.
159
+ this.listenTo(viewDocument, 'clipboardInput', (evt, data) => {
160
+ if (data.method == 'paste' && !editor.model.canEditAt(editor.model.document.selection)) {
161
+ evt.stop();
162
+ }
163
+ }, { priority: 'highest' });
164
+ this.listenTo(viewDocument, 'clipboardInput', (evt, data) => {
165
+ const dataTransfer = data.dataTransfer;
166
+ let content;
167
+ // Some feature could already inject content in the higher priority event handler (i.e., codeBlock).
168
+ if (data.content) {
169
+ content = data.content;
170
+ }
171
+ else {
172
+ let contentData = '';
173
+ if (dataTransfer.getData('text/html')) {
174
+ contentData = normalizeClipboardHtml(dataTransfer.getData('text/html'));
175
+ }
176
+ else if (dataTransfer.getData('text/plain')) {
177
+ contentData = plainTextToHtml(dataTransfer.getData('text/plain'));
178
+ }
179
+ content = this.editor.data.htmlProcessor.toView(contentData);
180
+ }
181
+ const eventInfo = new EventInfo(this, 'inputTransformation');
182
+ this.fire(eventInfo, {
183
+ content,
184
+ dataTransfer,
185
+ targetRanges: data.targetRanges,
186
+ method: data.method
187
+ });
188
+ // If CKEditor handled the input, do not bubble the original event any further.
189
+ // This helps external integrations recognize this fact and act accordingly.
190
+ // https://github.com/ckeditor/ckeditor5-upload/issues/92
191
+ if (eventInfo.stop.called) {
192
+ evt.stop();
193
+ }
194
+ view.scrollToTheSelection();
195
+ }, { priority: 'low' });
196
+ this.listenTo(this, 'inputTransformation', (evt, data) => {
197
+ if (data.content.isEmpty) {
198
+ return;
199
+ }
200
+ const dataController = this.editor.data;
201
+ // Convert the pasted content into a model document fragment.
202
+ // The conversion is contextual, but in this case an "all allowed" context is needed
203
+ // and for that we use the $clipboardHolder item.
204
+ const modelFragment = dataController.toModel(data.content, '$clipboardHolder');
205
+ if (modelFragment.childCount == 0) {
206
+ return;
207
+ }
208
+ evt.stop();
209
+ // Fire content insertion event in a single change block to allow other handlers to run in the same block
210
+ // without post-fixers called in between (i.e., the selection post-fixer).
211
+ model.change(() => {
212
+ this.fire('contentInsertion', {
213
+ content: modelFragment,
214
+ method: data.method,
215
+ dataTransfer: data.dataTransfer,
216
+ targetRanges: data.targetRanges
217
+ });
218
+ });
219
+ }, { priority: 'low' });
220
+ this.listenTo(this, 'contentInsertion', (evt, data) => {
221
+ data.resultRange = model.insertContent(data.content);
222
+ }, { priority: 'low' });
223
+ }
224
+ /**
225
+ * The clipboard copy/cut pipeline.
226
+ */
227
+ _setupCopyCut() {
228
+ const editor = this.editor;
229
+ const modelDocument = editor.model.document;
230
+ const view = editor.editing.view;
231
+ const viewDocument = view.document;
232
+ const onCopyCut = (evt, data) => {
233
+ const dataTransfer = data.dataTransfer;
234
+ data.preventDefault();
235
+ this._fireOutputTransformationEvent(dataTransfer, modelDocument.selection, evt.name);
236
+ };
237
+ this.listenTo(viewDocument, 'copy', onCopyCut, { priority: 'low' });
238
+ this.listenTo(viewDocument, 'cut', (evt, data) => {
239
+ // Cutting is disabled when selection is in non-editable place.
240
+ // See: https://github.com/ckeditor/ckeditor5-clipboard/issues/26.
241
+ if (!editor.model.canEditAt(editor.model.document.selection)) {
242
+ data.preventDefault();
243
+ }
244
+ else {
245
+ onCopyCut(evt, data);
246
+ }
247
+ }, { priority: 'low' });
248
+ this.listenTo(this, 'outputTransformation', (evt, data) => {
249
+ const content = editor.data.toView(data.content);
250
+ viewDocument.fire('clipboardOutput', {
251
+ dataTransfer: data.dataTransfer,
252
+ content,
253
+ method: data.method
254
+ });
255
+ }, { priority: 'low' });
256
+ this.listenTo(viewDocument, 'clipboardOutput', (evt, data) => {
257
+ if (!data.content.isEmpty) {
258
+ data.dataTransfer.setData('text/html', this.editor.data.htmlProcessor.toData(data.content));
259
+ data.dataTransfer.setData('text/plain', viewToPlainText(data.content));
260
+ }
261
+ if (data.method == 'cut') {
262
+ editor.model.deleteContent(modelDocument.selection);
263
+ }
264
+ }, { priority: 'low' });
265
+ }
266
+ }