From 2b0478de8e4386205275031dbe3f63161024dba9 Mon Sep 17 00:00:00 2001 From: Hamza Mahjoubi Date: Thu, 19 Sep 2024 15:21:13 +0200 Subject: [PATCH] fixup! feat: add mention to mail Signed-off-by: Hamza Mahjoubi --- src/ckeditor/smartpicker/InsertItemCommand.js | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/ckeditor/smartpicker/InsertItemCommand.js b/src/ckeditor/smartpicker/InsertItemCommand.js index 5ee1862dc3..4ebb0534e3 100644 --- a/src/ckeditor/smartpicker/InsertItemCommand.js +++ b/src/ckeditor/smartpicker/InsertItemCommand.js @@ -38,17 +38,8 @@ export default class InsertItemCommand extends Command { if (trigger === '@') { const mailtoHref = `mailto:${item.email}` const anchorText = `@${item.label}` - - const anchorTextElement = writer.createText(anchorText) - writer.insert(anchorTextElement, currentPosition) - - // Now select the newly inserted anchorText - const anchorRange = editor.model.createRangeOn(anchorTextElement) - editor.model.change(writer => { - editor.model.setSelection(anchorRange) - }) - - editor.execute('link', mailtoHref ) + const textElement = writer.createText(anchorText, { linkHref: mailtoHref }) + editor.model.insertContent(textElement) } else { const itemElement = writer.createElement('paragraph') writer.insertText(item, itemElement)