8
0
Maciej Bukowski 8 лет назад
Родитель
Сommit
1445aaac00

+ 0 - 12
packages/ckeditor5-clipboard/src/clipboard.js

@@ -191,18 +191,6 @@ export default class Clipboard extends Plugin {
 }
 
 /**
- * Fired with a `dataTransfer`, which comes from the clipboard (was pasted or dropped) and
- * should be processed in order to be inserted into the editor.
- * It's part of the {@link module:clipboard/clipboard~Clipboard "clipboard pipeline"}.
- *
- * @see module:clipboard/clipboardobserver~ClipboardObserver
- * @see module:clipboard/clipboard~Clipboard
- * @event module:engine/view/document~Document#event:input
- * @param {Object} data Event data.
- * @param {module:clipboard/datatransfer~DataTransfer} data.dataTransfer Data transfer instance.
- */
-
-/**
  * Fired with a `content`, which comes from the clipboard (was pasted or dropped) and
  * should be processed in order to be inserted into the editor.
  * It's part of the {@link module:clipboard/clipboard~Clipboard "clipboard pipeline"}.

+ 12 - 0
packages/ckeditor5-clipboard/src/clipboardobserver.js

@@ -43,6 +43,18 @@ export default class ClipboardObserver extends DomEventObserver {
 }
 
 /**
+ * Fired with a `dataTransfer`, which comes from the clipboard (was pasted or dropped) and
+ * should be processed in order to be inserted into the editor.
+ * It's part of the {@link module:clipboard/clipboard~Clipboard "clipboard pipeline"}.
+ *
+ * @see module:clipboard/clipboardobserver~ClipboardObserver
+ * @see module:clipboard/clipboard~Clipboard
+ * @event module:engine/view/document~Document#event:input
+ * @param {Object} data Event data.
+ * @param {module:clipboard/datatransfer~DataTransfer} data.dataTransfer Data transfer instance.
+ */
+
+/**
  * Fired when user dropped content into one of the editables.
  *
  * Introduced by {@link module:clipboard/clipboardobserver~ClipboardObserver}.

+ 6 - 0
packages/ckeditor5-clipboard/src/datatransfer.js

@@ -20,6 +20,12 @@ export default class DataTransfer {
 		 */
 		this._native = nativeDataTransfer;
 
+		/**
+		 * The array of files created from the native `DataTransfer#files` and `DataTransfer#items` objects.
+		 *
+		 * @public
+		 * @member {Array.<File>} #files
+		 */
 		this.files = Array.from( this._getFiles() );
 	}
 

+ 2 - 1
packages/ckeditor5-clipboard/tests/manual/copycut.js

@@ -36,6 +36,7 @@ ClassicEditor.create( document.querySelector( '#editor' ), {
 } )
 .then( editor => {
 	window.editor = editor;
+	const clipboard = editor.plugins.get( 'clipboard/clipboard' );
 
 	editor.editing.view.on( 'paste', ( evt, data ) => {
 		console.clear();
@@ -45,7 +46,7 @@ ClassicEditor.create( document.querySelector( '#editor' ), {
 	editor.editing.view.on( 'copy', onViewEvent, { priority: 'lowest' } );
 	editor.editing.view.on( 'cut', onViewEvent, { priority: 'lowest' } );
 
-	editor.editing.view.on( 'input', onPipelineEvent );
+	clipboard.on( 'inputTransformation', onPipelineEvent );
 	editor.editing.view.on( 'clipboardOutput', ( evt, data ) => {
 		console.clear();
 		onPipelineEvent( evt, data );

+ 3 - 2
packages/ckeditor5-clipboard/tests/manual/pasting.js

@@ -36,6 +36,7 @@ ClassicEditor.create( document.querySelector( '#editor' ), {
 } )
 .then( editor => {
 	window.editor = editor;
+	const clipboard = editor.plugins.get( 'clipboard/clipboard' );
 
 	editor.editing.view.on( 'paste', ( evt, data ) => {
 		console.clear();
@@ -46,9 +47,9 @@ ClassicEditor.create( document.querySelector( '#editor' ), {
 		console.log( 'text/plain\n', data.dataTransfer.getData( 'text/plain' ) );
 	} );
 
-	editor.editing.view.on( 'input', ( evt, data ) => {
+	clipboard.on( 'inputTransformation', ( evt, data ) => {
 		console.log( '----- clipboardInput -----' );
-		console.log( 'stringify( data.content )\n', stringifyView( data.content ) );
+		console.log( 'stringify( data.dataTransfer )\n', stringifyView( data.content ) );
 	} );
 } )
 .catch( err => {