How to use the @ckeditor/ckeditor5-clipboard/src/datatransfer function in @ckeditor/ckeditor5-clipboard

To help you get started, we’ve selected a few @ckeditor/ckeditor5-clipboard examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ckeditor / ckeditor5-image / tests / imageupload / imageuploadediting.js View on Github external
it( 'should not insert image when file is null', () => {
		const viewDocument = editor.editing.view.document;
		const dataTransfer = new DataTransfer( { files: [ null ], types: [ 'Files' ], getData: () => null } );

		setModelData( model, 'foo[]' );

		const targetRange = doc.selection.getFirstRange();
		const targetViewRange = editor.editing.mapper.toViewRange( targetRange );

		viewDocument.fire( 'clipboardInput', { dataTransfer, targetRanges: [ targetViewRange ] } );

		expect( getModelData( model ) ).to.equal( 'foo[]' );
	} );
github ckeditor / ckeditor5-image / tests / imageupload / imageuploadediting.js View on Github external
function mockDataTransfer( content ) {
	return new DataTransfer( {
		types: [ 'text/html' ],
		getData: type => type === 'text/html' ? content : ''
	} );
}

@ckeditor/ckeditor5-clipboard

Clipboard integration feature for CKEditor 5.

SEE LICENSE IN LICENSE.md
Latest version published 6 days ago

Package Health Score

86 / 100
Full package analysis

Popular @ckeditor/ckeditor5-clipboard functions