Bladeren bron

Other: Use `model.insertContent` instead of `model.Writer.insertText`.

Szymon Cofalik 6 jaren geleden
bovenliggende
commit
dc5695bb51
1 gewijzigde bestanden met toevoegingen van 2 en 5 verwijderingen
  1. 2 5
      packages/ckeditor5-mention/src/mentioncommand.js

+ 2 - 5
packages/ckeditor5-mention/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 ) );
 		} );
 	}
 }