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

How to use mentions? #111

Open
denisr-w opened this issue Feb 2, 2021 · 2 comments
Open

How to use mentions? #111

denisr-w opened this issue Feb 2, 2021 · 2 comments

Comments

@denisr-w
Copy link

denisr-w commented Feb 2, 2021

In summernote examples documentation I noticed that the editor also provides mentions functionality which I am not able to use in ngx-summernote. I noticed that the SummernoteOptions does not have a hint property defined. Does anyone know how to use this functionality in this angular library?

@sannanansari
Copy link

While going through official documentation link-mention-summernote
Simple Implementation with search functionality.
config: any = { placeholder: '', toolbar: false, hint: { mentions: ['jayden', 'sam', 'alvin', 'david'], match: /\B@(\w*)$/, search: function (keyword, callback) { let ans = this.mentions.filter((x) => x.toLowerCase().includes(keyword) ); callback(ans, function (item) { let ans = this.mentions.filter((x) => x.toLowerCase().includes(keyword.toLowerCase()) ); return item.indexOf(keyword) == 0; }); }, content: function (item) { console.log('Item ==> ', item); return '@' + item; }, }, };

@maadkiid
Copy link

Hi @sannanansari ,
I tested out your piece of code because i also am working on a feature with summernote hints and i am getting a console error (TypeError: t.match.test is not a function). I assume you use ngx-summernote. Which version are you using? I assume you also declare config as any because in the summernoteoptions there isn't a hint property. Did you encounter this error? Any help would be greatly appreciated.

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