@ckeditor/ckeditor5-clipboard 35.3.2 → 36.0.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.
package/LICENSE.md CHANGED
@@ -2,7 +2,7 @@ Software License Agreement
2
2
  ==========================
3
3
 
4
4
  **CKEditor 5 clipboard feature** – https://github.com/ckeditor/ckeditor5-clipboard <br>
5
- Copyright (c) 2003-2022, [CKSource Holding sp. z o.o.](https://cksource.com) All rights reserved.
5
+ Copyright (c) 2003-2023, [CKSource Holding sp. z o.o.](https://cksource.com) All rights reserved.
6
6
 
7
7
  Licensed under the terms of [GNU General Public License Version 2 or later](http://www.gnu.org/licenses/gpl.html).
8
8
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-clipboard",
3
- "version": "35.3.2",
3
+ "version": "36.0.0",
4
4
  "description": "Clipboard integration feature for CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -12,30 +12,30 @@
12
12
  ],
13
13
  "main": "src/index.js",
14
14
  "dependencies": {
15
- "@ckeditor/ckeditor5-core": "^35.3.2",
16
- "@ckeditor/ckeditor5-engine": "^35.3.2",
17
- "@ckeditor/ckeditor5-utils": "^35.3.2",
18
- "@ckeditor/ckeditor5-widget": "^35.3.2",
15
+ "@ckeditor/ckeditor5-core": "^36.0.0",
16
+ "@ckeditor/ckeditor5-engine": "^36.0.0",
17
+ "@ckeditor/ckeditor5-utils": "^36.0.0",
18
+ "@ckeditor/ckeditor5-widget": "^36.0.0",
19
19
  "lodash-es": "^4.17.11"
20
20
  },
21
21
  "devDependencies": {
22
- "@ckeditor/ckeditor5-alignment": "^35.3.2",
23
- "@ckeditor/ckeditor5-basic-styles": "^35.3.2",
24
- "@ckeditor/ckeditor5-block-quote": "^35.3.2",
25
- "@ckeditor/ckeditor5-cloud-services": "^35.3.2",
26
- "@ckeditor/ckeditor5-code-block": "^35.3.2",
27
- "@ckeditor/ckeditor5-easy-image": "^35.3.2",
28
- "@ckeditor/ckeditor5-editor-classic": "^35.3.2",
29
- "@ckeditor/ckeditor5-enter": "^35.3.2",
30
- "@ckeditor/ckeditor5-horizontal-line": "^35.3.2",
31
- "@ckeditor/ckeditor5-image": "^35.3.2",
32
- "@ckeditor/ckeditor5-link": "^35.3.2",
33
- "@ckeditor/ckeditor5-page-break": "^35.3.2",
34
- "@ckeditor/ckeditor5-paragraph": "^35.3.2",
35
- "@ckeditor/ckeditor5-paste-from-office": "^35.3.2",
36
- "@ckeditor/ckeditor5-remove-format": "^35.3.2",
37
- "@ckeditor/ckeditor5-table": "^35.3.2",
38
- "@ckeditor/ckeditor5-typing": "^35.3.2",
22
+ "@ckeditor/ckeditor5-alignment": "^36.0.0",
23
+ "@ckeditor/ckeditor5-basic-styles": "^36.0.0",
24
+ "@ckeditor/ckeditor5-block-quote": "^36.0.0",
25
+ "@ckeditor/ckeditor5-cloud-services": "^36.0.0",
26
+ "@ckeditor/ckeditor5-code-block": "^36.0.0",
27
+ "@ckeditor/ckeditor5-easy-image": "^36.0.0",
28
+ "@ckeditor/ckeditor5-editor-classic": "^36.0.0",
29
+ "@ckeditor/ckeditor5-enter": "^36.0.0",
30
+ "@ckeditor/ckeditor5-horizontal-line": "^36.0.0",
31
+ "@ckeditor/ckeditor5-image": "^36.0.0",
32
+ "@ckeditor/ckeditor5-link": "^36.0.0",
33
+ "@ckeditor/ckeditor5-page-break": "^36.0.0",
34
+ "@ckeditor/ckeditor5-paragraph": "^36.0.0",
35
+ "@ckeditor/ckeditor5-paste-from-office": "^36.0.0",
36
+ "@ckeditor/ckeditor5-remove-format": "^36.0.0",
37
+ "@ckeditor/ckeditor5-table": "^36.0.0",
38
+ "@ckeditor/ckeditor5-typing": "^36.0.0",
39
39
  "typescript": "^4.8.4",
40
40
  "webpack": "^5.58.1",
41
41
  "webpack-cli": "^4.9.0"
package/src/clipboard.js CHANGED
@@ -1,25 +1,23 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
  /**
6
6
  * @module clipboard/clipboard
7
7
  */
8
- import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
8
+ import { Plugin } from '@ckeditor/ckeditor5-core';
9
9
  import ClipboardPipeline from './clipboardpipeline';
10
10
  import DragDrop from './dragdrop';
11
11
  import PastePlainText from './pasteplaintext';
12
12
  /**
13
13
  * The clipboard feature.
14
14
  *
15
- * Read more about the clipboard integration in the {@glink framework/guides/deep-dive/clipboard clipboard deep dive guide}.
15
+ * Read more about the clipboard integration in the {@glink framework/guides/deep-dive/clipboard clipboard deep-dive guide}.
16
16
  *
17
17
  * This is a "glue" plugin which loads the following plugins:
18
18
  * * {@link module:clipboard/clipboardpipeline~ClipboardPipeline}
19
19
  * * {@link module:clipboard/dragdrop~DragDrop}
20
20
  * * {@link module:clipboard/pasteplaintext~PastePlainText}
21
- *
22
- * @extends module:core/plugin~Plugin
23
21
  */
24
22
  export default class Clipboard extends Plugin {
25
23
  /**
@@ -1,13 +1,12 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
  /**
6
6
  * @module clipboard/clipboardobserver
7
7
  */
8
- import DomEventObserver from '@ckeditor/ckeditor5-engine/src/view/observer/domeventobserver';
9
- import EventInfo from '@ckeditor/ckeditor5-utils/src/eventinfo';
10
- import DataTransfer from '@ckeditor/ckeditor5-engine/src/view/datatransfer';
8
+ import { EventInfo } from '@ckeditor/ckeditor5-utils';
9
+ import { DataTransfer, DomEventObserver } from '@ckeditor/ckeditor5-engine';
11
10
  /**
12
11
  * Clipboard events observer.
13
12
  *
@@ -29,8 +28,6 @@ import DataTransfer from '@ckeditor/ckeditor5-engine/src/view/datatransfer';
29
28
  * To make it available, it needs to be added to {@link module:engine/view/document~Document} by using
30
29
  * the {@link module:engine/view/view~View#addObserver `View#addObserver()`} method. Alternatively, you can load the
31
30
  * {@link module:clipboard/clipboard~Clipboard} plugin which adds this observer automatically (because it uses it).
32
- *
33
- * @extends module:engine/view/observer/domeventobserver~DomEventObserver
34
31
  */
35
32
  export default class ClipboardObserver extends DomEventObserver {
36
33
  constructor(view) {
@@ -90,193 +87,3 @@ function getDropViewRange(view, domEvent) {
90
87
  }
91
88
  return null;
92
89
  }
93
- /**
94
- * Fired as a continuation of the {@link #event:paste} and {@link #event:drop} events.
95
- *
96
- * It is a part of the {@glink framework/guides/deep-dive/clipboard#input-pipeline clipboard input pipeline}.
97
- *
98
- * This event carries a `dataTransfer` object which comes from the clipboard and whose content should be processed
99
- * and inserted into the editor.
100
- *
101
- * **Note**: This event is not available by default. To make it available, {@link module:clipboard/clipboardobserver~ClipboardObserver}
102
- * needs to be added to the {@link module:engine/view/document~Document} by using the {@link module:engine/view/view~View#addObserver}
103
- * method. This is usually done by the {@link module:clipboard/clipboard~Clipboard} plugin, but if for some reason it is not loaded,
104
- * the observer must be added manually.
105
- *
106
- * @see module:clipboard/clipboardobserver~ClipboardObserver
107
- * @see module:clipboard/clipboard~Clipboard
108
- * @event module:engine/view/document~Document#event:clipboardInput
109
- * @param {Object} data The event data.
110
- * @param {module:engine/view/datatransfer~DataTransfer} data.dataTransfer Data transfer instance.
111
- * @param {'paste'|'drop'} method Whether the event was triggered by a paste or drop operation.
112
- * @param {module:engine/view/element~Element} target The tree view element representing the target.
113
- * @param {Array.<module:engine/view/range~Range>} data.targetRanges Ranges which are the target of the operation
114
- * (usually – into which the content should be inserted).
115
- * If the clipboard input was triggered by a paste operation, this property is not set. If by a drop operation,
116
- * then it is the drop position (which can be different than the selection at the moment of drop).
117
- */
118
- /**
119
- * Fired when the user drags the content over one of the editing roots of the editor.
120
- *
121
- * Introduced by {@link module:clipboard/clipboardobserver~ClipboardObserver}.
122
- *
123
- * **Note**: This event is not available by default. To make it available, {@link module:clipboard/clipboardobserver~ClipboardObserver}
124
- * needs to be added to the {@link module:engine/view/document~Document} by using the {@link module:engine/view/view~View#addObserver}
125
- * method. This is usually done by the {@link module:clipboard/clipboard~Clipboard} plugin, but if for some reason it is not loaded,
126
- * the observer must be added manually.
127
- *
128
- * @see module:engine/view/document~Document#event:clipboardInput
129
- * @event module:engine/view/document~Document#event:dragover
130
- * @param {module:clipboard/clipboardobserver~ClipboardEventData} data The event data.
131
- */
132
- /**
133
- * Fired when the user dropped the content into one of the editing roots of the editor.
134
- *
135
- * Introduced by {@link module:clipboard/clipboardobserver~ClipboardObserver}.
136
- *
137
- * **Note**: This event is not available by default. To make it available, {@link module:clipboard/clipboardobserver~ClipboardObserver}
138
- * needs to be added to the {@link module:engine/view/document~Document} by using the {@link module:engine/view/view~View#addObserver}
139
- * method. This is usually done by the {@link module:clipboard/clipboard~Clipboard} plugin, but if for some reason it is not loaded,
140
- * the observer must be added manually.
141
- *
142
- * @see module:engine/view/document~Document#event:clipboardInput
143
- * @event module:engine/view/document~Document#event:drop
144
- * @param {module:clipboard/clipboardobserver~ClipboardEventData} data The event data.
145
- * @param {module:engine/view/range~Range} dropRange The position into which the content is dropped.
146
- */
147
- /**
148
- * Fired when the user pasted the content into one of the editing roots of the editor.
149
- *
150
- * Introduced by {@link module:clipboard/clipboardobserver~ClipboardObserver}.
151
- *
152
- * **Note**: This event is not available by default. To make it available, {@link module:clipboard/clipboardobserver~ClipboardObserver}
153
- * needs to be added to the {@link module:engine/view/document~Document} by using the {@link module:engine/view/view~View#addObserver}
154
- * method. This is usually done by the {@link module:clipboard/clipboard~Clipboard} plugin, but if for some reason it is not loaded,
155
- * the observer must be added manually.
156
- *
157
- * @see module:engine/view/document~Document#event:clipboardInput
158
- * @event module:engine/view/document~Document#event:paste
159
- * @param {module:clipboard/clipboardobserver~ClipboardEventData} data The event data.
160
- */
161
- /**
162
- * Fired when the user copied the content from one of the editing roots of the editor.
163
- *
164
- * Introduced by {@link module:clipboard/clipboardobserver~ClipboardObserver}.
165
- *
166
- * **Note**: This event is not available by default. To make it available, {@link module:clipboard/clipboardobserver~ClipboardObserver}
167
- * needs to be added to the {@link module:engine/view/document~Document} by using the {@link module:engine/view/view~View#addObserver}
168
- * method. This is usually done by the {@link module:clipboard/clipboard~Clipboard} plugin, but if for some reason it is not loaded,
169
- * the observer must be added manually.
170
- *
171
- * @see module:clipboard/clipboardobserver~ClipboardObserver
172
- * @event module:engine/view/document~Document#event:copy
173
- * @param {module:clipboard/clipboardobserver~ClipboardEventData} data The event data.
174
- */
175
- /**
176
- * Fired when the user cut the content from one of the editing roots of the editor.
177
- *
178
- * Introduced by {@link module:clipboard/clipboardobserver~ClipboardObserver}.
179
- *
180
- * **Note**: This event is not available by default. To make it available, {@link module:clipboard/clipboardobserver~ClipboardObserver}
181
- * needs to be added to the {@link module:engine/view/document~Document} by using the {@link module:engine/view/view~View#addObserver}
182
- * method. This is usually done by the {@link module:clipboard/clipboard~Clipboard} plugin, but if for some reason it is not loaded,
183
- * the observer must be added manually.
184
- *
185
- * @see module:clipboard/clipboardobserver~ClipboardObserver
186
- * @event module:engine/view/document~Document#event:cut
187
- * @param {module:clipboard/clipboardobserver~ClipboardEventData} data The event data.
188
- */
189
- /**
190
- * The value of the {@link module:engine/view/document~Document#event:paste},
191
- * {@link module:engine/view/document~Document#event:copy} and {@link module:engine/view/document~Document#event:cut} events.
192
- *
193
- * In order to access the clipboard data, use the `dataTransfer` property.
194
- *
195
- * @class module:clipboard/clipboardobserver~ClipboardEventData
196
- * @extends module:engine/view/observer/domeventdata~DomEventData
197
- */
198
- /**
199
- * The data transfer instance.
200
- *
201
- * @readonly
202
- * @member {module:engine/view/datatransfer~DataTransfer} module:clipboard/clipboardobserver~ClipboardEventData#dataTransfer
203
- */
204
- /**
205
- * Fired as a continuation of the {@link #event:dragover} event.
206
- *
207
- * It is a part of the {@glink framework/guides/deep-dive/clipboard#input-pipeline clipboard input pipeline}.
208
- *
209
- * This event carries a `dataTransfer` object which comes from the clipboard and whose content should be processed
210
- * and inserted into the editor.
211
- *
212
- * **Note**: This event is not available by default. To make it available, {@link module:clipboard/clipboardobserver~ClipboardObserver}
213
- * needs to be added to the {@link module:engine/view/document~Document} by using the {@link module:engine/view/view~View#addObserver}
214
- * method. This is usually done by the {@link module:clipboard/clipboard~Clipboard} plugin, but if for some reason it is not loaded,
215
- * the observer must be added manually.
216
- *
217
- * @see module:clipboard/clipboardobserver~ClipboardObserver
218
- * @see module:clipboard/clipboard~Clipboard
219
- * @event module:engine/view/document~Document#event:dragging
220
- * @param {Object} data The event data.
221
- * @param {module:engine/view/datatransfer~DataTransfer} data.dataTransfer The data transfer instance.
222
- * @param {module:engine/view/element~Element} target The tree view element representing the target.
223
- * @param {Array.<module:engine/view/range~Range>} data.targetRanges Ranges which are the target of the operation
224
- * (usually – into which the content should be inserted).
225
- * It is the drop position (which can be different than the selection at the moment of drop).
226
- */
227
- /**
228
- * Fired when the user starts dragging the content in one of the editing roots of the editor.
229
- *
230
- * Introduced by {@link module:clipboard/clipboardobserver~ClipboardObserver}.
231
- *
232
- * **Note**: This event is not available by default. To make it available, {@link module:clipboard/clipboardobserver~ClipboardObserver}
233
- * needs to be added to the {@link module:engine/view/document~Document} by using the {@link module:engine/view/view~View#addObserver}
234
- * method. This is usually done by the {@link module:clipboard/clipboard~Clipboard} plugin, but if for some reason it is not loaded,
235
- * the observer must be added manually.
236
- *
237
- * @see module:engine/view/document~Document#event:clipboardInput
238
- * @event module:engine/view/document~Document#event:dragstart
239
- * @param {module:clipboard/clipboardobserver~ClipboardEventData} data The event data.
240
- */
241
- /**
242
- * Fired when the user ended dragging the content.
243
- *
244
- * Introduced by {@link module:clipboard/clipboardobserver~ClipboardObserver}.
245
- *
246
- * **Note**: This event is not available by default. To make it available, {@link module:clipboard/clipboardobserver~ClipboardObserver}
247
- * needs to be added to the {@link module:engine/view/document~Document} by using the {@link module:engine/view/view~View#addObserver}
248
- * method. This is usually done by the {@link module:clipboard/clipboard~Clipboard} plugin, but if for some reason it is not loaded,
249
- * the observer must be added manually.
250
- *
251
- * @see module:engine/view/document~Document#event:clipboardInput
252
- * @event module:engine/view/document~Document#event:dragend
253
- * @param {module:clipboard/clipboardobserver~ClipboardEventData} data The event data.
254
- */
255
- /**
256
- * Fired when the user drags the content into one of the editing roots of the editor.
257
- *
258
- * Introduced by {@link module:clipboard/clipboardobserver~ClipboardObserver}.
259
- *
260
- * **Note**: This event is not available by default. To make it available, {@link module:clipboard/clipboardobserver~ClipboardObserver}
261
- * needs to be added to the {@link module:engine/view/document~Document} by using the {@link module:engine/view/view~View#addObserver}
262
- * method. This is usually done by the {@link module:clipboard/clipboard~Clipboard} plugin, but if for some reason it is not loaded,
263
- * the observer must be added manually.
264
- *
265
- * @see module:engine/view/document~Document#event:clipboardInput
266
- * @event module:engine/view/document~Document#event:dragenter
267
- * @param {module:clipboard/clipboardobserver~ClipboardEventData} data The event data.
268
- */
269
- /**
270
- * Fired when the user drags the content out of one of the editing roots of the editor.
271
- *
272
- * Introduced by {@link module:clipboard/clipboardobserver~ClipboardObserver}.
273
- *
274
- * **Note**: This event is not available by default. To make it available, {@link module:clipboard/clipboardobserver~ClipboardObserver}
275
- * needs to be added to the {@link module:engine/view/document~Document} by using the {@link module:engine/view/view~View#addObserver}
276
- * method. This is usually done by the {@link module:clipboard/clipboard~Clipboard} plugin, but if for some reason it is not loaded,
277
- * the observer must be added manually.
278
- *
279
- * @see module:engine/view/document~Document#event:clipboardInput
280
- * @event module:engine/view/document~Document#event:dragleave
281
- * @param {module:clipboard/clipboardobserver~ClipboardEventData} data The event data.
282
- */
@@ -1,12 +1,12 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
  /**
6
6
  * @module clipboard/clipboardpipeline
7
7
  */
8
- import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
9
- import EventInfo from '@ckeditor/ckeditor5-utils/src/eventinfo';
8
+ import { Plugin } from '@ckeditor/ckeditor5-core';
9
+ import { EventInfo } from '@ckeditor/ckeditor5-utils';
10
10
  import ClipboardObserver from './clipboardobserver';
11
11
  import plainTextToHtml from './utils/plaintexttohtml';
12
12
  import normalizeClipboardHtml from './utils/normalizeclipboarddata';
@@ -109,9 +109,7 @@ import viewToPlainText from './utils/viewtoplaintext';
109
109
  * 3. For the `cut` method, calls {@link module:engine/model/model~Model#deleteContent `model.deleteContent()`}
110
110
  * on the current selection.
111
111
  *
112
- * Read more about the clipboard integration in the {@glink framework/guides/deep-dive/clipboard clipboard deep dive guide}.
113
- *
114
- * @extends module:core/plugin~Plugin
112
+ * Read more about the clipboard integration in the {@glink framework/guides/deep-dive/clipboard clipboard deep-dive guide}.
115
113
  */
116
114
  export default class ClipboardPipeline extends Plugin {
117
115
  /**
@@ -132,8 +130,6 @@ export default class ClipboardPipeline extends Plugin {
132
130
  }
133
131
  /**
134
132
  * The clipboard paste pipeline.
135
- *
136
- * @private
137
133
  */
138
134
  _setupPasteDrop() {
139
135
  const editor = this.editor;
@@ -209,8 +205,6 @@ export default class ClipboardPipeline extends Plugin {
209
205
  }
210
206
  /**
211
207
  * The clipboard copy/cut pipeline.
212
- *
213
- * @private
214
208
  */
215
209
  _setupCopyCut() {
216
210
  const editor = this.editor;
package/src/dragdrop.js CHANGED
@@ -1,18 +1,15 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
  /**
6
6
  * @module clipboard/dragdrop
7
7
  */
8
8
  /* globals setTimeout, clearTimeout */
9
- import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
10
- import LiveRange from '@ckeditor/ckeditor5-engine/src/model/liverange';
11
- import MouseObserver from '@ckeditor/ckeditor5-engine/src/view/observer/mouseobserver';
12
- import Widget from '@ckeditor/ckeditor5-widget/src/widget';
13
- import uid from '@ckeditor/ckeditor5-utils/src/uid';
14
- import env from '@ckeditor/ckeditor5-utils/src/env';
15
- import { isWidget } from '@ckeditor/ckeditor5-widget/src/utils';
9
+ import { Plugin } from '@ckeditor/ckeditor5-core';
10
+ import { LiveRange, MouseObserver } from '@ckeditor/ckeditor5-engine';
11
+ import { Widget, isWidget } from '@ckeditor/ckeditor5-widget';
12
+ import { env, uid } from '@ckeditor/ckeditor5-utils';
16
13
  import ClipboardPipeline from './clipboardpipeline';
17
14
  import ClipboardObserver from './clipboardobserver';
18
15
  import { throttle } from 'lodash-es';
@@ -97,9 +94,7 @@ import '../theme/clipboard.css';
97
94
  /**
98
95
  * The drag and drop feature. It works on top of the {@link module:clipboard/clipboardpipeline~ClipboardPipeline}.
99
96
  *
100
- * Read more about the clipboard integration in the {@glink framework/guides/deep-dive/clipboard clipboard deep dive guide}.
101
- *
102
- * @extends module:core/plugin~Plugin
97
+ * Read more about the clipboard integration in the {@glink framework/guides/deep-dive/clipboard clipboard deep-dive guide}.
103
98
  */
104
99
  export default class DragDrop extends Plugin {
105
100
  /**
@@ -120,49 +115,11 @@ export default class DragDrop extends Plugin {
120
115
  init() {
121
116
  const editor = this.editor;
122
117
  const view = editor.editing.view;
123
- /**
124
- * The live range over the original content that is being dragged.
125
- *
126
- * @private
127
- * @type {module:engine/model/liverange~LiveRange}
128
- */
129
118
  this._draggedRange = null;
130
- /**
131
- * The UID of current dragging that is used to verify if the drop started in the same editor as the drag start.
132
- *
133
- * **Note**: This is a workaround for broken 'dragend' events (they are not fired if the source text node got removed).
134
- *
135
- * @private
136
- * @type {String}
137
- */
138
119
  this._draggingUid = '';
139
- /**
140
- * The reference to the model element that currently has a `draggable` attribute set (it is set while dragging).
141
- *
142
- * @private
143
- * @type {module:engine/model/element~Element}
144
- */
145
120
  this._draggableElement = null;
146
- /**
147
- * A throttled callback updating the drop marker.
148
- *
149
- * @private
150
- * @type {Function}
151
- */
152
121
  this._updateDropMarkerThrottled = throttle(targetRange => this._updateDropMarker(targetRange), 40);
153
- /**
154
- * A delayed callback removing the drop marker.
155
- *
156
- * @private
157
- * @type {Function}
158
- */
159
122
  this._removeDropMarkerDelayed = delay(() => this._removeDropMarker(), 40);
160
- /**
161
- * A delayed callback removing draggable attributes.
162
- *
163
- * @private
164
- * @type {Function}
165
- */
166
123
  this._clearDraggableAttributesDelayed = delay(() => this._clearDraggableAttributes(), 40);
167
124
  view.addObserver(ClipboardObserver);
168
125
  view.addObserver(MouseObserver);
@@ -203,8 +160,6 @@ export default class DragDrop extends Plugin {
203
160
  }
204
161
  /**
205
162
  * Drag and drop events handling.
206
- *
207
- * @private
208
163
  */
209
164
  _setupDragging() {
210
165
  const editor = this.editor;
@@ -309,8 +264,6 @@ export default class DragDrop extends Plugin {
309
264
  }
310
265
  /**
311
266
  * Integration with the `clipboardInput` event.
312
- *
313
- * @private
314
267
  */
315
268
  _setupClipboardInputIntegration() {
316
269
  const editor = this.editor;
@@ -351,8 +304,6 @@ export default class DragDrop extends Plugin {
351
304
  }
352
305
  /**
353
306
  * Integration with the `contentInsertion` event of the clipboard pipeline.
354
- *
355
- * @private
356
307
  */
357
308
  _setupContentInsertionIntegration() {
358
309
  const clipboardPipeline = this.editor.plugins.get(ClipboardPipeline);
@@ -380,8 +331,6 @@ export default class DragDrop extends Plugin {
380
331
  }
381
332
  /**
382
333
  * Adds listeners that add the `draggable` attribute to the elements while the mouse button is down so the dragging could start.
383
- *
384
- * @private
385
334
  */
386
335
  _setupDraggableAttributeHandling() {
387
336
  const editor = this.editor;
@@ -428,8 +377,6 @@ export default class DragDrop extends Plugin {
428
377
  }
429
378
  /**
430
379
  * Removes the `draggable` attribute from the element that was used for dragging.
431
- *
432
- * @private
433
380
  */
434
381
  _clearDraggableAttributes() {
435
382
  const editing = this.editor.editing;
@@ -443,8 +390,6 @@ export default class DragDrop extends Plugin {
443
390
  }
444
391
  /**
445
392
  * Creates downcast conversion for the drop target marker.
446
- *
447
- * @private
448
393
  */
449
394
  _setupDropMarker() {
450
395
  const editor = this.editor;
@@ -475,8 +420,7 @@ export default class DragDrop extends Plugin {
475
420
  /**
476
421
  * Updates the drop target marker to the provided range.
477
422
  *
478
- * @private
479
- * @param {module:engine/model/range~Range} targetRange The range to set the marker to.
423
+ * @param targetRange The range to set the marker to.
480
424
  */
481
425
  _updateDropMarker(targetRange) {
482
426
  const editor = this.editor;
@@ -498,8 +442,6 @@ export default class DragDrop extends Plugin {
498
442
  }
499
443
  /**
500
444
  * Removes the drop target marker.
501
- *
502
- * @private
503
445
  */
504
446
  _removeDropMarker() {
505
447
  const model = this.editor.model;
@@ -514,8 +456,7 @@ export default class DragDrop extends Plugin {
514
456
  /**
515
457
  * Deletes the dragged content from its original range and clears the dragging state.
516
458
  *
517
- * @private
518
- * @param {Boolean} moved Whether the move succeeded.
459
+ * @param moved Whether the move succeeded.
519
460
  */
520
461
  _finalizeDragging(moved) {
521
462
  const editor = this.editor;
@@ -537,12 +478,9 @@ export default class DragDrop extends Plugin {
537
478
  this._draggedRange = null;
538
479
  }
539
480
  }
540
- // Returns fixed selection range for given position and target element.
541
- //
542
- // @param {module:core/editor/editor~Editor} editor
543
- // @param {Array.<module:engine/view/range~Range>} targetViewRanges
544
- // @param {module:engine/view/element~Element} targetViewElement
545
- // @returns {module:engine/model/range~Range|null}
481
+ /**
482
+ * Returns fixed selection range for given position and target element.
483
+ */
546
484
  function findDropTargetRange(editor, targetViewRanges, targetViewElement) {
547
485
  const model = editor.model;
548
486
  const mapper = editor.editing.mapper;
@@ -584,11 +522,9 @@ function findDropTargetRange(editor, targetViewRanges, targetViewElement) {
584
522
  // so a nested editable, but view target position was directly in the `<figure>` element).
585
523
  return findDropTargetRangeOnAncestorObject(editor, targetModelPosition.parent);
586
524
  }
587
- // Returns fixed selection range for a given position and a target element if it is over the widget but not over its nested editable.
588
- //
589
- // @param {module:core/editor/editor~Editor} editor
590
- // @param {module:engine/view/element~Element} targetViewElement
591
- // @returns {module:engine/model/range~Range|null}
525
+ /**
526
+ * Returns fixed selection range for a given position and a target element if it is over the widget but not over its nested editable.
527
+ */
592
528
  function findDropTargetRangeOnWidget(editor, targetViewElement) {
593
529
  const model = editor.model;
594
530
  const mapper = editor.editing.mapper;
@@ -607,23 +543,18 @@ function findDropTargetRangeOnWidget(editor, targetViewElement) {
607
543
  }
608
544
  return null;
609
545
  }
610
- // Returns fixed selection range inside a model element.
611
- //
612
- // @param {module:core/editor/editor~Editor} editor
613
- // @param {module:engine/model/element~Element} targetModelElement
614
- // @returns {module:engine/model/range~Range}
546
+ /**
547
+ * Returns fixed selection range inside a model element.
548
+ */
615
549
  function findDropTargetRangeInElement(editor, targetModelElement) {
616
550
  const model = editor.model;
617
551
  const schema = model.schema;
618
552
  const positionAtElementStart = model.createPositionAt(targetModelElement, 0);
619
553
  return schema.getNearestSelectionRange(positionAtElementStart, 'forward');
620
554
  }
621
- // Returns fixed selection range for a given position and a target element if the drop is between blocks.
622
- //
623
- // @param {module:core/editor/editor~Editor} editor
624
- // @param {module:engine/model/position~Position} targetModelPosition
625
- // @param {module:engine/model/element~Element} targetModelElement
626
- // @returns {module:engine/model/range~Range|null}
555
+ /**
556
+ * Returns fixed selection range for a given position and a target element if the drop is between blocks.
557
+ */
627
558
  function findDropTargetRangeBetweenBlocks(editor, targetModelPosition, targetModelElement) {
628
559
  const model = editor.model;
629
560
  // Check if target is between blocks.
@@ -644,11 +575,9 @@ function findDropTargetRangeBetweenBlocks(editor, targetModelPosition, targetMod
644
575
  }
645
576
  return null;
646
577
  }
647
- // Returns a selection range on the ancestor object.
648
- //
649
- // @param {module:core/editor/editor~Editor} editor
650
- // @param {module:engine/model/element~Element} element
651
- // @returns {module:engine/model/range~Range}
578
+ /**
579
+ * Returns a selection range on the ancestor object.
580
+ */
652
581
  function findDropTargetRangeOnAncestorObject(editor, element) {
653
582
  const model = editor.model;
654
583
  let currentElement = element;
@@ -661,11 +590,9 @@ function findDropTargetRangeOnAncestorObject(editor, element) {
661
590
  /* istanbul ignore next */
662
591
  return null;
663
592
  }
664
- // Returns the closest model element for the specified view element.
665
- //
666
- // @param {module:core/editor/editor~Editor} editor
667
- // @param {module:engine/view/element~Element} element
668
- // @returns {module:engine/model/element~Element}
593
+ /**
594
+ * Returns the closest model element for the specified view element.
595
+ */
669
596
  function getClosestMappedModelElement(editor, element) {
670
597
  const mapper = editor.editing.mapper;
671
598
  const view = editor.editing.view;
@@ -678,20 +605,22 @@ function getClosestMappedModelElement(editor, element) {
678
605
  const viewElement = mapper.findMappedViewAncestor(viewPosition);
679
606
  return mapper.toModelElement(viewElement);
680
607
  }
681
- // Returns the drop effect that should be a result of dragging the content.
682
- // This function is handling a quirk when checking the effect in the 'drop' DOM event.
608
+ /**
609
+ * Returns the drop effect that should be a result of dragging the content.
610
+ * This function is handling a quirk when checking the effect in the 'drop' DOM event.
611
+ */
683
612
  function getFinalDropEffect(dataTransfer) {
684
613
  if (env.isGecko) {
685
614
  return dataTransfer.dropEffect;
686
615
  }
687
616
  return ['all', 'copyMove'].includes(dataTransfer.effectAllowed) ? 'move' : 'copy';
688
617
  }
689
- // Returns a function wrapper that will trigger a function after a specified wait time.
690
- // The timeout can be canceled by calling the cancel function on the returned wrapped function.
691
- //
692
- // @param {Function} func The function to wrap.
693
- // @param {Number} wait The timeout in ms.
694
- // @returns {Function}
618
+ /**
619
+ * Returns a function wrapper that will trigger a function after a specified wait time.
620
+ * The timeout can be canceled by calling the cancel function on the returned wrapped function.
621
+ * @param func The function to wrap.
622
+ * @param wait The timeout in ms.
623
+ */
695
624
  function delay(func, wait) {
696
625
  let timer;
697
626
  function delayed(...args) {
@@ -703,10 +632,9 @@ function delay(func, wait) {
703
632
  };
704
633
  return delayed;
705
634
  }
706
- // Returns a widget element that should be dragged.
707
- //
708
- // @param {module:engine/view/element~Element} target
709
- // @returns {module:engine/view/element~Element}
635
+ /**
636
+ * Returns a widget element that should be dragged.
637
+ */
710
638
  function findDraggableWidget(target) {
711
639
  // This is directly an editable so not a widget for sure.
712
640
  if (target.is('editableElement')) {
package/src/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
  /**
@@ -1,19 +1,17 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
  /**
6
6
  * @module clipboard/pasteplaintext
7
7
  */
8
- import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
8
+ import { Plugin } from '@ckeditor/ckeditor5-core';
9
9
  import ClipboardObserver from './clipboardobserver';
10
10
  import ClipboardPipeline from './clipboardpipeline';
11
11
  /**
12
12
  * The plugin detects the user's intention to paste plain text.
13
13
  *
14
14
  * For example, it detects the <kbd>Ctrl/Cmd</kbd> + <kbd>Shift</kbd> + <kbd>V</kbd> keystroke.
15
- *
16
- * @extends module:core/plugin~Plugin
17
15
  */
18
16
  export default class PastePlainText extends Plugin {
19
17
  /**
@@ -69,11 +67,9 @@ export default class PastePlainText extends Plugin {
69
67
  });
70
68
  }
71
69
  }
72
- // Returns true if specified `documentFragment` represents a plain text.
73
- //
74
- // @param {module:engine/view/documentfragment~DocumentFragment} documentFragment
75
- // @param {module:engine/model/schema~Schema} schema
76
- // @returns {Boolean}
70
+ /**
71
+ * Returns true if specified `documentFragment` represents a plain text.
72
+ */
77
73
  function isPlainTextFragment(documentFragment, schema) {
78
74
  if (documentFragment.childCount > 1) {
79
75
  return false;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
  /**
@@ -9,8 +9,8 @@
9
9
  * Removes some popular browser quirks out of the clipboard data (HTML).
10
10
  * Removes all HTML comments. These are considered an internal thing and it makes little sense if they leak into the editor data.
11
11
  *
12
- * @param {String} data The HTML data to normalize.
13
- * @returns {String} Normalized HTML.
12
+ * @param data The HTML data to normalize.
13
+ * @returns Normalized HTML.
14
14
  */
15
15
  export default function normalizeClipboardData(data) {
16
16
  return data
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
  /**
@@ -8,8 +8,8 @@
8
8
  /**
9
9
  * Converts plain text to its HTML-ized version.
10
10
  *
11
- * @param {String} text The plain text to convert.
12
- * @returns {String} HTML generated from the plain text.
11
+ * @param text The plain text to convert.
12
+ * @returns HTML generated from the plain text.
13
13
  */
14
14
  export default function plainTextToHtml(text) {
15
15
  text = text
@@ -20,6 +20,8 @@ export default function plainTextToHtml(text) {
20
20
  .replace(/\r?\n\r?\n/g, '</p><p>')
21
21
  // Creates a line break for each single line break.
22
22
  .replace(/\r?\n/g, '<br>')
23
+ // Replace tabs with four spaces.
24
+ .replace(/\t/g, '&nbsp;&nbsp;&nbsp;&nbsp;')
23
25
  // Preserve trailing spaces (only the first and last one – the rest is handled below).
24
26
  .replace(/^\s/, '&nbsp;')
25
27
  .replace(/\s$/, '&nbsp;')
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
  // Elements which should not have empty-line padding.
@@ -9,8 +9,8 @@ const smallPaddingElements = ['figcaption', 'li'];
9
9
  /**
10
10
  * Converts {@link module:engine/view/item~Item view item} and all of its children to plain text.
11
11
  *
12
- * @param {module:engine/view/item~Item} viewItem View item to convert.
13
- * @returns {String} Plain text representation of `viewItem`.
12
+ * @param viewItem View item to convert.
13
+ * @returns Plain text representation of `viewItem`.
14
14
  */
15
15
  export default function viewToPlainText(viewItem) {
16
16
  let text = '';
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
2
+ * Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5