JQuery-textcomplete not working with contenteditable div from Chrome extension

I am working on a simple chrome extension with automatic installation using jQuery-textcomplete script.

It works well on most traditional sites because they use textarea. He does not work on Google+ comment, Facebook comment block, or even gmail.

Because they only use the div tag with HTML5 'contenteditable' to get the text of the user, and also use the reaction in facebook.

So the jquery selector is not working. How can I solve this problem? Here is my selector.

$("textarea, .editable, textbox, text").textcomplete([{
    match: /(^|\S*)([^\u0000-\u007f]{2,}|\w{2,})$/,
    search: function (term, callback) {
    callback($.map(EnDict, function (word) {
        return word.indexOf(uni_word) === 0 ? word : null;
    }));
    },
    replace: function (word) {
     return word + ' ';
   }
}]);

There is a Github repository

enter image description here

+2
source share

Source: https://habr.com/ru/post/1691581/


All Articles