Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert to mention input if the Text area already has some value #163

Open
igniteajaysuwalka opened this issue Dec 7, 2016 · 2 comments

Comments

@igniteajaysuwalka
Copy link

If I already have the markup in textarea then I would want to be converted to Mention input. or else some sort of reset value or set value I need

@jaspertandy
Copy link

So I figured this out. Change this line:

https://github.com/podio/jquery-mentions-input/blob/master/jquery.mentionsInput.js#L509

to:

newMentionText = newMentionText.replace(match[0], match[2]);

Otherwise your trigger char doubles up. Then use the defaultValue configuration option when instantiating.

Unfortunately this appears to be the only way to set a custom value programmatically. You could duplicate this method and pass an argument to it, though, if you need it.

https://github.com/podio/jquery-mentions-input/blob/master/jquery.mentionsInput.js#L542-L544

@roby65
Copy link

roby65 commented May 24, 2017

You can actually change the val method behaviour:
val : function (callback) { if (!_.isFunction(callback)) { resetInput(callback); return; } callback.call(this, mentionsCollection.length ? elmInputBox.data('messageText') : getInputBoxValue()); },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants