@ckeditor/ckeditor5-clipboard
Advanced tools
Comparing version 37.1.0 to 38.0.0-rc.0
{ | ||
"name": "@ckeditor/ckeditor5-clipboard", | ||
"version": "37.1.0", | ||
"version": "38.0.0-rc.0", | ||
"description": "Clipboard integration feature for CKEditor 5.", | ||
@@ -15,26 +15,44 @@ "keywords": [ | ||
"dependencies": { | ||
"@ckeditor/ckeditor5-core": "^37.1.0", | ||
"@ckeditor/ckeditor5-engine": "^37.1.0", | ||
"@ckeditor/ckeditor5-utils": "^37.1.0", | ||
"@ckeditor/ckeditor5-widget": "^37.1.0", | ||
"@ckeditor/ckeditor5-core": "^38.0.0-rc.0", | ||
"@ckeditor/ckeditor5-engine": "^38.0.0-rc.0", | ||
"@ckeditor/ckeditor5-ui": "^38.0.0-rc.0", | ||
"@ckeditor/ckeditor5-utils": "^38.0.0-rc.0", | ||
"@ckeditor/ckeditor5-widget": "^38.0.0-rc.0", | ||
"lodash-es": "^4.17.15" | ||
}, | ||
"devDependencies": { | ||
"@ckeditor/ckeditor5-alignment": "^37.1.0", | ||
"@ckeditor/ckeditor5-basic-styles": "^37.1.0", | ||
"@ckeditor/ckeditor5-block-quote": "^37.1.0", | ||
"@ckeditor/ckeditor5-cloud-services": "^37.1.0", | ||
"@ckeditor/ckeditor5-code-block": "^37.1.0", | ||
"@ckeditor/ckeditor5-easy-image": "^37.1.0", | ||
"@ckeditor/ckeditor5-editor-classic": "^37.1.0", | ||
"@ckeditor/ckeditor5-enter": "^37.1.0", | ||
"@ckeditor/ckeditor5-horizontal-line": "^37.1.0", | ||
"@ckeditor/ckeditor5-image": "^37.1.0", | ||
"@ckeditor/ckeditor5-link": "^37.1.0", | ||
"@ckeditor/ckeditor5-page-break": "^37.1.0", | ||
"@ckeditor/ckeditor5-paragraph": "^37.1.0", | ||
"@ckeditor/ckeditor5-paste-from-office": "^37.1.0", | ||
"@ckeditor/ckeditor5-remove-format": "^37.1.0", | ||
"@ckeditor/ckeditor5-table": "^37.1.0", | ||
"@ckeditor/ckeditor5-typing": "^37.1.0", | ||
"@ckeditor/ckeditor5-alignment": "^38.0.0-rc.0", | ||
"@ckeditor/ckeditor5-autoformat": "^38.0.0-rc.0", | ||
"@ckeditor/ckeditor5-basic-styles": "^38.0.0-rc.0", | ||
"@ckeditor/ckeditor5-block-quote": "^38.0.0-rc.0", | ||
"@ckeditor/ckeditor5-cloud-services": "^38.0.0-rc.0", | ||
"@ckeditor/ckeditor5-code-block": "^38.0.0-rc.0", | ||
"@ckeditor/ckeditor5-easy-image": "^38.0.0-rc.0", | ||
"@ckeditor/ckeditor5-editor-balloon": "^38.0.0-rc.0", | ||
"@ckeditor/ckeditor5-editor-classic": "^38.0.0-rc.0", | ||
"@ckeditor/ckeditor5-editor-decoupled": "^38.0.0-rc.0", | ||
"@ckeditor/ckeditor5-enter": "^38.0.0-rc.0", | ||
"@ckeditor/ckeditor5-essentials": "^38.0.0-rc.0", | ||
"@ckeditor/ckeditor5-find-and-replace": "^38.0.0-rc.0", | ||
"@ckeditor/ckeditor5-font": "^38.0.0-rc.0", | ||
"@ckeditor/ckeditor5-heading": "^38.0.0-rc.0", | ||
"@ckeditor/ckeditor5-highlight": "^38.0.0-rc.0", | ||
"@ckeditor/ckeditor5-horizontal-line": "^38.0.0-rc.0", | ||
"@ckeditor/ckeditor5-html-embed": "^38.0.0-rc.0", | ||
"@ckeditor/ckeditor5-html-support": "^38.0.0-rc.0", | ||
"@ckeditor/ckeditor5-image": "^38.0.0-rc.0", | ||
"@ckeditor/ckeditor5-indent": "^38.0.0-rc.0", | ||
"@ckeditor/ckeditor5-language": "^38.0.0-rc.0", | ||
"@ckeditor/ckeditor5-link": "^38.0.0-rc.0", | ||
"@ckeditor/ckeditor5-list": "^38.0.0-rc.0", | ||
"@ckeditor/ckeditor5-mention": "^38.0.0-rc.0", | ||
"@ckeditor/ckeditor5-page-break": "^38.0.0-rc.0", | ||
"@ckeditor/ckeditor5-paragraph": "^38.0.0-rc.0", | ||
"@ckeditor/ckeditor5-paste-from-office": "^38.0.0-rc.0", | ||
"@ckeditor/ckeditor5-remove-format": "^38.0.0-rc.0", | ||
"@ckeditor/ckeditor5-source-editing": "^38.0.0-rc.0", | ||
"@ckeditor/ckeditor5-style": "^38.0.0-rc.0", | ||
"@ckeditor/ckeditor5-table": "^38.0.0-rc.0", | ||
"@ckeditor/ckeditor5-typing": "^38.0.0-rc.0", | ||
"@ckeditor/ckeditor5-undo": "^38.0.0-rc.0", | ||
"typescript": "^4.8.4", | ||
@@ -41,0 +59,0 @@ "webpack": "^5.58.1", |
@@ -5,3 +5,3 @@ /** | ||
*/ | ||
import type { Clipboard, ClipboardPipeline, DragDrop, PastePlainText } from './index'; | ||
import type { Clipboard, ClipboardPipeline, PastePlainText, DragDrop, DragDropExperimental, DragDropTarget, DragDropBlockToolbar } from './index'; | ||
declare module '@ckeditor/ckeditor5-core' { | ||
@@ -11,5 +11,8 @@ interface PluginsMap { | ||
[ClipboardPipeline.pluginName]: ClipboardPipeline; | ||
[PastePlainText.pluginName]: PastePlainText; | ||
[DragDrop.pluginName]: DragDrop; | ||
[PastePlainText.pluginName]: PastePlainText; | ||
[DragDropExperimental.pluginName]: DragDropExperimental; | ||
[DragDropTarget.pluginName]: DragDropTarget; | ||
[DragDropBlockToolbar.pluginName]: DragDropBlockToolbar; | ||
} | ||
} |
@@ -51,3 +51,4 @@ /** | ||
targetRanges, | ||
target: data.target | ||
target: data.target, | ||
domEvent: data.domEvent | ||
}); | ||
@@ -54,0 +55,0 @@ // If CKEditor handled the input, do not bubble the original event any further. |
@@ -139,6 +139,6 @@ /** | ||
const viewDocument = view.document; | ||
// Pasting and dropping is disabled when editor is in the read-only mode. | ||
// See: https://github.com/ckeditor/ckeditor5-clipboard/issues/26. | ||
this.listenTo(viewDocument, 'clipboardInput', evt => { | ||
if (editor.isReadOnly) { | ||
// Pasting is disabled when selection is in non-editable place. | ||
// Dropping is disabled in drag and drop handler. | ||
this.listenTo(viewDocument, 'clipboardInput', (evt, data) => { | ||
if (data.method == 'paste' && !editor.model.canEditAt(editor.model.document.selection)) { | ||
evt.stop(); | ||
@@ -227,5 +227,5 @@ } | ||
this.listenTo(viewDocument, 'cut', (evt, data) => { | ||
// Cutting is disabled when editor is in the read-only mode. | ||
// Cutting is disabled when selection is in non-editable place. | ||
// See: https://github.com/ckeditor/ckeditor5-clipboard/issues/26. | ||
if (editor.isReadOnly) { | ||
if (!editor.model.canEditAt(editor.model.document.selection)) { | ||
data.preventDefault(); | ||
@@ -232,0 +232,0 @@ } |
@@ -8,7 +8,6 @@ /** | ||
*/ | ||
/* globals setTimeout, clearTimeout */ | ||
import { Plugin } from '@ckeditor/ckeditor5-core'; | ||
import { LiveRange, MouseObserver } from '@ckeditor/ckeditor5-engine'; | ||
import { Widget, isWidget } from '@ckeditor/ckeditor5-widget'; | ||
import { env, uid } from '@ckeditor/ckeditor5-utils'; | ||
import { env, uid, delay } from '@ckeditor/ckeditor5-utils'; | ||
import ClipboardPipeline from './clipboardpipeline'; | ||
@@ -125,2 +124,6 @@ import ClipboardObserver from './clipboardobserver'; | ||
this._clearDraggableAttributesDelayed = delay(() => this._clearDraggableAttributes(), 40); | ||
if (editor.plugins.has('DragDropExperimental')) { | ||
this.forceDisabled('DragDropExperimental'); | ||
return; | ||
} | ||
view.addObserver(ClipboardObserver); | ||
@@ -206,3 +209,4 @@ view.addObserver(MouseObserver); | ||
this._draggingUid = uid(); | ||
data.dataTransfer.effectAllowed = this.isEnabled ? 'copyMove' : 'copy'; | ||
const canEditAtDraggedRange = this.isEnabled && editor.model.canEditAt(this._draggedRange); | ||
data.dataTransfer.effectAllowed = canEditAtDraggedRange ? 'copyMove' : 'copy'; | ||
data.dataTransfer.setData('application/ckeditor5-dragging-uid', this._draggingUid); | ||
@@ -216,3 +220,3 @@ const draggedSelection = model.createSelection(this._draggedRange.toRange()); | ||
}); | ||
if (!this.isEnabled) { | ||
if (!canEditAtDraggedRange) { | ||
this._draggedRange.detach(); | ||
@@ -250,2 +254,7 @@ this._draggedRange = null; | ||
const targetRange = findDropTargetRange(editor, data.targetRanges, data.target); | ||
// Do not drop if target place is not editable. | ||
if (!editor.model.canEditAt(targetRange)) { | ||
data.dataTransfer.dropEffect = 'none'; | ||
return; | ||
} | ||
// If this is content being dragged from another editor, moving out of current editor instance | ||
@@ -288,3 +297,3 @@ // is not possible until 'dragend' event case will be fixed. | ||
/* istanbul ignore if -- @preserve */ | ||
if (!targetRange) { | ||
if (!targetRange || !editor.model.canEditAt(targetRange)) { | ||
this._finalizeDragging(false); | ||
@@ -364,6 +373,9 @@ evt.stop(); | ||
// in not firing selectionchange event ever, which makes the selection stuck in read-only mode. | ||
if (env.isBlink && !editor.isReadOnly && !draggableElement && !viewDocument.selection.isCollapsed) { | ||
if (env.isBlink && !draggableElement && !viewDocument.selection.isCollapsed) { | ||
const selectedElement = viewDocument.selection.getSelectedElement(); | ||
if (!selectedElement || !isWidget(selectedElement)) { | ||
draggableElement = viewDocument.selection.editableElement; | ||
const editableElement = viewDocument.selection.editableElement; | ||
if (editableElement && !editableElement.isReadOnly) { | ||
draggableElement = editableElement; | ||
} | ||
} | ||
@@ -628,19 +640,2 @@ } | ||
/** | ||
* Returns a function wrapper that will trigger a function after a specified wait time. | ||
* The timeout can be canceled by calling the cancel function on the returned wrapped function. | ||
* @param func The function to wrap. | ||
* @param wait The timeout in ms. | ||
*/ | ||
function delay(func, wait) { | ||
let timer; | ||
function delayed(...args) { | ||
delayed.cancel(); | ||
timer = setTimeout(() => func(...args), wait); | ||
} | ||
delayed.cancel = () => { | ||
clearTimeout(timer); | ||
}; | ||
return delayed; | ||
} | ||
/** | ||
* Returns a widget element that should be dragged. | ||
@@ -647,0 +642,0 @@ */ |
@@ -13,3 +13,6 @@ /** | ||
export { default as PastePlainText } from './pasteplaintext'; | ||
export { default as DragDropExperimental } from './dragdropexperimental'; | ||
export { default as DragDropTarget } from './dragdroptarget'; | ||
export { default as DragDropBlockToolbar } from './dragdropblocktoolbar'; | ||
export type { ViewDocumentClipboardInputEvent, ViewDocumentCopyEvent, ViewDocumentCutEvent } from './clipboardobserver'; | ||
import './augmentation'; |
@@ -12,2 +12,5 @@ /** | ||
export { default as PastePlainText } from './pasteplaintext'; | ||
export { default as DragDropExperimental } from './dragdropexperimental'; | ||
export { default as DragDropTarget } from './dragdroptarget'; | ||
export { default as DragDropBlockToolbar } from './dragdropblocktoolbar'; | ||
import './augmentation'; |
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
160823
33
3376
6
37
1
+ Added@ckeditor/ckeditor5-core@38.1.1(transitive)
+ Added@ckeditor/ckeditor5-engine@38.1.1(transitive)
+ Added@ckeditor/ckeditor5-enter@38.1.1(transitive)
+ Added@ckeditor/ckeditor5-typing@38.1.1(transitive)
+ Added@ckeditor/ckeditor5-ui@38.1.1(transitive)
+ Added@ckeditor/ckeditor5-utils@38.1.1(transitive)
+ Added@ckeditor/ckeditor5-widget@38.1.1(transitive)
+ Addedcolor-convert@2.0.1(transitive)
+ Addedcolor-name@1.1.4(transitive)
+ Addedcolor-parse@1.4.2(transitive)
+ Addedvanilla-colorful@0.7.2(transitive)
- Removed@ckeditor/ckeditor5-core@37.1.0(transitive)
- Removed@ckeditor/ckeditor5-engine@37.1.0(transitive)
- Removed@ckeditor/ckeditor5-enter@37.1.0(transitive)
- Removed@ckeditor/ckeditor5-typing@37.1.0(transitive)
- Removed@ckeditor/ckeditor5-ui@37.1.0(transitive)
- Removed@ckeditor/ckeditor5-utils@37.1.0(transitive)
- Removed@ckeditor/ckeditor5-widget@37.1.0(transitive)