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

Commit

Permalink
Merge branch t/ckeditor5-engine/1209
Browse files Browse the repository at this point in the history
Internal: Update API usage after merge t/1209 on engine.
  • Loading branch information
Piotr Jasiun committed Jan 29, 2018
2 parents 0c0a673 + 003c2bb commit 9cd8053
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/imageuploadcommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,9 @@ export default class ImageUploadCommand extends Command {
const editor = this.editor;
const doc = editor.model.document;
const file = options.file;
const selection = doc.selection;
const fileRepository = editor.plugins.get( FileRepository );

editor.model.change( () => {
editor.model.change( writer => {
const loader = fileRepository.createLoader( file );

// Do not throw when upload adapter is not set. FileRepository will log an error anyway.
Expand All @@ -61,7 +60,7 @@ export default class ImageUploadCommand extends Command {

// Inserting an image might've failed due to schema regulations.
if ( imageElement.parent ) {
selection.setRanges( [ ModelRange.createOn( imageElement ) ] );
writer.setSelection( ModelRange.createOn( imageElement ) );
}
} );
}
Expand Down

0 comments on commit 9cd8053

Please sign in to comment.