Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Internal: Renamed cursorPosition to modelCursor.
Browse files Browse the repository at this point in the history
  • Loading branch information
oskarwrobel committed Feb 1, 2018
1 parent 4408864 commit c140b9e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/image/converters.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function viewFigureToModel() {
}

// Do not convert if image cannot be placed in model at current position.
if ( !conversionApi.schema.checkChild( data.cursorPosition, 'image' ) ) {
if ( !conversionApi.schema.checkChild( data.modelCursor, 'image' ) ) {
return;
}

Expand All @@ -46,7 +46,7 @@ export function viewFigureToModel() {
}

// Convert view image to model image.
const { modelRange } = conversionApi.convertItem( viewImage, data.cursorPosition );
const { modelRange } = conversionApi.convertItem( viewImage, data.modelCursor );

// Get image element from conversion result.
const modelImage = first( modelRange.getItems() );
Expand All @@ -56,7 +56,7 @@ export function viewFigureToModel() {

// Set model image as conversion result.
data.modelRange = ModelRange.createOn( modelImage );
data.cursorPosition = data.modelRange.end;
data.modelCursor = data.modelRange.end;
};
}

Expand Down
8 changes: 4 additions & 4 deletions tests/image/converters.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ describe( 'Image converters', () => {
if ( conversionApi.consumable.consume( data.viewItem, { name: true, attribute: 'src' } ) ) {
const image = conversionApi.writer.createElement( 'image', { src: data.viewItem.getAttribute( 'src' ) } );

conversionApi.writer.insert( image, data.cursorPosition );
conversionApi.writer.insert( image, data.modelCursor );

data.modelRange = ModelRange.createOn( image );
data.cursorPosition = data.modelRange.end;
data.modelCursor = data.modelRange.end;

imgConverterCalled = true;
}
Expand Down Expand Up @@ -106,9 +106,9 @@ describe( 'Image converters', () => {
src: data.viewItem.getChild( 0 ).getAttribute( 'src' )
}
} );
conversionApi.writer.insert( element, data.cursorPosition );
conversionApi.writer.insert( element, data.modelCursor );
data.modelRange = ModelRange.createOn( element );
data.cursorPosition = data.modelRange.end;
data.modelCursor = data.modelRange.end;
}, { priority: 'high' } );

editor.setData( '<figure class="image"><img src="foo.png" />xyz</figure>' );
Expand Down

0 comments on commit c140b9e

Please sign in to comment.