8
0
Szymon Kupś 9 лет назад
Родитель
Сommit
b69c7fb021

+ 5 - 5
packages/ckeditor5-image/src/imagecaption/imagecaptionengine.js

@@ -19,7 +19,7 @@ import ModelPosition from '@ckeditor/ckeditor5-engine/src/model/position';
 import buildViewConverter from '@ckeditor/ckeditor5-engine/src/conversion/buildviewconverter';
 import ViewMatcher from '@ckeditor/ckeditor5-engine/src/view/matcher';
 import { isImage, isImageWidget } from '../utils';
-import { captionEditableCreator, isCaptionEditable, getCaptionFromImage } from './utils';
+import { editableCaptionCreator, isCaptionEditable, getCaptionFromImage } from './utils';
 
 /**
  * The image caption engine plugin.
@@ -53,7 +53,7 @@ export default class ImageCaptionEngine extends Plugin {
 		schema.allow( { name: 'caption', inside: 'image' } );
 
 		// Add caption element to each image inserted without it.
-		document.on( 'change', insertCaptionElement );
+		document.on( 'change', insertMissingCaptionElement );
 
 		// View to model converter for data pipeline.
 		const matcher = new ViewMatcher( ( element ) => {
@@ -81,7 +81,7 @@ export default class ImageCaptionEngine extends Plugin {
 		// Model to view converter for editing pipeline.
 		editing.modelToView.on(
 			'insert:caption',
-			captionModelToView( captionEditableCreator( viewDocument ) )
+			captionModelToView( editableCaptionCreator( viewDocument ) )
 		);
 
 		// Adding / removing caption element when there is no text in the model.
@@ -152,7 +152,7 @@ export default class ImageCaptionEngine extends Plugin {
 		const selection = editing.view.selection;
 		const imageFigure = selection.getSelectedElement();
 		const mapper = editing.mapper;
-		const editableCreator = captionEditableCreator( editing.view );
+		const editableCreator = editableCaptionCreator( editing.view );
 
 		if ( imageFigure && isImageWidget( imageFigure ) ) {
 			const modelImage = mapper.toModelElement( imageFigure );
@@ -176,7 +176,7 @@ export default class ImageCaptionEngine extends Plugin {
 // If there is none - adds it to the image element.
 //
 // @private
-function insertCaptionElement( evt, changeType, data, batch ) {
+function insertMissingCaptionElement( evt, changeType, data, batch ) {
 	if ( changeType !== 'insert' ) {
 		return;
 	}

+ 3 - 3
packages/ckeditor5-image/src/imagecaption/utils.js

@@ -13,14 +13,14 @@ import ModelElement from '@ckeditor/ckeditor5-engine/src/model/element';
 const captionSymbol = Symbol( 'imageCaption' );
 
 /**
- * Returns function that creates caption editable element for given {@link module:engine/view/document~Document}.
+ * Returns a function that creates caption editable element for the given {@link module:engine/view/document~Document}.
  *
  * @param {module:engine/view/document~Document} viewDocument
  * @return {Function}
  */
-export function captionEditableCreator( viewDocument ) {
+export function editableCaptionCreator( viewDocument ) {
 	return () => {
-		const editable = new ViewEditableElement( 'figcaption', { contenteditable: true } ) ;
+		const editable = new ViewEditableElement( 'figcaption', { contenteditable: true } );
 		editable.document = viewDocument;
 		editable.setCustomProperty( captionSymbol, true );
 

+ 3 - 3
packages/ckeditor5-image/tests/imagecaption/utils.js

@@ -5,7 +5,7 @@
 
 import ViewDocument from '@ckeditor/ckeditor5-engine/src/view/document';
 import ViewEditableElement from '@ckeditor/ckeditor5-engine/src/view/editableelement';
-import { captionEditableCreator, isCaptionEditable, getCaptionFromImage } from '../../src/imagecaption/utils';
+import { editableCaptionCreator, isCaptionEditable, getCaptionFromImage } from '../../src/imagecaption/utils';
 import ModelElement from '@ckeditor/ckeditor5-engine/src/model/element';
 
 describe( 'image captioning utils', () => {
@@ -13,11 +13,11 @@ describe( 'image captioning utils', () => {
 
 	beforeEach( () => {
 		document = new ViewDocument();
-		const creator = captionEditableCreator( document );
+		const creator = editableCaptionCreator( document );
 		element = creator();
 	} );
 
-	describe( 'captionEditableCreator', () => {
+	describe( 'editableCaptionCreator', () => {
 		it( 'should create figcatpion editable element', () => {
 			expect( element ).to.be.instanceOf( ViewEditableElement );
 			expect( element.name ).to.equal( 'figcaption' );