@ckeditor/ckeditor5-clipboard 0.0.0-nightly-20231004.0 → 0.0.0-nightly-20231006.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 +6 -6
- package/src/clipboardpipeline.js +1 -1
- package/src/dragdrop.js +18 -1
- package/src/dragdroptarget.js +3 -0
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-20231006.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-
|
|
16
|
-
"@ckeditor/ckeditor5-engine": "0.0.0-nightly-
|
|
17
|
-
"@ckeditor/ckeditor5-ui": "0.0.0-nightly-
|
|
18
|
-
"@ckeditor/ckeditor5-utils": "0.0.0-nightly-
|
|
19
|
-
"@ckeditor/ckeditor5-widget": "0.0.0-nightly-
|
|
15
|
+
"@ckeditor/ckeditor5-core": "0.0.0-nightly-20231006.0",
|
|
16
|
+
"@ckeditor/ckeditor5-engine": "0.0.0-nightly-20231006.0",
|
|
17
|
+
"@ckeditor/ckeditor5-ui": "0.0.0-nightly-20231006.0",
|
|
18
|
+
"@ckeditor/ckeditor5-utils": "0.0.0-nightly-20231006.0",
|
|
19
|
+
"@ckeditor/ckeditor5-widget": "0.0.0-nightly-20231006.0",
|
|
20
20
|
"lodash-es": "4.17.21"
|
|
21
21
|
},
|
|
22
22
|
"author": "CKSource (http://cksource.com/)",
|
package/src/clipboardpipeline.js
CHANGED
|
@@ -40,7 +40,7 @@ import viewToPlainText from './utils/viewtoplaintext';
|
|
|
40
40
|
//
|
|
41
41
|
// ┌──────────────────────┐ ┌──────────────────────┐
|
|
42
42
|
// │ view.Document │ │ view.Document │ Retrieves the selected model.DocumentFragment
|
|
43
|
-
// │ copy │ │ cut │ and fires `outputTransformation` event.
|
|
43
|
+
// │ copy │ │ cut │ and fires the `outputTransformation` event.
|
|
44
44
|
// └───────────┬──────────┘ └───────────┬──────────┘
|
|
45
45
|
// │ │
|
|
46
46
|
// └────────────────┌────────────────┘
|
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.
|
|
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);
|
package/src/dragdroptarget.js
CHANGED
|
@@ -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);
|