Skip to content

Commit

Permalink
fixup! feat: add mention to mail
Browse files Browse the repository at this point in the history
Signed-off-by: Hamza Mahjoubi <[email protected]>
  • Loading branch information
hamza221 committed Sep 19, 2024
1 parent 9cc9dec commit 2b0478d
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions src/ckeditor/smartpicker/InsertItemCommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 2b0478d

Please sign in to comment.