Skip to content

Commit

Permalink
Remove unused atWho from Mentions component
Browse files Browse the repository at this point in the history
  • Loading branch information
rafalp committed Mar 16, 2023
1 parent 7212851 commit 4907f2c
Showing 1 changed file with 0 additions and 28 deletions.
28 changes: 0 additions & 28 deletions frontend/src/components/MarkupEditor/MarkupEditorMentions.jsx
Expand Up @@ -303,31 +303,3 @@ function getMentionPosition(textarea, phantom, value, mention) {
phantom.innerText = ""
return { top, left }
}

function setMentions(props, element) {
$(element).atwho({
at: "@",
displayTpl: '<li><img src="${avatar}" alt="">${username}</li>',
insertTpl: "@${username}",
searchKey: "username",
callbacks: {
remoteFilter: function (query, callback) {
$.getJSON(misago.get("MENTION_API"), { q: query }, callback)
},
},
})

$(element).on("inserted.atwho", (event, _storage, source, controller) => {
const { query } = controller
const username = source.target.innerText.trim()
const prefix = event.target.value.substr(0, query.headPos)
const suffix = event.target.value.substr(query.endPos)

event.target.value = prefix + username + suffix
props.onChange(event)

const caret = query.headPos + username.length
event.target.setSelectionRange(caret, caret)
event.target.focus()
})
}

0 comments on commit 4907f2c

Please sign in to comment.