From 8a430350f89ff1f7068d6d631f43066bc273180d Mon Sep 17 00:00:00 2001 From: Szymon Cofalik Date: Mon, 20 May 2019 11:31:44 +0200 Subject: [PATCH] Other: Use `model.insertContent` instead of `model.Writer.insertText`. --- src/mentioncommand.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/mentioncommand.js b/src/mentioncommand.js index 79305d5..f15546a 100644 --- a/src/mentioncommand.js +++ b/src/mentioncommand.js @@ -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 ) ); } ); } }