@ckeditor/ckeditor5-clipboard 28.0.0 → 30.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
@@ -1,7 +1,7 @@
1
1
  Software License Agreement
2
2
  ==========================
3
3
 
4
- **CKEditor 5 Clipboard Feature** – https://github.com/ckeditor/ckeditor5-clipboard <br>
4
+ **CKEditor 5 clipboard feature** – https://github.com/ckeditor/ckeditor5-clipboard <br>
5
5
  Copyright (c) 2003-2021, [CKSource](http://cksource.com) Frederico Knabben. 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).
package/README.md CHANGED
@@ -2,8 +2,8 @@ CKEditor 5 clipboard feature
2
2
  ========================================
3
3
 
4
4
  [![npm version](https://badge.fury.io/js/%40ckeditor%2Fckeditor5-clipboard.svg)](https://www.npmjs.com/package/@ckeditor/ckeditor5-clipboard)
5
- [![Dependency Status](https://david-dm.org/ckeditor/ckeditor5-clipboard/status.svg)](https://david-dm.org/ckeditor/ckeditor5-clipboard)
6
- [![devDependency Status](https://david-dm.org/ckeditor/ckeditor5-clipboard/dev-status.svg)](https://david-dm.org/ckeditor/ckeditor5-clipboard?type=dev)
5
+ [![Coverage Status](https://coveralls.io/repos/github/ckeditor/ckeditor5/badge.svg?branch=master)](https://coveralls.io/github/ckeditor/ckeditor5?branch=master)
6
+ [![Build Status](https://travis-ci.com/ckeditor/ckeditor5.svg?branch=master)](https://travis-ci.com/ckeditor/ckeditor5)
7
7
 
8
8
  This package implements the clipboard (copy, cut, paste) support for CKEditor 5.
9
9
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-clipboard",
3
- "version": "28.0.0",
4
- "description": "Clipboard integration for CKEditor 5.",
3
+ "version": "30.0.0",
4
+ "description": "Clipboard integration feature for CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
7
7
  "ckeditor5",
@@ -12,30 +12,30 @@
12
12
  ],
13
13
  "main": "src/index.js",
14
14
  "dependencies": {
15
- "@ckeditor/ckeditor5-core": "^28.0.0",
16
- "@ckeditor/ckeditor5-engine": "^28.0.0",
17
- "@ckeditor/ckeditor5-utils": "^28.0.0",
18
- "@ckeditor/ckeditor5-widget": "^28.0.0",
15
+ "@ckeditor/ckeditor5-core": "^30.0.0",
16
+ "@ckeditor/ckeditor5-engine": "^30.0.0",
17
+ "@ckeditor/ckeditor5-utils": "^30.0.0",
18
+ "@ckeditor/ckeditor5-widget": "^30.0.0",
19
19
  "lodash-es": "^4.17.11"
20
20
  },
21
21
  "devDependencies": {
22
- "@ckeditor/ckeditor5-alignment": "^28.0.0",
23
- "@ckeditor/ckeditor5-basic-styles": "^28.0.0",
24
- "@ckeditor/ckeditor5-block-quote": "^28.0.0",
25
- "@ckeditor/ckeditor5-cloud-services": "^28.0.0",
26
- "@ckeditor/ckeditor5-code-block": "^28.0.0",
27
- "@ckeditor/ckeditor5-easy-image": "^28.0.0",
28
- "@ckeditor/ckeditor5-editor-classic": "^28.0.0",
29
- "@ckeditor/ckeditor5-enter": "^28.0.0",
30
- "@ckeditor/ckeditor5-horizontal-line": "^28.0.0",
31
- "@ckeditor/ckeditor5-image": "^28.0.0",
32
- "@ckeditor/ckeditor5-link": "^28.0.0",
33
- "@ckeditor/ckeditor5-page-break": "^28.0.0",
34
- "@ckeditor/ckeditor5-paragraph": "^28.0.0",
35
- "@ckeditor/ckeditor5-paste-from-office": "^28.0.0",
36
- "@ckeditor/ckeditor5-remove-format": "^28.0.0",
37
- "@ckeditor/ckeditor5-table": "^28.0.0",
38
- "@ckeditor/ckeditor5-typing": "^28.0.0"
22
+ "@ckeditor/ckeditor5-alignment": "^30.0.0",
23
+ "@ckeditor/ckeditor5-basic-styles": "^30.0.0",
24
+ "@ckeditor/ckeditor5-block-quote": "^30.0.0",
25
+ "@ckeditor/ckeditor5-cloud-services": "^30.0.0",
26
+ "@ckeditor/ckeditor5-code-block": "^30.0.0",
27
+ "@ckeditor/ckeditor5-easy-image": "^30.0.0",
28
+ "@ckeditor/ckeditor5-editor-classic": "^30.0.0",
29
+ "@ckeditor/ckeditor5-enter": "^30.0.0",
30
+ "@ckeditor/ckeditor5-horizontal-line": "^30.0.0",
31
+ "@ckeditor/ckeditor5-image": "^30.0.0",
32
+ "@ckeditor/ckeditor5-link": "^30.0.0",
33
+ "@ckeditor/ckeditor5-page-break": "^30.0.0",
34
+ "@ckeditor/ckeditor5-paragraph": "^30.0.0",
35
+ "@ckeditor/ckeditor5-paste-from-office": "^30.0.0",
36
+ "@ckeditor/ckeditor5-remove-format": "^30.0.0",
37
+ "@ckeditor/ckeditor5-table": "^30.0.0",
38
+ "@ckeditor/ckeditor5-typing": "^30.0.0"
39
39
  },
40
40
  "engines": {
41
41
  "node": ">=12.0.0",
@@ -53,6 +53,7 @@
53
53
  "files": [
54
54
  "lang",
55
55
  "src",
56
- "theme"
56
+ "theme",
57
+ "ckeditor5-metadata.json"
57
58
  ]
58
59
  }
@@ -98,12 +98,13 @@ export default class DataTransfer {
98
98
 
99
99
  function getFiles( nativeDataTransfer ) {
100
100
  // DataTransfer.files and items are array-like and might not have an iterable interface.
101
- const files = nativeDataTransfer.files ? Array.from( nativeDataTransfer.files ) : [];
102
- const items = nativeDataTransfer.items ? Array.from( nativeDataTransfer.items ) : [];
101
+ const files = Array.from( nativeDataTransfer.files || [] );
102
+ const items = Array.from( nativeDataTransfer.items || [] );
103
103
 
104
104
  if ( files.length ) {
105
105
  return files;
106
106
  }
107
+
107
108
  // Chrome has empty DataTransfer.files, but allows getting files through the items interface.
108
109
  return items
109
110
  .filter( item => item.kind === 'file' )
package/src/dragdrop.js CHANGED
@@ -259,6 +259,11 @@ export default class DragDrop extends Plugin {
259
259
  const modelElement = editor.editing.mapper.toModelElement( draggableWidget );
260
260
 
261
261
  this._draggedRange = LiveRange.fromRange( model.createRangeOn( modelElement ) );
262
+
263
+ // Disable toolbars so they won't obscure the drop area.
264
+ if ( editor.plugins.has( 'WidgetToolbarRepository' ) ) {
265
+ editor.plugins.get( 'WidgetToolbarRepository' ).forceDisabled( 'dragDrop' );
266
+ }
262
267
  }
263
268
 
264
269
  // If this was not a widget we should check if we need to drag some text content.
@@ -610,6 +615,10 @@ export default class DragDrop extends Plugin {
610
615
  this._removeDropMarker();
611
616
  this._clearDraggableAttributes();
612
617
 
618
+ if ( editor.plugins.has( 'WidgetToolbarRepository' ) ) {
619
+ editor.plugins.get( 'WidgetToolbarRepository' ).clearForceDisabled( 'dragDrop' );
620
+ }
621
+
613
622
  this._draggingUid = '';
614
623
 
615
624
  if ( !this._draggedRange ) {
@@ -9,6 +9,7 @@
9
9
 
10
10
  /**
11
11
  * Removes some popular browser quirks out of the clipboard data (HTML).
12
+ * Removes all HTML comments. These are considered an internal thing and it makes little sense if they leak into the editor data.
12
13
  *
13
14
  * @param {String} data The HTML data to normalize.
14
15
  * @returns {String} Normalized HTML.
@@ -23,5 +24,7 @@ export default function normalizeClipboardData( data ) {
23
24
  }
24
25
 
25
26
  return spaces;
26
- } );
27
+ } )
28
+ // Remove all HTML comments.
29
+ .replace( /<!--[\s\S]*?-->/g, '' );
27
30
  }
package/CHANGELOG.md DELETED
@@ -1,180 +0,0 @@
1
- Changelog
2
- =========
3
-
4
- All changes in the package are documented in the main repository. See: https://github.com/ckeditor/ckeditor5/blob/master/CHANGELOG.md.
5
-
6
- Changes for the past releases are available below.
7
-
8
- ## [19.0.0](https://github.com/ckeditor/ckeditor5-clipboard/compare/v18.0.0...v19.0.0) (2020-04-29)
9
-
10
- ### Other changes
11
-
12
- * Handled `paste` and `drop` events no longer propagate up the DOM tree. Closes [ckeditor/ckeditor5#6464](https://github.com/ckeditor/ckeditor5/issues/6464). ([70aa7ba](https://github.com/ckeditor/ckeditor5-clipboard/commit/70aa7ba))
13
-
14
-
15
- ## [18.0.0](https://github.com/ckeditor/ckeditor5-clipboard/compare/v17.0.0...v18.0.0) (2020-03-19)
16
-
17
- Internal changes only (updated dependencies, documentation, etc.).
18
-
19
-
20
- ## [17.0.0](https://github.com/ckeditor/ckeditor5-clipboard/compare/v16.0.0...v17.0.0) (2020-02-19)
21
-
22
- Internal changes only (updated dependencies, documentation, etc.).
23
-
24
-
25
- ## [16.0.0](https://github.com/ckeditor/ckeditor5-clipboard/compare/v15.0.0...v16.0.0) (2019-12-04)
26
-
27
- Internal changes only (updated dependencies, documentation, etc.).
28
-
29
-
30
- ## [15.0.0](https://github.com/ckeditor/ckeditor5-clipboard/compare/v12.0.2...v15.0.0) (2019-10-23)
31
-
32
- Internal changes only (updated dependencies, documentation, etc.).
33
-
34
-
35
- ## [12.0.2](https://github.com/ckeditor/ckeditor5-clipboard/compare/v12.0.1...v12.0.2) (2019-08-26)
36
-
37
- ### Other changes
38
-
39
- * The issue tracker for this package was moved to https://github.com/ckeditor/ckeditor5/issues. See [ckeditor/ckeditor5#1988](https://github.com/ckeditor/ckeditor5/issues/1988). ([b1782bb](https://github.com/ckeditor/ckeditor5-clipboard/commit/b1782bb))
40
-
41
-
42
- ## [12.0.1](https://github.com/ckeditor/ckeditor5-clipboard/compare/v12.0.0...v12.0.1) (2019-07-10)
43
-
44
- Internal changes only (updated dependencies, documentation, etc.).
45
-
46
-
47
- ## [12.0.0](https://github.com/ckeditor/ckeditor5-clipboard/compare/v11.0.2...v12.0.0) (2019-07-04)
48
-
49
- ### Other changes
50
-
51
- * New lines pasted as a plain text will always create a new paragraph. Closes [ckeditor/ckeditor5#1727](https://github.com/ckeditor/ckeditor5/issues/1727). ([f0eb3a0](https://github.com/ckeditor/ckeditor5-clipboard/commit/f0eb3a0))
52
-
53
- ### BREAKING CHANGES
54
-
55
- * From now on, every new line pasted in the editor as a plain text, will create a new paragraph. Read more at [ckeditor/ckeditor5#1727](https://github.com/ckeditor/ckeditor5/issues/1727).
56
-
57
-
58
- ## [11.0.2](https://github.com/ckeditor/ckeditor5-clipboard/compare/v11.0.1...v11.0.2) (2019-06-05)
59
-
60
- Internal changes only (updated dependencies, documentation, etc.).
61
-
62
-
63
- ## [11.0.1](https://github.com/ckeditor/ckeditor5-clipboard/compare/v11.0.0...v11.0.1) (2019-04-10)
64
-
65
- ### Bug fixes
66
-
67
- * The DOM `drop` event will not bubble up if the `clipboardInput` event was handled. Closes [ckeditor/ckeditor5-upload#92](https://github.com/ckeditor/ckeditor5-upload/issues/92). ([5d14697](https://github.com/ckeditor/ckeditor5-clipboard/commit/5d14697))
68
-
69
-
70
- ## [11.0.0](https://github.com/ckeditor/ckeditor5-clipboard/compare/v10.0.4...v11.0.0) (2019-02-28)
71
-
72
- ### BREAKING CHANGES
73
-
74
- * Upgraded minimal versions of Node to `8.0.0` and npm to `5.7.1`. See: [ckeditor/ckeditor5#1507](https://github.com/ckeditor/ckeditor5/issues/1507). ([612ea3c](https://github.com/ckeditor/ckeditor5-cloud-services/commit/612ea3c))
75
-
76
-
77
- ## [10.0.4](https://github.com/ckeditor/ckeditor5-clipboard/compare/v10.0.3...v10.0.4) (2018-12-05)
78
-
79
- Internal changes only (updated dependencies, documentation, etc.).
80
-
81
-
82
- ## [10.0.3](https://github.com/ckeditor/ckeditor5-clipboard/compare/v10.0.2...v10.0.3) (2018-10-08)
83
-
84
- ### Other changes
85
-
86
- * The `Clipboard#inputTransformation` event is now emitted with an additional `dataTransfer` object. Closes [#54](https://github.com/ckeditor/ckeditor5-clipboard/issues/54) . ([f3589b4](https://github.com/ckeditor/ckeditor5-clipboard/commit/f3589b4))
87
-
88
-
89
- ## [10.0.2](https://github.com/ckeditor/ckeditor5-clipboard/compare/v10.0.1...v10.0.2) (2018-07-18)
90
-
91
- Internal changes only (updated dependencies, documentation, etc.).
92
-
93
-
94
- ## [10.0.1](https://github.com/ckeditor/ckeditor5-clipboard/compare/v10.0.0...v10.0.1) (2018-06-21)
95
-
96
- ### Bug fixes
97
-
98
- * Disabled the entire clipboard input pipeline when the editor is read-only. Closes [#48](https://github.com/ckeditor/ckeditor5-clipboard/issues/48). ([b40ec4b](https://github.com/ckeditor/ckeditor5-clipboard/commit/b40ec4b))
99
- * When pasting a plain text, single new line characters should be converted to `<br>`s. Closes [ckeditor/ckeditor5#766](https://github.com/ckeditor/ckeditor5/issues/766). ([be21676](https://github.com/ckeditor/ckeditor5-clipboard/commit/be21676))
100
-
101
-
102
- ## [10.0.0](https://github.com/ckeditor/ckeditor5-clipboard/compare/v1.0.0-beta.4...v10.0.0) (2018-04-25)
103
-
104
- ### Other changes
105
-
106
- * Changed the license to GPL2+ only. See [ckeditor/ckeditor5#991](https://github.com/ckeditor/ckeditor5/issues/991). ([8c092af](https://github.com/ckeditor/ckeditor5-clipboard/commit/8c092af))
107
-
108
- ### BREAKING CHANGES
109
-
110
- * The license under which CKEditor 5 is released has been changed from a triple GPL, LGPL and MPL license to a GPL2+ only. See [ckeditor/ckeditor5#991](https://github.com/ckeditor/ckeditor5/issues/991) for more information.
111
-
112
-
113
- ## [1.0.0-beta.4](https://github.com/ckeditor/ckeditor5-clipboard/compare/v1.0.0-beta.2...v1.0.0-beta.4) (2018-04-19)
114
-
115
- Internal changes only (updated dependencies, documentation, etc.).
116
-
117
-
118
- ## [1.0.0-beta.2](https://github.com/ckeditor/ckeditor5-clipboard/compare/v1.0.0-beta.1...v1.0.0-beta.2) (2018-04-10)
119
-
120
- Internal changes only (updated dependencies, documentation, etc.).
121
-
122
-
123
- ## [1.0.0-beta.1](https://github.com/ckeditor/ckeditor5-clipboard/compare/v1.0.0-alpha.2...v1.0.0-beta.1) (2018-03-15)
124
-
125
- Internal changes only (updated dependencies, documentation, etc.).
126
-
127
-
128
- ## [1.0.0-alpha.2](https://github.com/ckeditor/ckeditor5-clipboard/compare/v1.0.0-alpha.1...v1.0.0-alpha.2) (2017-11-14)
129
-
130
- Internal changes only (updated dependencies, documentation, etc.).
131
-
132
-
133
- ## [1.0.0-alpha.1](https://github.com/ckeditor/ckeditor5-clipboard/compare/v0.7.0...v1.0.0-alpha.1) (2017-10-03)
134
-
135
- Internal changes only (updated dependencies, documentation, etc.).
136
-
137
-
138
- ## [0.7.0](https://github.com/ckeditor/ckeditor5-clipboard/compare/v0.6.0...v0.7.0) (2017-09-03)
139
-
140
- ### Bug fixes
141
-
142
- * Whitespaces around inline elements will not be lost upon pasting. Closes [#24](https://github.com/ckeditor/ckeditor5-clipboard/issues/24). ([5888743](https://github.com/ckeditor/ckeditor5-clipboard/commit/5888743))
143
-
144
- ### Features
145
-
146
- * Added the `'dragover'` event to ClipboardObserver. ([00c7567](https://github.com/ckeditor/ckeditor5-clipboard/commit/00c7567))
147
- * Added `dropRange` to the `drop` event and `targetRanges` to the `clipboardInput` event. Closes [#29](https://github.com/ckeditor/ckeditor5-clipboard/issues/29). ([86daed9](https://github.com/ckeditor/ckeditor5-clipboard/commit/86daed9))
148
- * Disable pasting and cutting when the editor is read-only. Closes [#26](https://github.com/ckeditor/ckeditor5-clipboard/issues/26). ([0ba74d5](https://github.com/ckeditor/ckeditor5-clipboard/commit/0ba74d5))
149
- * The viewport will be scrolled to the selection on paste. See ckeditor/ckeditor5-engine#660. ([9a0e20f](https://github.com/ckeditor/ckeditor5-clipboard/commit/9a0e20f))
150
-
151
-
152
- ## [0.6.0](https://github.com/ckeditor/ckeditor5-clipboard/compare/v0.5.0...v0.6.0) (2017-05-07)
153
-
154
- ### Bug fixes
155
-
156
- * Plain text data is now available in the clipboard when copying or cutting the editor contents. Closes [#11](https://github.com/ckeditor/ckeditor5-clipboard/issues/11). ([8a01e0f](https://github.com/ckeditor/ckeditor5-clipboard/commit/8a01e0f))
157
-
158
- ### Features
159
-
160
- * Introduced `DataTransfer#files` property. Change the clipboard input pipeline. Closes [#16](https://github.com/ckeditor/ckeditor5-clipboard/issues/16). ([e4e7e10](https://github.com/ckeditor/ckeditor5-clipboard/commit/e4e7e10))
161
-
162
- ### BREAKING CHANGES
163
-
164
- * The `clipboardInput` event now contains only the `dataTransfer` property (`content` was removed). The separate `inputTransformation` event was introduced for the content transformations.
165
-
166
-
167
- ## [0.5.0](https://github.com/ckeditor/ckeditor5-clipboard/compare/v0.4.1...v0.5.0) (2017-04-05)
168
-
169
- ### Other changes
170
-
171
- * Aligned use of the `DataController` to the latest API. Closes [#14](https://github.com/ckeditor/ckeditor5-clipboard/issues/14). ([8f98e2b](https://github.com/ckeditor/ckeditor5-clipboard/commit/8f98e2b))
172
-
173
- ### Features
174
-
175
- * Named existing plugin(s). ([3d37f53](https://github.com/ckeditor/ckeditor5-clipboard/commit/3d37f53))
176
-
177
-
178
- ## [0.4.1](https://github.com/ckeditor/ckeditor5-clipboard/compare/v0.4.0...v0.4.1) (2017-03-06)
179
-
180
- Internal changes only (updated dependencies, documentation, etc.).