@ckeditor/ckeditor5-clipboard 0.0.0-nightly-20231003.0 → 0.0.0-nightly-20231005.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-20231003.0",
3
+ "version": "0.0.0-nightly-20231005.0",
4
4
  "description": "Clipboard integration feature for CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -12,11 +12,11 @@
12
12
  ],
13
13
  "main": "src/index.js",
14
14
  "dependencies": {
15
- "@ckeditor/ckeditor5-core": "0.0.0-nightly-20231003.0",
16
- "@ckeditor/ckeditor5-engine": "0.0.0-nightly-20231003.0",
17
- "@ckeditor/ckeditor5-ui": "0.0.0-nightly-20231003.0",
18
- "@ckeditor/ckeditor5-utils": "0.0.0-nightly-20231003.0",
19
- "@ckeditor/ckeditor5-widget": "0.0.0-nightly-20231003.0",
15
+ "@ckeditor/ckeditor5-core": "0.0.0-nightly-20231005.0",
16
+ "@ckeditor/ckeditor5-engine": "0.0.0-nightly-20231005.0",
17
+ "@ckeditor/ckeditor5-ui": "0.0.0-nightly-20231005.0",
18
+ "@ckeditor/ckeditor5-utils": "0.0.0-nightly-20231005.0",
19
+ "@ckeditor/ckeditor5-widget": "0.0.0-nightly-20231005.0",
20
20
  "lodash-es": "4.17.21"
21
21
  },
22
22
  "author": "CKSource (http://cksource.com/)",
package/src/dragdrop.js CHANGED
@@ -409,7 +409,17 @@ export default class DragDrop extends Plugin {
409
409
  }
410
410
  // Delete moved content.
411
411
  if (moved && this.isEnabled) {
412
- model.deleteContent(model.createSelection(this._draggedRange), { doNotAutoparagraph: true });
412
+ model.change(writer => {
413
+ const selection = model.createSelection(this._draggedRange);
414
+ model.deleteContent(selection, { doNotAutoparagraph: true });
415
+ // Check result selection if it does not require auto-paragraphing of empty container.
416
+ const selectionParent = selection.getFirstPosition().parent;
417
+ if (selectionParent.isEmpty &&
418
+ !model.schema.checkChild(selectionParent, '$text') &&
419
+ model.schema.checkChild(selectionParent, 'paragraph')) {
420
+ writer.insertElement('paragraph', selectionParent, 0);
421
+ }
422
+ });
413
423
  }
414
424
  this._draggedRange.detach();
415
425
  this._draggedRange = null;
@@ -485,6 +495,13 @@ export default class DragDrop extends Plugin {
485
495
  preview.className = 'ck ck-content';
486
496
  preview.style.width = computedStyle.width;
487
497
  preview.style.paddingLeft = `${domRect.left - clientX + domEditablePaddingLeft}px`;
498
+ /**
499
+ * Set white background in drag and drop preview if iOS.
500
+ * Check: https://github.com/ckeditor/ckeditor5/issues/15085
501
+ */
502
+ if (env.isiOS) {
503
+ preview.style.backgroundColor = 'white';
504
+ }
488
505
  preview.innerHTML = dataTransfer.getData('text/html');
489
506
  dataTransfer.setDragImage(preview, 0, 0);
490
507
  this._previewContainer.appendChild(preview);
@@ -278,6 +278,9 @@ function findDropTargetRange(editor, targetViewElement, targetViewRanges, client
278
278
  .filter((node) => node.is('element') && !isFloatingElement(editor, node));
279
279
  let startIndex = 0;
280
280
  let endIndex = childNodes.length;
281
+ if (endIndex == 0) {
282
+ return model.createRange(model.createPositionAt(modelElement, 'end'));
283
+ }
281
284
  while (startIndex < endIndex - 1) {
282
285
  const middleIndex = Math.floor((startIndex + endIndex) / 2);
283
286
  const side = findElementSide(editor, childNodes[middleIndex], clientX, clientY);