@ckeditor/ckeditor5-clipboard 0.0.0-nightly-next-20250217.0 → 0.0.0-nightly-20250218.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 +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +7 -9
- package/src/clipboardmarkersutils.js +12 -9
- package/src/clipboardobserver.js +3 -3
- package/src/dragdrop.js +18 -33
- package/src/dragdropblocktoolbar.js +11 -8
- package/src/dragdroptarget.js +34 -31
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-clipboard",
|
|
3
|
-
"version": "0.0.0-nightly-
|
|
3
|
+
"version": "0.0.0-nightly-20250218.0",
|
|
4
4
|
"description": "Clipboard integration feature for CKEditor 5.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ckeditor",
|
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
"type": "module",
|
|
14
14
|
"main": "src/index.js",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@ckeditor/ckeditor5-core": "0.0.0-nightly-
|
|
17
|
-
"@ckeditor/ckeditor5-engine": "0.0.0-nightly-
|
|
18
|
-
"@ckeditor/ckeditor5-ui": "0.0.0-nightly-
|
|
19
|
-
"@ckeditor/ckeditor5-utils": "0.0.0-nightly-
|
|
20
|
-
"@ckeditor/ckeditor5-widget": "0.0.0-nightly-
|
|
21
|
-
"es
|
|
16
|
+
"@ckeditor/ckeditor5-core": "0.0.0-nightly-20250218.0",
|
|
17
|
+
"@ckeditor/ckeditor5-engine": "0.0.0-nightly-20250218.0",
|
|
18
|
+
"@ckeditor/ckeditor5-ui": "0.0.0-nightly-20250218.0",
|
|
19
|
+
"@ckeditor/ckeditor5-utils": "0.0.0-nightly-20250218.0",
|
|
20
|
+
"@ckeditor/ckeditor5-widget": "0.0.0-nightly-20250218.0",
|
|
21
|
+
"lodash-es": "4.17.21"
|
|
22
22
|
},
|
|
23
23
|
"author": "CKSource (http://cksource.com/)",
|
|
24
24
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -35,7 +35,6 @@
|
|
|
35
35
|
"src/**/*.js",
|
|
36
36
|
"src/**/*.d.ts",
|
|
37
37
|
"theme",
|
|
38
|
-
"ckeditor5-metadata.json",
|
|
39
38
|
"CHANGELOG.md"
|
|
40
39
|
],
|
|
41
40
|
"types": "src/index.d.ts",
|
|
@@ -57,7 +56,6 @@
|
|
|
57
56
|
},
|
|
58
57
|
"./lang/*": "./lang/*",
|
|
59
58
|
"./theme/*": "./theme/*",
|
|
60
|
-
"./ckeditor5-metadata.json": "./ckeditor5-metadata.json",
|
|
61
59
|
"./package.json": "./package.json"
|
|
62
60
|
}
|
|
63
61
|
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module clipboard/clipboardmarkersutils
|
|
7
7
|
*/
|
|
8
|
-
import { mapValues } from 'es
|
|
8
|
+
import { mapValues } from 'lodash-es';
|
|
9
9
|
import { uid } from '@ckeditor/ckeditor5-utils';
|
|
10
10
|
import { Plugin } from '@ckeditor/ckeditor5-core';
|
|
11
11
|
import { Range } from '@ckeditor/ckeditor5-engine';
|
|
@@ -16,12 +16,15 @@ import { Range } from '@ckeditor/ckeditor5-engine';
|
|
|
16
16
|
* @internal
|
|
17
17
|
*/
|
|
18
18
|
export default class ClipboardMarkersUtils extends Plugin {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
constructor() {
|
|
20
|
+
super(...arguments);
|
|
21
|
+
/**
|
|
22
|
+
* Map of marker names that can be copied.
|
|
23
|
+
*
|
|
24
|
+
* @internal
|
|
25
|
+
*/
|
|
26
|
+
this._markersToCopy = new Map();
|
|
27
|
+
}
|
|
25
28
|
/**
|
|
26
29
|
* @inheritDoc
|
|
27
30
|
*/
|
|
@@ -85,7 +88,7 @@ export default class ClipboardMarkersUtils extends Plugin {
|
|
|
85
88
|
// This function checks special case of such problem. Markers that are orphaned at the start position
|
|
86
89
|
// and end position in the same time. Basically it means that they overlaps whole element.
|
|
87
90
|
for (const [markerName, elements] of Object.entries(sourceSelectionInsertedMarkers)) {
|
|
88
|
-
fakeMarkersRangesInsideRange[markerName]
|
|
91
|
+
fakeMarkersRangesInsideRange[markerName] || (fakeMarkersRangesInsideRange[markerName] = writer.createRangeIn(fragment));
|
|
89
92
|
for (const element of elements) {
|
|
90
93
|
writer.remove(element);
|
|
91
94
|
}
|
|
@@ -383,7 +386,7 @@ export default class ClipboardMarkersUtils extends Plugin {
|
|
|
383
386
|
// The easiest way to bypass this issue is to rename already existing in map nodes and
|
|
384
387
|
// set them new unique name.
|
|
385
388
|
let skipAssign = false;
|
|
386
|
-
if (prevFakeMarker
|
|
389
|
+
if (prevFakeMarker && prevFakeMarker.start && prevFakeMarker.end) {
|
|
387
390
|
const config = this._getMarkerClipboardConfig(fakeMarker.name);
|
|
388
391
|
if (config.duplicateOnPaste) {
|
|
389
392
|
acc[this._getUniqueMarkerName(fakeMarker.name)] = acc[fakeMarker.name];
|
package/src/clipboardobserver.js
CHANGED
|
@@ -30,11 +30,11 @@ import { DataTransfer, DomEventObserver } from '@ckeditor/ckeditor5-engine';
|
|
|
30
30
|
* {@link module:clipboard/clipboard~Clipboard} plugin which adds this observer automatically (because it uses it).
|
|
31
31
|
*/
|
|
32
32
|
export default class ClipboardObserver extends DomEventObserver {
|
|
33
|
-
domEventType = [
|
|
34
|
-
'paste', 'copy', 'cut', 'drop', 'dragover', 'dragstart', 'dragend', 'dragenter', 'dragleave'
|
|
35
|
-
];
|
|
36
33
|
constructor(view) {
|
|
37
34
|
super(view);
|
|
35
|
+
this.domEventType = [
|
|
36
|
+
'paste', 'copy', 'cut', 'drop', 'dragover', 'dragstart', 'dragend', 'dragenter', 'dragleave'
|
|
37
|
+
];
|
|
38
38
|
const viewDocument = this.document;
|
|
39
39
|
this.listenTo(viewDocument, 'paste', handleInput('clipboardInput'), { priority: 'low' });
|
|
40
40
|
this.listenTo(viewDocument, 'drop', handleInput('clipboardInput'), { priority: 'low' });
|
package/src/dragdrop.js
CHANGED
|
@@ -99,38 +99,23 @@ import '../theme/clipboard.css';
|
|
|
99
99
|
* @internal
|
|
100
100
|
*/
|
|
101
101
|
export default class DragDrop extends Plugin {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
_clearDraggableAttributesDelayed = delay(() => this._clearDraggableAttributes(), 40);
|
|
120
|
-
/**
|
|
121
|
-
* Whether the dragged content can be dropped only in block context.
|
|
122
|
-
*/
|
|
123
|
-
// TODO handle drag from other editor instance
|
|
124
|
-
// TODO configure to use block, inline or both
|
|
125
|
-
_blockMode = false;
|
|
126
|
-
/**
|
|
127
|
-
* DOM Emitter.
|
|
128
|
-
*/
|
|
129
|
-
_domEmitter = new (DomEmitterMixin())();
|
|
130
|
-
/**
|
|
131
|
-
* The DOM element used to generate dragged preview image.
|
|
132
|
-
*/
|
|
133
|
-
_previewContainer;
|
|
102
|
+
constructor() {
|
|
103
|
+
super(...arguments);
|
|
104
|
+
/**
|
|
105
|
+
* A delayed callback removing draggable attributes.
|
|
106
|
+
*/
|
|
107
|
+
this._clearDraggableAttributesDelayed = delay(() => this._clearDraggableAttributes(), 40);
|
|
108
|
+
/**
|
|
109
|
+
* Whether the dragged content can be dropped only in block context.
|
|
110
|
+
*/
|
|
111
|
+
// TODO handle drag from other editor instance
|
|
112
|
+
// TODO configure to use block, inline or both
|
|
113
|
+
this._blockMode = false;
|
|
114
|
+
/**
|
|
115
|
+
* DOM Emitter.
|
|
116
|
+
*/
|
|
117
|
+
this._domEmitter = new (DomEmitterMixin())();
|
|
118
|
+
}
|
|
134
119
|
/**
|
|
135
120
|
* @inheritDoc
|
|
136
121
|
*/
|
|
@@ -208,7 +193,7 @@ export default class DragDrop extends Plugin {
|
|
|
208
193
|
// The handler for the drag start; it is responsible for setting data transfer object.
|
|
209
194
|
this.listenTo(viewDocument, 'dragstart', (evt, data) => {
|
|
210
195
|
// Don't drag the editable element itself.
|
|
211
|
-
if (data.target
|
|
196
|
+
if (data.target && data.target.is('editableElement')) {
|
|
212
197
|
data.preventDefault();
|
|
213
198
|
return;
|
|
214
199
|
}
|
|
@@ -14,14 +14,17 @@ import ClipboardObserver from './clipboardobserver.js';
|
|
|
14
14
|
* @internal
|
|
15
15
|
*/
|
|
16
16
|
export default class DragDropBlockToolbar extends Plugin {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments);
|
|
19
|
+
/**
|
|
20
|
+
* Whether current dragging is started by block toolbar button dragging.
|
|
21
|
+
*/
|
|
22
|
+
this._isBlockDragging = false;
|
|
23
|
+
/**
|
|
24
|
+
* DOM Emitter.
|
|
25
|
+
*/
|
|
26
|
+
this._domEmitter = new (DomEmitterMixin())();
|
|
27
|
+
}
|
|
25
28
|
/**
|
|
26
29
|
* @inheritDoc
|
|
27
30
|
*/
|
package/src/dragdroptarget.js
CHANGED
|
@@ -8,43 +8,46 @@
|
|
|
8
8
|
import { Plugin } from '@ckeditor/ckeditor5-core';
|
|
9
9
|
import { global, Rect, DomEmitterMixin, delay, ResizeObserver } from '@ckeditor/ckeditor5-utils';
|
|
10
10
|
import LineView from './lineview.js';
|
|
11
|
-
import { throttle } from 'es
|
|
11
|
+
import { throttle } from 'lodash-es';
|
|
12
12
|
/**
|
|
13
13
|
* Part of the Drag and Drop handling. Responsible for finding and displaying the drop target.
|
|
14
14
|
*
|
|
15
15
|
* @internal
|
|
16
16
|
*/
|
|
17
17
|
export default class DragDropTarget extends Plugin {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
18
|
+
constructor() {
|
|
19
|
+
super(...arguments);
|
|
20
|
+
/**
|
|
21
|
+
* A delayed callback removing the drop marker.
|
|
22
|
+
*
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
this.removeDropMarkerDelayed = delay(() => this.removeDropMarker(), 40);
|
|
26
|
+
/**
|
|
27
|
+
* A throttled callback updating the drop marker.
|
|
28
|
+
*/
|
|
29
|
+
this._updateDropMarkerThrottled = throttle(targetRange => this._updateDropMarker(targetRange), 40);
|
|
30
|
+
/**
|
|
31
|
+
* A throttled callback reconverting the drop parker.
|
|
32
|
+
*/
|
|
33
|
+
this._reconvertMarkerThrottled = throttle(() => {
|
|
34
|
+
if (this.editor.model.markers.has('drop-target')) {
|
|
35
|
+
this.editor.editing.reconvertMarker('drop-target');
|
|
36
|
+
}
|
|
37
|
+
}, 0);
|
|
38
|
+
/**
|
|
39
|
+
* The horizontal drop target line view.
|
|
40
|
+
*/
|
|
41
|
+
this._dropTargetLineView = new LineView();
|
|
42
|
+
/**
|
|
43
|
+
* DOM Emitter.
|
|
44
|
+
*/
|
|
45
|
+
this._domEmitter = new (DomEmitterMixin())();
|
|
46
|
+
/**
|
|
47
|
+
* Map of document scrollable elements.
|
|
48
|
+
*/
|
|
49
|
+
this._scrollables = new Map();
|
|
50
|
+
}
|
|
48
51
|
/**
|
|
49
52
|
* @inheritDoc
|
|
50
53
|
*/
|