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

Commit

Permalink
Merge pull request #70 from ckeditor/t/69
Browse files Browse the repository at this point in the history
Other: Use model.insertContent instead of model.Writer.insertText. Closes #69.
  • Loading branch information
Piotr Jasiun authored May 20, 2019
2 parents 86262d1 + 8a43035 commit ee973bb
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/mentioncommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,8 @@ export default class MentionCommand extends Command {
attributesWithMention.set( 'mention', mention );

// Replace a range with the text with a mention.
writer.remove( range );
writer.insertText( mentionText, attributesWithMention, range.start );

// Insert a space after the mention.
writer.insertText( ' ', currentAttributes, model.document.selection.focus );
model.insertContent( writer.createText( mentionText, attributesWithMention ), range );
model.insertContent( writer.createText( ' ', currentAttributes ), range.start.getShiftedBy( mentionText.length ) );
} );
}
}

0 comments on commit ee973bb

Please sign in to comment.