mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
Merge pull request #4028 from dtchau/fix/more_emoji_autocomplete_issue
FIX: Remove existing characters when a new emoji is selected.
This commit is contained in:
commit
1f688e966d
1 changed files with 10 additions and 1 deletions
|
@ -309,7 +309,16 @@ export default Ember.Component.extend({
|
|||
showSelector({
|
||||
appendTo: self.$(),
|
||||
container,
|
||||
onSelect: title => self._addText(self._getSelected(), `${title}:`)
|
||||
onSelect: title => {
|
||||
// Remove the previously type characters when a new emoji is selected from the selector.
|
||||
let selected = self._getSelected();
|
||||
let newPre = selected.pre.replace(/:[^:]+$/, ":");
|
||||
let numOfRemovedChars = selected.pre.length - newPre.length;
|
||||
selected.pre = newPre;
|
||||
selected.start -= numOfRemovedChars;
|
||||
selected.end -= numOfRemovedChars;
|
||||
self._addText(selected, `${title}:`);
|
||||
}
|
||||
});
|
||||
return "";
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue