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

textcomplete js doesn’t work with emojiarea #438

Open
BAALC16 opened this issue Jul 21, 2021 · 0 comments
Open

textcomplete js doesn’t work with emojiarea #438

BAALC16 opened this issue Jul 21, 2021 · 0 comments

Comments

@BAALC16
Copy link

BAALC16 commented Jul 21, 2021

hello @mervick, thanks for your plugin it’s really great. I have to add references to it and in my research I found that it did not work with tribute and atwho. I saw that you suggested jquery.textcomplete the mentions. But when I use your code underneath, we put an error:

Uncaught TypeError: this.editor.textcomplete is not a function

Please help me. thanks.

You can use bundled textcomplete plugin,
add script below in the your header,

<script src="https://cdn.rawgit.com/yuku-t/jquery-textcomplete/v1.3.4/dist/jquery.textcomplete.js"></script>

and after that

$(document).ready(function() {
    $("#emojionearea1").emojioneArea({
        pickerPosition: "right",
        tonesStyle: "bullet",
        autocomplete: true,
        events: {
            ready: function() {
                this.editor.textcomplete([{
                    id: 'emojionearea',
                    match: /\B@([\-\d\w]*)$/,
                    search: function (term, callback) {
                        // this code must be replaced with your
                        // load mentions from ajax
                        var mentions = ['Peter', 'Tom', 'Anne'];
                        callback($.map(mentions, function (mention) {
                        return mention.indexOf(term) === 0 ? mention : null;
                    }));
                    },
                    template: function (value) {
                        return '<b>' + value + '</b>&nbsp;';
                    },
                    replace: function (value) {
                        return '<b>@' + value + '</b>&nbsp;';
                    },
                    cache: true,
                    index: 1
                }]);
            }
        }
    });
});

Example: https://jsfiddle.net/1v03Lqnu/898/
type : for autocomplete emotions
type @ for autocomplete mentions

Originally posted by @mervick in #233 (comment)

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

1 participant