@ckeditor/ckeditor5-clipboard 44.3.0 → 45.0.0-alpha.1

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.
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
+
6
+ import type { Translations } from '@ckeditor/ckeditor5-utils';
7
+ declare const translations: Translations;
8
+ export default translations;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
+ export default {"be":{"dictionary":{"Copy selected content":"Капіяваць выбраны змест","Paste content":"Уставіць змест","Paste content as plain text":"Уставіць змест у выглядзе простага тэксту"},getPluralForm(n){return (n % 10 == 1 && n % 100 != 11 ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2);}}}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
+
6
+ ( e => {
7
+ const { [ 'be' ]: { dictionary, getPluralForm } } = {"be":{"dictionary":{"Copy selected content":"Капіяваць выбраны змест","Paste content":"Уставіць змест","Paste content as plain text":"Уставіць змест у выглядзе простага тэксту"},getPluralForm(n){return (n % 10 == 1 && n % 100 != 11 ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2);}}};
8
+ e[ 'be' ] ||= { dictionary: {}, getPluralForm: null };
9
+ e[ 'be' ].dictionary = Object.assign( e[ 'be' ].dictionary, dictionary );
10
+ e[ 'be' ].getPluralForm = getPluralForm;
11
+ } )( window.CKEDITOR_TRANSLATIONS ||= {} );
@@ -0,0 +1,24 @@
1
+ # Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
2
+ #
3
+ # Want to contribute to this file? Submit your changes via a GitHub Pull Request.
4
+ #
5
+ # Check out the official contributor's guide:
6
+ # https://ckeditor.com/docs/ckeditor5/latest/framework/guides/contributing/contributing.html
7
+ #
8
+ msgid ""
9
+ msgstr ""
10
+ "Language: be\n"
11
+ "Plural-Forms: nplurals=3; plural=(n % 10 == 1 && n % 100 != 11 ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2);\n"
12
+ "Content-Type: text/plain; charset=UTF-8\n"
13
+
14
+ msgctxt "Keystroke description for assistive technologies: keystroke for copying selected content."
15
+ msgid "Copy selected content"
16
+ msgstr "Капіяваць выбраны змест"
17
+
18
+ msgctxt "Keystroke description for assistive technologies: keystroke for pasting content."
19
+ msgid "Paste content"
20
+ msgstr "Уставіць змест"
21
+
22
+ msgctxt "Keystroke description for assistive technologies: keystroke for pasting content as plain text."
23
+ msgid "Paste content as plain text"
24
+ msgstr "Уставіць змест у выглядзе простага тэксту"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-clipboard",
3
- "version": "44.3.0",
3
+ "version": "45.0.0-alpha.1",
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": "44.3.0",
17
- "@ckeditor/ckeditor5-engine": "44.3.0",
18
- "@ckeditor/ckeditor5-ui": "44.3.0",
19
- "@ckeditor/ckeditor5-utils": "44.3.0",
20
- "@ckeditor/ckeditor5-widget": "44.3.0",
21
- "lodash-es": "4.17.21"
16
+ "@ckeditor/ckeditor5-core": "45.0.0-alpha.1",
17
+ "@ckeditor/ckeditor5-engine": "45.0.0-alpha.1",
18
+ "@ckeditor/ckeditor5-ui": "45.0.0-alpha.1",
19
+ "@ckeditor/ckeditor5-utils": "45.0.0-alpha.1",
20
+ "@ckeditor/ckeditor5-widget": "45.0.0-alpha.1",
21
+ "es-toolkit": "1.32.0"
22
22
  },
23
23
  "author": "CKSource (http://cksource.com/)",
24
24
  "license": "SEE LICENSE IN LICENSE.md",
@@ -5,7 +5,7 @@
5
5
  /**
6
6
  * @module clipboard/clipboardmarkersutils
7
7
  */
8
- import { mapValues } from 'lodash-es';
8
+ import { mapValues } from 'es-toolkit/compat';
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,15 +16,12 @@ import { Range } from '@ckeditor/ckeditor5-engine';
16
16
  * @internal
17
17
  */
18
18
  export default class ClipboardMarkersUtils extends Plugin {
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
- }
19
+ /**
20
+ * Map of marker names that can be copied.
21
+ *
22
+ * @internal
23
+ */
24
+ _markersToCopy = new Map();
28
25
  /**
29
26
  * @inheritDoc
30
27
  */
@@ -88,7 +85,7 @@ export default class ClipboardMarkersUtils extends Plugin {
88
85
  // This function checks special case of such problem. Markers that are orphaned at the start position
89
86
  // and end position in the same time. Basically it means that they overlaps whole element.
90
87
  for (const [markerName, elements] of Object.entries(sourceSelectionInsertedMarkers)) {
91
- fakeMarkersRangesInsideRange[markerName] || (fakeMarkersRangesInsideRange[markerName] = writer.createRangeIn(fragment));
88
+ fakeMarkersRangesInsideRange[markerName] ||= writer.createRangeIn(fragment);
92
89
  for (const element of elements) {
93
90
  writer.remove(element);
94
91
  }
@@ -386,7 +383,7 @@ export default class ClipboardMarkersUtils extends Plugin {
386
383
  // The easiest way to bypass this issue is to rename already existing in map nodes and
387
384
  // set them new unique name.
388
385
  let skipAssign = false;
389
- if (prevFakeMarker && prevFakeMarker.start && prevFakeMarker.end) {
386
+ if (prevFakeMarker?.start && prevFakeMarker?.end) {
390
387
  const config = this._getMarkerClipboardConfig(fakeMarker.name);
391
388
  if (config.duplicateOnPaste) {
392
389
  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
+ ];
33
36
  constructor(view) {
34
37
  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,23 +99,38 @@ import '../theme/clipboard.css';
99
99
  * @internal
100
100
  */
101
101
  export default class DragDrop extends Plugin {
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
- }
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;
119
134
  /**
120
135
  * @inheritDoc
121
136
  */
@@ -193,7 +208,7 @@ export default class DragDrop extends Plugin {
193
208
  // The handler for the drag start; it is responsible for setting data transfer object.
194
209
  this.listenTo(viewDocument, 'dragstart', (evt, data) => {
195
210
  // Don't drag the editable element itself.
196
- if (data.target && data.target.is('editableElement')) {
211
+ if (data.target?.is('editableElement')) {
197
212
  data.preventDefault();
198
213
  return;
199
214
  }
@@ -14,17 +14,14 @@ import ClipboardObserver from './clipboardobserver.js';
14
14
  * @internal
15
15
  */
16
16
  export default class DragDropBlockToolbar extends Plugin {
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
- }
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())();
28
25
  /**
29
26
  * @inheritDoc
30
27
  */
@@ -8,46 +8,43 @@
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 'lodash-es';
11
+ import { throttle } from 'es-toolkit/compat';
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
- 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
- }
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();
51
48
  /**
52
49
  * @inheritDoc
53
50
  */