Closed fneves closed 9 years ago
Thanks
@djhvscf can you tag / release this, I want to install via bower
Great patch! However, I'm having issues when trying to pre-populate mentions and single quotes, ex:
$('#task-comment').mentionsInput({
defaultValue: "this is the default value @[Firstname Lastname](user:USR-340001431403696) what's going on?",
minChars: 1,
onDataRequest:function (mode, query, callback) {
var data = window.usersToTag;
data = _.filter(data, function(item) { return item.name.toLowerCase().indexOf(query.toLowerCase()) > -1 });
callback.call(this, data);
}
});
It encodes the single quote again, and a "@" symbol appears before the name. I'm trying to implement edit mode, ex: editing comments with mentions on it.
Thanks
What I did, to temporarily achieve what we want (ex: populate textarea for editing), I edited the code to:
//Resets the text area
function resetInput(currentVal) {
mentionsCollection = [];
- var mentionText = utils.htmlEncode(currentVal);
+ var mentionText = currentVal;
var regex = new RegExp("(" + settings.triggerChar + ")\\[(.*?)\\]\\((.*?):(.*?)\\)", "gi");
var match, newMentionText = mentionText;
while ((match = regex.exec(mentionText)) != null) {
- newMentionText = newMentionText.replace(match[0], match[1] + match[2]);
+ newMentionText = newMentionText.replace(match[0], match[2]);
mentionsCollection.push({ 'id': match[4], 'type': match[3], 'value': match[2], 'trigger': match[1] });
}
elmInputBox.val(newMentionText);
What do you think?
defaultValue
is not working for me :/
possibly because it was never released ... @djhvscf can you tag a new version please ?
This PR adds support for a default value on the textarea.
Usage example: