@ckeditor/ckeditor5-clipboard 41.3.1 → 41.4.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.
Files changed (144) hide show
  1. package/dist/index-content.css +4 -0
  2. package/dist/index-editor.css +23 -0
  3. package/dist/index.css +42 -0
  4. package/dist/index.css.map +1 -0
  5. package/dist/index.js +1907 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/translations/ar.d.ts +8 -0
  8. package/dist/translations/ar.js +5 -0
  9. package/dist/translations/ar.umd.js +11 -0
  10. package/dist/translations/bg.d.ts +8 -0
  11. package/dist/translations/bg.js +5 -0
  12. package/dist/translations/bg.umd.js +11 -0
  13. package/dist/translations/bn.d.ts +8 -0
  14. package/dist/translations/bn.js +5 -0
  15. package/dist/translations/bn.umd.js +11 -0
  16. package/dist/translations/ca.d.ts +8 -0
  17. package/dist/translations/ca.js +5 -0
  18. package/dist/translations/ca.umd.js +11 -0
  19. package/dist/translations/cs.d.ts +8 -0
  20. package/dist/translations/cs.js +5 -0
  21. package/dist/translations/cs.umd.js +11 -0
  22. package/dist/translations/da.d.ts +8 -0
  23. package/dist/translations/da.js +5 -0
  24. package/dist/translations/da.umd.js +11 -0
  25. package/dist/translations/de.d.ts +8 -0
  26. package/dist/translations/de.js +5 -0
  27. package/dist/translations/de.umd.js +11 -0
  28. package/dist/translations/el.d.ts +8 -0
  29. package/dist/translations/el.js +5 -0
  30. package/dist/translations/el.umd.js +11 -0
  31. package/dist/translations/en.d.ts +8 -0
  32. package/dist/translations/en.js +5 -0
  33. package/dist/translations/en.umd.js +11 -0
  34. package/dist/translations/es-co.d.ts +8 -0
  35. package/dist/translations/es-co.js +5 -0
  36. package/dist/translations/es-co.umd.js +11 -0
  37. package/dist/translations/es.d.ts +8 -0
  38. package/dist/translations/es.js +5 -0
  39. package/dist/translations/es.umd.js +11 -0
  40. package/dist/translations/et.d.ts +8 -0
  41. package/dist/translations/et.js +5 -0
  42. package/dist/translations/et.umd.js +11 -0
  43. package/dist/translations/fi.d.ts +8 -0
  44. package/dist/translations/fi.js +5 -0
  45. package/dist/translations/fi.umd.js +11 -0
  46. package/dist/translations/fr.d.ts +8 -0
  47. package/dist/translations/fr.js +5 -0
  48. package/dist/translations/fr.umd.js +11 -0
  49. package/dist/translations/he.d.ts +8 -0
  50. package/dist/translations/he.js +5 -0
  51. package/dist/translations/he.umd.js +11 -0
  52. package/dist/translations/hi.d.ts +8 -0
  53. package/dist/translations/hi.js +5 -0
  54. package/dist/translations/hi.umd.js +11 -0
  55. package/dist/translations/hr.d.ts +8 -0
  56. package/dist/translations/hr.js +5 -0
  57. package/dist/translations/hr.umd.js +11 -0
  58. package/dist/translations/hu.d.ts +8 -0
  59. package/dist/translations/hu.js +5 -0
  60. package/dist/translations/hu.umd.js +11 -0
  61. package/dist/translations/id.d.ts +8 -0
  62. package/dist/translations/id.js +5 -0
  63. package/dist/translations/id.umd.js +11 -0
  64. package/dist/translations/it.d.ts +8 -0
  65. package/dist/translations/it.js +5 -0
  66. package/dist/translations/it.umd.js +11 -0
  67. package/dist/translations/ja.d.ts +8 -0
  68. package/dist/translations/ja.js +5 -0
  69. package/dist/translations/ja.umd.js +11 -0
  70. package/dist/translations/ko.d.ts +8 -0
  71. package/dist/translations/ko.js +5 -0
  72. package/dist/translations/ko.umd.js +11 -0
  73. package/dist/translations/lt.d.ts +8 -0
  74. package/dist/translations/lt.js +5 -0
  75. package/dist/translations/lt.umd.js +11 -0
  76. package/dist/translations/lv.d.ts +8 -0
  77. package/dist/translations/lv.js +5 -0
  78. package/dist/translations/lv.umd.js +11 -0
  79. package/dist/translations/ms.d.ts +8 -0
  80. package/dist/translations/ms.js +5 -0
  81. package/dist/translations/ms.umd.js +11 -0
  82. package/dist/translations/nl.d.ts +8 -0
  83. package/dist/translations/nl.js +5 -0
  84. package/dist/translations/nl.umd.js +11 -0
  85. package/dist/translations/no.d.ts +8 -0
  86. package/dist/translations/no.js +5 -0
  87. package/dist/translations/no.umd.js +11 -0
  88. package/dist/translations/pl.d.ts +8 -0
  89. package/dist/translations/pl.js +5 -0
  90. package/dist/translations/pl.umd.js +11 -0
  91. package/dist/translations/pt-br.d.ts +8 -0
  92. package/dist/translations/pt-br.js +5 -0
  93. package/dist/translations/pt-br.umd.js +11 -0
  94. package/dist/translations/pt.d.ts +8 -0
  95. package/dist/translations/pt.js +5 -0
  96. package/dist/translations/pt.umd.js +11 -0
  97. package/dist/translations/ro.d.ts +8 -0
  98. package/dist/translations/ro.js +5 -0
  99. package/dist/translations/ro.umd.js +11 -0
  100. package/dist/translations/ru.d.ts +8 -0
  101. package/dist/translations/ru.js +5 -0
  102. package/dist/translations/ru.umd.js +11 -0
  103. package/dist/translations/sk.d.ts +8 -0
  104. package/dist/translations/sk.js +5 -0
  105. package/dist/translations/sk.umd.js +11 -0
  106. package/dist/translations/sr.d.ts +8 -0
  107. package/dist/translations/sr.js +5 -0
  108. package/dist/translations/sr.umd.js +11 -0
  109. package/dist/translations/sv.d.ts +8 -0
  110. package/dist/translations/sv.js +5 -0
  111. package/dist/translations/sv.umd.js +11 -0
  112. package/dist/translations/th.d.ts +8 -0
  113. package/dist/translations/th.js +5 -0
  114. package/dist/translations/th.umd.js +11 -0
  115. package/dist/translations/tr.d.ts +8 -0
  116. package/dist/translations/tr.js +5 -0
  117. package/dist/translations/tr.umd.js +11 -0
  118. package/dist/translations/uk.d.ts +8 -0
  119. package/dist/translations/uk.js +5 -0
  120. package/dist/translations/uk.umd.js +11 -0
  121. package/dist/translations/vi.d.ts +8 -0
  122. package/dist/translations/vi.js +5 -0
  123. package/dist/translations/vi.umd.js +11 -0
  124. package/dist/translations/zh-cn.d.ts +8 -0
  125. package/dist/translations/zh-cn.js +5 -0
  126. package/dist/translations/zh-cn.umd.js +11 -0
  127. package/dist/translations/zh.d.ts +8 -0
  128. package/dist/translations/zh.js +5 -0
  129. package/dist/translations/zh.umd.js +11 -0
  130. package/dist/types/augmentation.d.ts +20 -0
  131. package/dist/types/clipboard.d.ts +40 -0
  132. package/dist/types/clipboardmarkersutils.d.ts +204 -0
  133. package/dist/types/clipboardobserver.d.ts +316 -0
  134. package/dist/types/clipboardpipeline.d.ts +269 -0
  135. package/dist/types/dragdrop.d.ts +106 -0
  136. package/dist/types/dragdropblocktoolbar.d.ts +51 -0
  137. package/dist/types/dragdroptarget.d.ts +98 -0
  138. package/dist/types/index.d.ts +21 -0
  139. package/dist/types/lineview.d.ts +49 -0
  140. package/dist/types/pasteplaintext.d.ts +32 -0
  141. package/dist/types/utils/normalizeclipboarddata.d.ts +19 -0
  142. package/dist/types/utils/plaintexttohtml.d.ts +18 -0
  143. package/dist/types/utils/viewtoplaintext.d.ts +19 -0
  144. package/package.json +7 -6
@@ -0,0 +1,269 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, 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
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ /**
10
+ * @module clipboard/clipboardpipeline
11
+ */
12
+ import { Plugin } from '@ckeditor/ckeditor5-core';
13
+ import type { DataTransfer, DocumentFragment, Range, ViewDocumentFragment, ViewRange, Selection, DocumentSelection } from '@ckeditor/ckeditor5-engine';
14
+ import ClipboardMarkersUtils from './clipboardmarkersutils.js';
15
+ /**
16
+ * The clipboard pipeline feature. It is responsible for intercepting the `paste` and `drop` events and
17
+ * passing the pasted content through a series of events in order to insert it into the editor's content.
18
+ * It also handles the `cut` and `copy` events to fill the native clipboard with the serialized editor's data.
19
+ *
20
+ * # Input pipeline
21
+ *
22
+ * The behavior of the default handlers (all at a `low` priority):
23
+ *
24
+ * ## Event: `paste` or `drop`
25
+ *
26
+ * 1. Translates the event data.
27
+ * 2. Fires the {@link module:engine/view/document~Document#event:clipboardInput `view.Document#clipboardInput`} event.
28
+ *
29
+ * ## Event: `view.Document#clipboardInput`
30
+ *
31
+ * 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
32
+ * from the last point.
33
+ * 2. Otherwise, it retrieves `text/html` or `text/plain` from `data.dataTransfer`.
34
+ * 3. Normalizes the raw data by applying simple filters on string data.
35
+ * 4. Processes the raw data to {@link module:engine/view/documentfragment~DocumentFragment `view.DocumentFragment`} with the
36
+ * {@link module:engine/controller/datacontroller~DataController#htmlProcessor `DataController#htmlProcessor`}.
37
+ * 5. Fires the {@link module:clipboard/clipboardpipeline~ClipboardPipeline#event:inputTransformation
38
+ * `ClipboardPipeline#inputTransformation`} event with the view document fragment in the `data.content` event field.
39
+ *
40
+ * ## Event: `ClipboardPipeline#inputTransformation`
41
+ *
42
+ * 1. Converts {@link module:engine/view/documentfragment~DocumentFragment `view.DocumentFragment`} from the `data.content` field to
43
+ * {@link module:engine/model/documentfragment~DocumentFragment `model.DocumentFragment`}.
44
+ * 2. Fires the {@link module:clipboard/clipboardpipeline~ClipboardPipeline#event:contentInsertion `ClipboardPipeline#contentInsertion`}
45
+ * event with the model document fragment in the `data.content` event field.
46
+ * **Note**: The `ClipboardPipeline#contentInsertion` event is fired within a model change block to allow other handlers
47
+ * to run in the same block without post-fixers called in between (i.e., the selection post-fixer).
48
+ *
49
+ * ## Event: `ClipboardPipeline#contentInsertion`
50
+ *
51
+ * 1. Calls {@link module:engine/model/model~Model#insertContent `model.insertContent()`} to insert `data.content`
52
+ * at the current selection position.
53
+ *
54
+ * # Output pipeline
55
+ *
56
+ * The behavior of the default handlers (all at a `low` priority):
57
+ *
58
+ * ## Event: `copy`, `cut` or `dragstart`
59
+ *
60
+ * 1. Retrieves the selected {@link module:engine/model/documentfragment~DocumentFragment `model.DocumentFragment`} by calling
61
+ * {@link module:engine/model/model~Model#getSelectedContent `model#getSelectedContent()`}.
62
+ * 2. Converts the model document fragment to {@link module:engine/view/documentfragment~DocumentFragment `view.DocumentFragment`}.
63
+ * 3. Fires the {@link module:engine/view/document~Document#event:clipboardOutput `view.Document#clipboardOutput`} event
64
+ * with the view document fragment in the `data.content` event field.
65
+ *
66
+ * ## Event: `view.Document#clipboardOutput`
67
+ *
68
+ * 1. Processes `data.content` to HTML and plain text with the
69
+ * {@link module:engine/controller/datacontroller~DataController#htmlProcessor `DataController#htmlProcessor`}.
70
+ * 2. Updates the `data.dataTransfer` data for `text/html` and `text/plain` with the processed data.
71
+ * 3. For the `cut` method, calls {@link module:engine/model/model~Model#deleteContent `model.deleteContent()`}
72
+ * on the current selection.
73
+ *
74
+ * Read more about the clipboard integration in the {@glink framework/deep-dive/clipboard clipboard deep-dive} guide.
75
+ */
76
+ export default class ClipboardPipeline extends Plugin {
77
+ /**
78
+ * @inheritDoc
79
+ */
80
+ static get pluginName(): "ClipboardPipeline";
81
+ /**
82
+ * @inheritDoc
83
+ */
84
+ static get requires(): readonly [typeof ClipboardMarkersUtils];
85
+ /**
86
+ * @inheritDoc
87
+ */
88
+ init(): void;
89
+ /**
90
+ * Fires Clipboard `'outputTransformation'` event for given parameters.
91
+ *
92
+ * @internal
93
+ */
94
+ _fireOutputTransformationEvent(dataTransfer: DataTransfer, selection: Selection | DocumentSelection, method: 'copy' | 'cut' | 'dragstart'): void;
95
+ /**
96
+ * The clipboard paste pipeline.
97
+ */
98
+ private _setupPasteDrop;
99
+ /**
100
+ * The clipboard copy/cut pipeline.
101
+ */
102
+ private _setupCopyCut;
103
+ }
104
+ /**
105
+ * Fired with the `content`, `dataTransfer`, `method`, and `targetRanges` properties:
106
+ *
107
+ * * The `content` which comes from the clipboard (it was pasted or dropped) should be processed in order to be inserted into the editor.
108
+ * * The `dataTransfer` object is available in case the transformation functions need access to the raw clipboard data.
109
+ * * The `method` indicates the original DOM event (for example `'drop'` or `'paste'`).
110
+ * * The `targetRanges` property is an array of view ranges (it is available only for `'drop'`).
111
+ *
112
+ * It is a part of the {@glink framework/deep-dive/clipboard#input-pipeline clipboard input pipeline}.
113
+ *
114
+ * **Note**: You should not stop this event if you want to change the input data. You should modify the `content` property instead.
115
+ *
116
+ * @see module:clipboard/clipboardobserver~ClipboardObserver
117
+ * @see module:clipboard/clipboardpipeline~ClipboardPipeline
118
+ *
119
+ * @eventName ~ClipboardPipeline#inputTransformation
120
+ * @param data The event data.
121
+ */
122
+ export type ClipboardInputTransformationEvent = {
123
+ name: 'inputTransformation';
124
+ args: [data: ClipboardInputTransformationData];
125
+ };
126
+ /**
127
+ * The data of 'inputTransformation' event.
128
+ */
129
+ export interface ClipboardInputTransformationData {
130
+ /**
131
+ * The event data.
132
+ * The content to be inserted into the editor. It can be modified by event listeners. Read more about the clipboard pipelines in
133
+ * the {@glink framework/deep-dive/clipboard clipboard deep-dive} guide.
134
+ */
135
+ content: ViewDocumentFragment;
136
+ /**
137
+ * The data transfer instance.
138
+ */
139
+ dataTransfer: DataTransfer;
140
+ /**
141
+ * The target drop ranges.
142
+ */
143
+ targetRanges: Array<ViewRange> | null;
144
+ /**
145
+ * Whether the event was triggered by a paste or a drop operation.
146
+ */
147
+ method: 'paste' | 'drop';
148
+ }
149
+ /**
150
+ * Fired with the `content`, `dataTransfer`, `method`, and `targetRanges` properties:
151
+ *
152
+ * * The `content` which comes from the clipboard (was pasted or dropped) should be processed in order to be inserted into the editor.
153
+ * * The `dataTransfer` object is available in case the transformation functions need access to the raw clipboard data.
154
+ * * The `method` indicates the original DOM event (for example `'drop'` or `'paste'`).
155
+ * * The `targetRanges` property is an array of view ranges (it is available only for `'drop'`).
156
+ *
157
+ * Event handlers can modify the content according to the final insertion position.
158
+ *
159
+ * It is a part of the {@glink framework/deep-dive/clipboard#input-pipeline clipboard input pipeline}.
160
+ *
161
+ * **Note**: You should not stop this event if you want to change the input data. You should modify the `content` property instead.
162
+ *
163
+ * @see module:clipboard/clipboardobserver~ClipboardObserver
164
+ * @see module:clipboard/clipboardpipeline~ClipboardPipeline
165
+ * @see module:clipboard/clipboardpipeline~ClipboardPipeline#event:inputTransformation
166
+ *
167
+ * @eventName ~ClipboardPipeline#contentInsertion
168
+ * @param data The event data.
169
+ */
170
+ export type ClipboardContentInsertionEvent = {
171
+ name: 'contentInsertion';
172
+ args: [data: ClipboardContentInsertionData];
173
+ };
174
+ /**
175
+ * The data of 'contentInsertion' event.
176
+ */
177
+ export interface ClipboardContentInsertionData {
178
+ /**
179
+ * The content to be inserted into the editor.
180
+ * Read more about the clipboard pipelines in the {@glink framework/deep-dive/clipboard clipboard deep-dive} guide.
181
+ */
182
+ content: DocumentFragment;
183
+ /**
184
+ * Whether the event was triggered by a paste or a drop operation.
185
+ */
186
+ method: 'paste' | 'drop';
187
+ /**
188
+ * The data transfer instance.
189
+ */
190
+ dataTransfer: DataTransfer;
191
+ /**
192
+ * The target drop ranges.
193
+ */
194
+ targetRanges: Array<ViewRange> | null;
195
+ /**
196
+ * The result of the `model.insertContent()` call
197
+ * (inserted by the event handler at a low priority).
198
+ */
199
+ resultRange?: Range;
200
+ }
201
+ /**
202
+ * Fired on {@link module:engine/view/document~Document#event:copy} and {@link module:engine/view/document~Document#event:cut}
203
+ * with a copy of the selected content. The content can be processed before it ends up in the clipboard.
204
+ *
205
+ * It is a part of the {@glink framework/deep-dive/clipboard#output-pipeline clipboard output pipeline}.
206
+ *
207
+ * @see module:clipboard/clipboardobserver~ClipboardObserver
208
+ * @see module:clipboard/clipboardpipeline~ClipboardPipeline
209
+ *
210
+ * @eventName module:engine/view/document~Document#clipboardOutput
211
+ * @param data The event data.
212
+ */
213
+ export type ViewDocumentClipboardOutputEvent = {
214
+ name: 'clipboardOutput';
215
+ args: [data: ViewDocumentClipboardOutputEventData];
216
+ };
217
+ /**
218
+ * The value of the 'clipboardOutput' event.
219
+ */
220
+ export interface ViewDocumentClipboardOutputEventData {
221
+ /**
222
+ * The data transfer instance.
223
+ *
224
+ * @readonly
225
+ */
226
+ dataTransfer: DataTransfer;
227
+ /**
228
+ * Content to be put into the clipboard. It can be modified by the event listeners.
229
+ * Read more about the clipboard pipelines in the {@glink framework/deep-dive/clipboard clipboard deep-dive} guide.
230
+ */
231
+ content: ViewDocumentFragment;
232
+ /**
233
+ * Whether the event was triggered by a copy or cut operation.
234
+ */
235
+ method: 'copy' | 'cut' | 'dragstart';
236
+ }
237
+ /**
238
+ * Fired on {@link module:engine/view/document~Document#event:copy}, {@link module:engine/view/document~Document#event:cut}
239
+ * and {@link module:engine/view/document~Document#event:dragstart}. The content can be processed before it ends up in the clipboard.
240
+ *
241
+ * It is a part of the {@glink framework/deep-dive/clipboard#output-pipeline clipboard output pipeline}.
242
+ *
243
+ * @eventName ~ClipboardPipeline#outputTransformation
244
+ * @param data The event data.
245
+ */
246
+ export type ClipboardOutputTransformationEvent = {
247
+ name: 'outputTransformation';
248
+ args: [data: ClipboardOutputTransformationData];
249
+ };
250
+ /**
251
+ * The value of the 'outputTransformation' event.
252
+ */
253
+ export interface ClipboardOutputTransformationData {
254
+ /**
255
+ * The data transfer instance.
256
+ *
257
+ * @readonly
258
+ */
259
+ dataTransfer: DataTransfer;
260
+ /**
261
+ * Content to be put into the clipboard. It can be modified by the event listeners.
262
+ * Read more about the clipboard pipelines in the {@glink framework/deep-dive/clipboard clipboard deep-dive} guide.
263
+ */
264
+ content: DocumentFragment;
265
+ /**
266
+ * Whether the event was triggered by a copy or cut operation.
267
+ */
268
+ method: 'copy' | 'cut' | 'dragstart';
269
+ }
@@ -0,0 +1,106 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, 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
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ /**
10
+ * @module clipboard/dragdrop
11
+ */
12
+ import { Plugin } from '@ckeditor/ckeditor5-core';
13
+ import { Widget } from '@ckeditor/ckeditor5-widget';
14
+ import ClipboardPipeline from './clipboardpipeline.js';
15
+ import DragDropTarget from './dragdroptarget.js';
16
+ import DragDropBlockToolbar from './dragdropblocktoolbar.js';
17
+ import '../theme/clipboard.css';
18
+ /**
19
+ * The drag and drop feature. It works on top of the {@link module:clipboard/clipboardpipeline~ClipboardPipeline}.
20
+ *
21
+ * Read more about the clipboard integration in the {@glink framework/deep-dive/clipboard clipboard deep-dive} guide.
22
+ *
23
+ * @internal
24
+ */
25
+ export default class DragDrop extends Plugin {
26
+ /**
27
+ * The live range over the original content that is being dragged.
28
+ */
29
+ private _draggedRange;
30
+ /**
31
+ * The UID of current dragging that is used to verify if the drop started in the same editor as the drag start.
32
+ *
33
+ * **Note**: This is a workaround for broken 'dragend' events (they are not fired if the source text node got removed).
34
+ */
35
+ private _draggingUid;
36
+ /**
37
+ * The reference to the model element that currently has a `draggable` attribute set (it is set while dragging).
38
+ */
39
+ private _draggableElement;
40
+ /**
41
+ * A delayed callback removing draggable attributes.
42
+ */
43
+ private _clearDraggableAttributesDelayed;
44
+ /**
45
+ * Whether the dragged content can be dropped only in block context.
46
+ */
47
+ private _blockMode;
48
+ /**
49
+ * DOM Emitter.
50
+ */
51
+ private _domEmitter;
52
+ /**
53
+ * The DOM element used to generate dragged preview image.
54
+ */
55
+ private _previewContainer?;
56
+ /**
57
+ * @inheritDoc
58
+ */
59
+ static get pluginName(): "DragDrop";
60
+ /**
61
+ * @inheritDoc
62
+ */
63
+ static get requires(): readonly [typeof ClipboardPipeline, typeof Widget, typeof DragDropTarget, typeof DragDropBlockToolbar];
64
+ /**
65
+ * @inheritDoc
66
+ */
67
+ init(): void;
68
+ /**
69
+ * @inheritDoc
70
+ */
71
+ destroy(): void;
72
+ /**
73
+ * Drag and drop events handling.
74
+ */
75
+ private _setupDragging;
76
+ /**
77
+ * Integration with the `clipboardInput` event.
78
+ */
79
+ private _setupClipboardInputIntegration;
80
+ /**
81
+ * Integration with the `contentInsertion` event of the clipboard pipeline.
82
+ */
83
+ private _setupContentInsertionIntegration;
84
+ /**
85
+ * Adds listeners that add the `draggable` attribute to the elements while the mouse button is down so the dragging could start.
86
+ */
87
+ private _setupDraggableAttributeHandling;
88
+ /**
89
+ * Removes the `draggable` attribute from the element that was used for dragging.
90
+ */
91
+ private _clearDraggableAttributes;
92
+ /**
93
+ * Deletes the dragged content from its original range and clears the dragging state.
94
+ *
95
+ * @param moved Whether the move succeeded.
96
+ */
97
+ private _finalizeDragging;
98
+ /**
99
+ * Sets the dragged source range based on event target and document selection.
100
+ */
101
+ private _prepareDraggedRange;
102
+ /**
103
+ * Updates the dragged preview image.
104
+ */
105
+ private _updatePreview;
106
+ }
@@ -0,0 +1,51 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, 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
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ /**
10
+ * @module clipboard/dragdropblocktoolbar
11
+ */
12
+ import { Plugin } from '@ckeditor/ckeditor5-core';
13
+ /**
14
+ * Integration of a block Drag and Drop support with the block toolbar.
15
+ *
16
+ * @internal
17
+ */
18
+ export default class DragDropBlockToolbar extends Plugin {
19
+ /**
20
+ * Whether current dragging is started by block toolbar button dragging.
21
+ */
22
+ private _isBlockDragging;
23
+ /**
24
+ * DOM Emitter.
25
+ */
26
+ private _domEmitter;
27
+ /**
28
+ * @inheritDoc
29
+ */
30
+ static get pluginName(): "DragDropBlockToolbar";
31
+ /**
32
+ * @inheritDoc
33
+ */
34
+ init(): void;
35
+ /**
36
+ * @inheritDoc
37
+ */
38
+ destroy(): void;
39
+ /**
40
+ * The `dragstart` event handler.
41
+ */
42
+ private _handleBlockDragStart;
43
+ /**
44
+ * The `dragover` and `drop` event handler.
45
+ */
46
+ private _handleBlockDragging;
47
+ /**
48
+ * The `dragend` event handler.
49
+ */
50
+ private _handleBlockDragEnd;
51
+ }
@@ -0,0 +1,98 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, 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
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ /**
10
+ * @module clipboard/dragdroptarget
11
+ */
12
+ import { Plugin } from '@ckeditor/ckeditor5-core';
13
+ import { type Range, type LiveRange, type ViewElement, type ViewRange } from '@ckeditor/ckeditor5-engine';
14
+ /**
15
+ * Part of the Drag and Drop handling. Responsible for finding and displaying the drop target.
16
+ *
17
+ * @internal
18
+ */
19
+ export default class DragDropTarget extends Plugin {
20
+ /**
21
+ * A delayed callback removing the drop marker.
22
+ *
23
+ * @internal
24
+ */
25
+ readonly removeDropMarkerDelayed: import("@ckeditor/ckeditor5-utils").DelayedFunc<() => void>;
26
+ /**
27
+ * A throttled callback updating the drop marker.
28
+ */
29
+ private readonly _updateDropMarkerThrottled;
30
+ /**
31
+ * A throttled callback reconverting the drop parker.
32
+ */
33
+ private readonly _reconvertMarkerThrottled;
34
+ /**
35
+ * The horizontal drop target line view.
36
+ */
37
+ private _dropTargetLineView;
38
+ /**
39
+ * DOM Emitter.
40
+ */
41
+ private _domEmitter;
42
+ /**
43
+ * Map of document scrollable elements.
44
+ */
45
+ private _scrollables;
46
+ /**
47
+ * @inheritDoc
48
+ */
49
+ static get pluginName(): "DragDropTarget";
50
+ /**
51
+ * @inheritDoc
52
+ */
53
+ init(): void;
54
+ /**
55
+ * @inheritDoc
56
+ */
57
+ destroy(): void;
58
+ /**
59
+ * Finds the drop target range and updates the drop marker.
60
+ *
61
+ * @internal
62
+ */
63
+ updateDropMarker(targetViewElement: ViewElement, targetViewRanges: Array<ViewRange> | null, clientX: number, clientY: number, blockMode: boolean, draggedRange: LiveRange | null): void;
64
+ /**
65
+ * Finds the final drop target range.
66
+ *
67
+ * @internal
68
+ */
69
+ getFinalDropRange(targetViewElement: ViewElement, targetViewRanges: Array<ViewRange> | null, clientX: number, clientY: number, blockMode: boolean, draggedRange: LiveRange | null): Range | null;
70
+ /**
71
+ * Removes the drop target marker.
72
+ *
73
+ * @internal
74
+ */
75
+ removeDropMarker(): void;
76
+ /**
77
+ * Creates downcast conversion for the drop target marker.
78
+ */
79
+ private _setupDropMarker;
80
+ /**
81
+ * Updates the drop target marker to the provided range.
82
+ *
83
+ * @param targetRange The range to set the marker to.
84
+ */
85
+ private _updateDropMarker;
86
+ /**
87
+ * Creates the UI element for vertical (in-line) drop target.
88
+ */
89
+ private _createDropTargetPosition;
90
+ /**
91
+ * Updates the horizontal drop target line.
92
+ */
93
+ private _updateDropTargetLine;
94
+ /**
95
+ * Finds the closest scrollable element rect for the given view element.
96
+ */
97
+ private _getScrollableRect;
98
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, 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
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ /**
10
+ * @module clipboard
11
+ */
12
+ export { default as Clipboard } from './clipboard.js';
13
+ export { default as ClipboardPipeline, type ClipboardContentInsertionEvent, type ClipboardContentInsertionData, type ClipboardInputTransformationEvent, type ClipboardInputTransformationData, type ClipboardOutputTransformationEvent, type ClipboardOutputTransformationData, type ViewDocumentClipboardOutputEvent } from './clipboardpipeline.js';
14
+ export { default as ClipboardMarkersUtils, type ClipboardMarkerRestrictedAction, type ClipboardMarkerConfiguration } from './clipboardmarkersutils.js';
15
+ export type { ClipboardEventData } from './clipboardobserver.js';
16
+ export { default as DragDrop } from './dragdrop.js';
17
+ export { default as PastePlainText } from './pasteplaintext.js';
18
+ export { default as DragDropTarget } from './dragdroptarget.js';
19
+ export { default as DragDropBlockToolbar } from './dragdropblocktoolbar.js';
20
+ export type { ViewDocumentClipboardInputEvent, ViewDocumentCopyEvent, ViewDocumentCutEvent } from './clipboardobserver.js';
21
+ import './augmentation.js';
@@ -0,0 +1,49 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, 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
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ /**
10
+ * @module clipboard/lineview
11
+ */
12
+ import { View } from '@ckeditor/ckeditor5-ui';
13
+ /**
14
+ * The horizontal drop target line view.
15
+ */
16
+ export default class LineView extends View {
17
+ /**
18
+ * Controls whether the line is visible.
19
+ *
20
+ * @observable
21
+ * @default false
22
+ */
23
+ isVisible: boolean;
24
+ /**
25
+ * Controls the line position x coordinate.
26
+ *
27
+ * @observable
28
+ * @default null
29
+ */
30
+ left: number | null;
31
+ /**
32
+ * Controls the line width.
33
+ *
34
+ * @observable
35
+ * @default null
36
+ */
37
+ width: number | null;
38
+ /**
39
+ * Controls the line position y coordinate.
40
+ *
41
+ * @observable
42
+ * @default null
43
+ */
44
+ top: number | null;
45
+ /**
46
+ * @inheritDoc
47
+ */
48
+ constructor();
49
+ }
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, 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
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ /**
10
+ * @module clipboard/pasteplaintext
11
+ */
12
+ import { Plugin } from '@ckeditor/ckeditor5-core';
13
+ import ClipboardPipeline from './clipboardpipeline.js';
14
+ /**
15
+ * The plugin detects the user's intention to paste plain text.
16
+ *
17
+ * For example, it detects the <kbd>Ctrl/Cmd</kbd> + <kbd>Shift</kbd> + <kbd>V</kbd> keystroke.
18
+ */
19
+ export default class PastePlainText extends Plugin {
20
+ /**
21
+ * @inheritDoc
22
+ */
23
+ static get pluginName(): "PastePlainText";
24
+ /**
25
+ * @inheritDoc
26
+ */
27
+ static get requires(): readonly [typeof ClipboardPipeline];
28
+ /**
29
+ * @inheritDoc
30
+ */
31
+ init(): void;
32
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, 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
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ /**
10
+ * @module clipboard/utils/normalizeclipboarddata
11
+ */
12
+ /**
13
+ * Removes some popular browser quirks out of the clipboard data (HTML).
14
+ * Removes all HTML comments. These are considered an internal thing and it makes little sense if they leak into the editor data.
15
+ *
16
+ * @param data The HTML data to normalize.
17
+ * @returns Normalized HTML.
18
+ */
19
+ export default function normalizeClipboardData(data: string): string;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, 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
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ /**
10
+ * @module clipboard/utils/plaintexttohtml
11
+ */
12
+ /**
13
+ * Converts plain text to its HTML-ized version.
14
+ *
15
+ * @param text The plain text to convert.
16
+ * @returns HTML generated from the plain text.
17
+ */
18
+ export default function plainTextToHtml(text: string): string;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, 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
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ /**
10
+ * @module clipboard/utils/viewtoplaintext
11
+ */
12
+ import type { ViewDocumentFragment, ViewItem } from '@ckeditor/ckeditor5-engine';
13
+ /**
14
+ * Converts {@link module:engine/view/item~Item view item} and all of its children to plain text.
15
+ *
16
+ * @param viewItem View item to convert.
17
+ * @returns Plain text representation of `viewItem`.
18
+ */
19
+ export default function viewToPlainText(viewItem: ViewItem | ViewDocumentFragment): string;