Преглед на файлове

Code style: Switched to ESLint.

Kamil Piechaczek преди 8 години
родител
ревизия
9426c2724b

+ 1 - 1
packages/ckeditor5-editor-inline/src/inline.js

@@ -68,7 +68,7 @@ export default class InlineEditor extends StandardEditor {
 	 * @returns {module:core/editor/standardeditor~StandardEditor} return.editor The editor instance.
 	 */
 	static create( element, config ) {
-		return new Promise( ( resolve ) => {
+		return new Promise( resolve => {
 			const editor = new InlineEditor( element, config );
 
 			resolve(

+ 22 - 22
packages/ckeditor5-editor-inline/src/inlineeditoruiview.js

@@ -13,6 +13,28 @@ import BalloonPanelView from '@ckeditor/ckeditor5-ui/src/panel/balloon/balloonpa
 import ToolbarView from '@ckeditor/ckeditor5-ui/src/toolbar/toolbarview';
 import Template from '@ckeditor/ckeditor5-ui/src/template';
 
+// A set of positioning functions used by the
+// {@link module:editor-inline/inlineeditoruiview~InlineEditableUIView#panel}.
+//
+// @private
+// @type {module:utils/dom/position~Options#positions}
+const panelPositions = [
+	( editableRect, panelRect ) => {
+		return {
+			top: getPanelPositionTop( editableRect, panelRect ),
+			left: editableRect.left,
+			name: 'toolbar_west'
+		};
+	},
+	( editableRect, panelRect ) => {
+		return {
+			top: getPanelPositionTop( editableRect, panelRect ),
+			left: editableRect.left + editableRect.width - panelRect.width,
+			name: 'toolbar_east'
+		};
+	}
+];
+
 /**
  * Inline editor UI view. Uses inline editable and floating toolbar.
  *
@@ -134,28 +156,6 @@ export default class InlineEditorUIView extends EditorUIView {
 	}
 }
 
-// A set of positioning functions used by the
-// {@link module:editor-inline/inlineeditoruiview~InlineEditableUIView#panel}.
-//
-// @private
-// @type {module:utils/dom/position~Options#positions}
-const panelPositions = [
-	( editableRect, panelRect ) => {
-		return {
-			top: getPanelPositionTop( editableRect, panelRect ),
-			left: editableRect.left,
-			name: 'toolbar_west'
-		};
-	},
-	( editableRect, panelRect ) => {
-		return {
-			top: getPanelPositionTop( editableRect, panelRect ),
-			left: editableRect.left + editableRect.width - panelRect.width,
-			name: 'toolbar_east'
-		};
-	}
-];
-
 // Determines panel top position for
 // {@link module:editor-inline/inlineeditoruiview~InlineEditableUIView#panelPositions}
 //

+ 23 - 23
packages/ckeditor5-editor-inline/tests/inline.js

@@ -61,11 +61,11 @@ describe( 'InlineEditor', () => {
 	describe( 'create()', () => {
 		beforeEach( function() {
 			return InlineEditor.create( editorElement, {
-					plugins: [ Paragraph, Bold ]
-				} )
-				.then( newEditor => {
-					editor = newEditor;
-				} );
+				plugins: [ Paragraph, Bold ]
+			} )
+			.then( newEditor => {
+				editor = newEditor;
+			} );
 		} );
 
 		afterEach( () => {
@@ -111,13 +111,13 @@ describe( 'InlineEditor', () => {
 			}
 
 			return InlineEditor.create( editorElement, {
-					plugins: [ EventWatcher ]
-				} )
-				.then( ( newEditor ) => {
-					expect( fired ).to.deep.equal( [ 'pluginsReady', 'uiReady', 'dataReady', 'ready' ] );
+				plugins: [ EventWatcher ]
+			} )
+			.then( newEditor => {
+				expect( fired ).to.deep.equal( [ 'pluginsReady', 'uiReady', 'dataReady', 'ready' ] );
 
-					editor = newEditor;
-				} );
+				editor = newEditor;
+			} );
 		} );
 
 		it( 'fires dataReady once data is loaded', () => {
@@ -132,13 +132,13 @@ describe( 'InlineEditor', () => {
 			}
 
 			return InlineEditor.create( editorElement, {
-					plugins: [ EventWatcher, Paragraph, Bold ]
-				} )
-				.then( ( newEditor ) => {
-					expect( data ).to.equal( '<p><strong>foo</strong> bar</p>' );
+				plugins: [ EventWatcher, Paragraph, Bold ]
+			} )
+			.then( newEditor => {
+				expect( data ).to.equal( '<p><strong>foo</strong> bar</p>' );
 
-					editor = newEditor;
-				} );
+				editor = newEditor;
+			} );
 		} );
 
 		it( 'fires uiReady once UI is ready', () => {
@@ -153,13 +153,13 @@ describe( 'InlineEditor', () => {
 			}
 
 			return InlineEditor.create( editorElement, {
-					plugins: [ EventWatcher ]
-				} )
-				.then( ( newEditor ) => {
-					expect( isReady ).to.be.true;
+				plugins: [ EventWatcher ]
+			} )
+			.then( newEditor => {
+				expect( isReady ).to.be.true;
 
-					editor = newEditor;
-				} );
+				editor = newEditor;
+			} );
 		} );
 	} );
 

+ 1 - 1
packages/ckeditor5-editor-inline/tests/inlineeditorui.js

@@ -193,7 +193,7 @@ describe( 'InlineEditorUI', () => {
 } );
 
 function viewCreator( name ) {
-	return ( locale ) => {
+	return locale => {
 		const view = new View( locale );
 
 		view.name = name;

+ 3 - 3
packages/ckeditor5-editor-inline/tests/manual/inline.js

@@ -29,7 +29,7 @@ function initEditors() {
 			window.editors[ selector ] = editor;
 			window.editables.push( editor.editing.view.getRoot() );
 
-			let observer = testUtils.createObserver();
+			const observer = testUtils.createObserver();
 
 			observer.observe(
 				`${ selector }.ui.focusTracker`,
@@ -46,13 +46,13 @@ function initEditors() {
 }
 
 function destroyEditors() {
-	for ( let selector in window.editors ) {
+	for ( const selector in window.editors ) {
 		window.editors[ selector ].destroy().then( () => {
 			console.log( `${ selector } was destroyed.` );
 		} );
 	}
 
-	for ( let observer of window._observers ) {
+	for ( const observer of window._observers ) {
 		observer.stopListening();
 	}