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
|
@ -309,7 +309,16 @@ export default Ember.Component.extend({
|
||||||
showSelector({
|
showSelector({
|
||||||
appendTo: self.$(),
|
appendTo: self.$(),
|
||||||
container,
|
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 "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue