@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-clipboard",
3
- "version": "0.0.0-nightly-next-20250217.0",
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-next-20250217.0",
17
- "@ckeditor/ckeditor5-engine": "0.0.0-nightly-next-20250217.0",
18
- "@ckeditor/ckeditor5-ui": "0.0.0-nightly-next-20250217.0",
19
- "@ckeditor/ckeditor5-utils": "0.0.0-nightly-next-20250217.0",
20
- "@ckeditor/ckeditor5-widget": "0.0.0-nightly-next-20250217.0",
21
- "es-toolkit": "1.32.0"
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-toolkit/compat';
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
- * Map of marker names that can be copied.
21
- *
22
- * @internal
23
- */
24
- _markersToCopy = new Map();
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] ||= writer.createRangeIn(fragment);
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?.start && prevFakeMarker?.end) {
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];
@@ -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
- * The live range over the original content that is being dragged.
104
- */
105
- _draggedRange;
106
- /**
107
- * The UID of current dragging that is used to verify if the drop started in the same editor as the drag start.
108
- *
109
- * **Note**: This is a workaround for broken 'dragend' events (they are not fired if the source text node got removed).
110
- */
111
- _draggingUid;
112
- /**
113
- * The reference to the model element that currently has a `draggable` attribute set (it is set while dragging).
114
- */
115
- _draggableElement;
116
- /**
117
- * A delayed callback removing draggable attributes.
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?.is('editableElement')) {
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
- * Whether current dragging is started by block toolbar button dragging.
19
- */
20
- _isBlockDragging = false;
21
- /**
22
- * DOM Emitter.
23
- */
24
- _domEmitter = new (DomEmitterMixin())();
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
  */
@@ -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-toolkit/compat';
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
- * A delayed callback removing the drop marker.
20
- *
21
- * @internal
22
- */
23
- removeDropMarkerDelayed = delay(() => this.removeDropMarker(), 40);
24
- /**
25
- * A throttled callback updating the drop marker.
26
- */
27
- _updateDropMarkerThrottled = throttle(targetRange => this._updateDropMarker(targetRange), 40);
28
- /**
29
- * A throttled callback reconverting the drop parker.
30
- */
31
- _reconvertMarkerThrottled = throttle(() => {
32
- if (this.editor.model.markers.has('drop-target')) {
33
- this.editor.editing.reconvertMarker('drop-target');
34
- }
35
- }, 0);
36
- /**
37
- * The horizontal drop target line view.
38
- */
39
- _dropTargetLineView = new LineView();
40
- /**
41
- * DOM Emitter.
42
- */
43
- _domEmitter = new (DomEmitterMixin())();
44
- /**
45
- * Map of document scrollable elements.
46
- */
47
- _scrollables = new Map();
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
  */