Przeglądaj źródła

Code style: Aligned code style to new ESLint version.

Kamil Piechaczek 8 lat temu
rodzic
commit
932e1e9ef3

+ 9 - 8
packages/ckeditor5-clipboard/tests/clipboard.js

@@ -26,14 +26,15 @@ describe( 'Clipboard feature', () => {
 	let editor, editingView, clipboardPlugin;
 
 	beforeEach( () => {
-		return VirtualTestEditor.create( {
-			plugins: [ Clipboard, Paragraph ]
-		} )
-		.then( newEditor => {
-			editor = newEditor;
-			editingView = editor.editing.view;
-			clipboardPlugin = editor.plugins.get( 'Clipboard' );
-		} );
+		return VirtualTestEditor
+			.create( {
+				plugins: [ Clipboard, Paragraph ]
+			} )
+			.then( newEditor => {
+				editor = newEditor;
+				editingView = editor.editing.view;
+				clipboardPlugin = editor.plugins.get( 'Clipboard' );
+			} );
 	} );
 
 	describe( 'constructor()', () => {

+ 35 - 34
packages/ckeditor5-clipboard/tests/manual/copycut.js

@@ -10,41 +10,42 @@ import ArticlePreset from '@ckeditor/ckeditor5-presets/src/article';
 
 import { stringify as stringifyView } from '@ckeditor/ckeditor5-engine/src/dev-utils/view';
 
-ClassicEditor.create( document.querySelector( '#editor' ), {
-	plugins: [ ArticlePreset ],
-	toolbar: [ 'headings', 'bold', 'italic', 'link', 'bulletedList', 'numberedList', 'undo', 'redo' ]
-} )
-.then( editor => {
-	window.editor = editor;
-	const clipboard = editor.plugins.get( 'Clipboard' );
-
-	editor.editing.view.on( 'paste', ( evt, data ) => {
-		console.clear();
-		onViewEvent( evt, data );
+ClassicEditor
+	.create( document.querySelector( '#editor' ), {
+		plugins: [ ArticlePreset ],
+		toolbar: [ 'headings', 'bold', 'italic', 'link', 'bulletedList', 'numberedList', 'undo', 'redo' ]
+	} )
+	.then( editor => {
+		window.editor = editor;
+		const clipboard = editor.plugins.get( 'Clipboard' );
+
+		editor.editing.view.on( 'paste', ( evt, data ) => {
+			console.clear();
+			onViewEvent( evt, data );
+		} );
+		editor.editing.view.on( 'paste', onViewEvent );
+		editor.editing.view.on( 'copy', onViewEvent, { priority: 'lowest' } );
+		editor.editing.view.on( 'cut', onViewEvent, { priority: 'lowest' } );
+
+		clipboard.on( 'inputTransformation', onPipelineEvent );
+		editor.editing.view.on( 'clipboardOutput', ( evt, data ) => {
+			console.clear();
+			onPipelineEvent( evt, data );
+		} );
+
+		function onViewEvent( evt, data ) {
+			console.log( `----- ${ evt.name } -----` );
+			console.log( 'text/html\n', data.dataTransfer.getData( 'text/html' ) );
+		}
+
+		function onPipelineEvent( evt, data ) {
+			console.log( `----- ${ evt.name } -----` );
+			console.log( 'stringify( data.content )\n', stringifyView( data.content ) );
+		}
+	} )
+	.catch( err => {
+		console.error( err.stack );
 	} );
-	editor.editing.view.on( 'paste', onViewEvent );
-	editor.editing.view.on( 'copy', onViewEvent, { priority: 'lowest' } );
-	editor.editing.view.on( 'cut', onViewEvent, { priority: 'lowest' } );
-
-	clipboard.on( 'inputTransformation', onPipelineEvent );
-	editor.editing.view.on( 'clipboardOutput', ( evt, data ) => {
-		console.clear();
-		onPipelineEvent( evt, data );
-	} );
-
-	function onViewEvent( evt, data ) {
-		console.log( `----- ${ evt.name } -----` );
-		console.log( 'text/html\n', data.dataTransfer.getData( 'text/html' ) );
-	}
-
-	function onPipelineEvent( evt, data ) {
-		console.log( `----- ${ evt.name } -----` );
-		console.log( 'stringify( data.content )\n', stringifyView( data.content ) );
-	}
-} )
-.catch( err => {
-	console.error( err.stack );
-} );
 
 document.getElementById( 'native' ).addEventListener( 'paste', onNativeEvent );
 document.getElementById( 'native' ).addEventListener( 'copy', onNativeEvent );

+ 34 - 33
packages/ckeditor5-clipboard/tests/manual/dropping.js

@@ -13,38 +13,39 @@ import Selection from '@ckeditor/ckeditor5-engine/src/model/selection';
 
 // import { stringify as stringifyView } from '@ckeditor/ckeditor5-engine/src/dev-utils/view';
 
-ClassicEditor.create( document.querySelector( '#editor' ), {
-	plugins: [ ArticlePreset ],
-	toolbar: [ 'headings', 'bold', 'italic', 'link', 'bulletedList', 'numberedList', 'undo', 'redo' ]
-} )
-.then( editor => {
-	window.editor = editor;
-	// const clipboard = editor.plugins.get( 'Clipboard' );
-
-	editor.editing.view.on( 'drop', ( evt, data ) => {
-		console.clear();
-
-		console.log( '----- drop -----' );
-		console.log( data );
-		console.log( 'text/html\n', data.dataTransfer.getData( 'text/html' ) );
-		console.log( 'text/plain\n', data.dataTransfer.getData( 'text/plain' ) );
-
-		data.preventDefault();
-		evt.stop();
-
-		editor.document.enqueueChanges( () => {
-			const insertAtSelection = new Selection( [ editor.editing.mapper.toModelRange( data.dropRange ) ] );
-			editor.data.insertContent( new Text( '@' ), insertAtSelection );
-			editor.document.selection.setTo( insertAtSelection );
+ClassicEditor
+	.create( document.querySelector( '#editor' ), {
+		plugins: [ ArticlePreset ],
+		toolbar: [ 'headings', 'bold', 'italic', 'link', 'bulletedList', 'numberedList', 'undo', 'redo' ]
+	} )
+	.then( editor => {
+		window.editor = editor;
+		// const clipboard = editor.plugins.get( 'Clipboard' );
+
+		editor.editing.view.on( 'drop', ( evt, data ) => {
+			console.clear();
+
+			console.log( '----- drop -----' );
+			console.log( data );
+			console.log( 'text/html\n', data.dataTransfer.getData( 'text/html' ) );
+			console.log( 'text/plain\n', data.dataTransfer.getData( 'text/plain' ) );
+
+			data.preventDefault();
+			evt.stop();
+
+			editor.document.enqueueChanges( () => {
+				const insertAtSelection = new Selection( [ editor.editing.mapper.toModelRange( data.dropRange ) ] );
+				editor.data.insertContent( new Text( '@' ), insertAtSelection );
+				editor.document.selection.setTo( insertAtSelection );
+			} );
 		} );
-	} );
 
-	// Waiting until a real dropping support...
-	// clipboard.on( 'inputTransformation', ( evt, data ) => {
-	// 	console.log( '----- clipboardInput -----' );
-	// 	console.log( 'stringify( data.dataTransfer )\n', stringifyView( data.content ) );
-	// } );
-} )
-.catch( err => {
-	console.error( err.stack );
-} );
+		// Waiting until a real dropping support...
+		// clipboard.on( 'inputTransformation', ( evt, data ) => {
+		// 	console.log( '----- clipboardInput -----' );
+		// 	console.log( 'stringify( data.dataTransfer )\n', stringifyView( data.content ) );
+		// } );
+	} )
+	.catch( err => {
+		console.error( err.stack );
+	} );

+ 22 - 21
packages/ckeditor5-clipboard/tests/manual/pasting.js

@@ -10,28 +10,29 @@ import ArticlePreset from '@ckeditor/ckeditor5-presets/src/article';
 
 import { stringify as stringifyView } from '@ckeditor/ckeditor5-engine/src/dev-utils/view';
 
-ClassicEditor.create( document.querySelector( '#editor' ), {
-	plugins: [ ArticlePreset ],
-	toolbar: [ 'headings', 'bold', 'italic', 'link', 'bulletedList', 'numberedList', 'undo', 'redo' ]
-} )
-.then( editor => {
-	window.editor = editor;
-	const clipboard = editor.plugins.get( 'Clipboard' );
+ClassicEditor
+	.create( document.querySelector( '#editor' ), {
+		plugins: [ ArticlePreset ],
+		toolbar: [ 'headings', 'bold', 'italic', 'link', 'bulletedList', 'numberedList', 'undo', 'redo' ]
+	} )
+	.then( editor => {
+		window.editor = editor;
+		const clipboard = editor.plugins.get( 'Clipboard' );
 
-	editor.editing.view.on( 'paste', ( evt, data ) => {
-		console.clear();
+		editor.editing.view.on( 'paste', ( evt, data ) => {
+			console.clear();
 
-		console.log( '----- paste -----' );
-		console.log( data );
-		console.log( 'text/html\n', data.dataTransfer.getData( 'text/html' ) );
-		console.log( 'text/plain\n', data.dataTransfer.getData( 'text/plain' ) );
-	} );
+			console.log( '----- paste -----' );
+			console.log( data );
+			console.log( 'text/html\n', data.dataTransfer.getData( 'text/html' ) );
+			console.log( 'text/plain\n', data.dataTransfer.getData( 'text/plain' ) );
+		} );
 
-	clipboard.on( 'inputTransformation', ( evt, data ) => {
-		console.log( '----- clipboardInput -----' );
-		console.log( 'stringify( data.dataTransfer )\n', stringifyView( data.content ) );
+		clipboard.on( 'inputTransformation', ( evt, data ) => {
+			console.log( '----- clipboardInput -----' );
+			console.log( 'stringify( data.dataTransfer )\n', stringifyView( data.content ) );
+		} );
+	} )
+	.catch( err => {
+		console.error( err.stack );
 	} );
-} )
-.catch( err => {
-	console.error( err.stack );
-} );