Open falcon1kr opened 9 years ago
you mean in the content editable? or textarea. In the demo, for practical purposes, there is only one space. which browser are you seeing this behavior on?
I don't see an extra space, but I would like to be able to control what is being appended in replaceTriggerText
, if anything.
Specifically, I have usage scenario where, depending on the selection, I would like to append a period rather than a space. My usage scenario is for an Intellisense-like input where my user can enter a dotted item (e.g. $Sender.FirstName
) and I want to provide typeahead for the components of the item ("$" -> ['Sender', 'Recipient', ...]
, and "$Sender." -> ["FirstName", "LastName", ...]
).
Maybe the mention-select
callback could return an object with a flag indicating not to append the space. My callback would then look something like this:
function select(item) {
if(item.needsDot) {
return {
text: item.label + ".",
appendSpace: false
};
} else {
// default behavior
return item.label;
}
}
I would appreciate an option to skip adding space after selection. My use case is quite similar to the one provided by @nonplus
Is there a reason why a space is force-appended when the trigger text is replaced? Seems like, even in the demo, force-append ends up leaving 2 consecutive spaces after the replaced text