StevenDevooght / tinyMCE-mention

Mention/Autocomplete plugin for tinyMCE WYSIWYG editor.
http://stevendevooght.github.io/tinyMCE-mention/
220 stars 95 forks source link

Not working on Android Chrome #50

Open jhuet opened 7 years ago

jhuet commented 7 years ago

Hello,

The plugin doesn't seem to work on Chrome browser under Android OS. It does work on Chrome under iOS though.

Any thoughts ?

StevenDevooght commented 7 years ago

Hi,

Don't know what the issue might be. A remote debugging session will tell us more...(https://developers.google.com/web/tools/chrome-devtools/remote-debugging/)

jhuet commented 7 years ago

Hello @StevenDevooght,

We finally had a bit of time to dig into this problem. It appears that keypress event is now deprecated and not used by Chrome on Android anymore. More explanations can be found here.

As there is no real bug to fix, i guess the only way to make this work would be to code some kind of workaround such as this one ?

StevenDevooght commented 7 years ago

According to this post the beforeinput event can be used.

YCMitch commented 5 years ago

Hey @StevenDevooght

Just checking this still hasn't been fixed, has it? Certainly not complaining, just curious.

brunoniconeves commented 5 years ago

I solved the problem changing the keypress event by on('input'). This change was not simple, because the preventEventDefault stop to work with input event.

So i have to deal with double delimiter input problem...the code can be improved, but it do the job now. The code of the mention.js that i'm using rigth now is that (i also change some event like dismiss dropdown list on scroll event, not a good UX choice in my opinion):

`/global tinymce, module, require, define, global, self / var _to_ascii = { '188': '44', '109': '45', '190': '46', '191': '47', '192': '96', '220': '92', '222': '39', '221': '93', '219': '91', '173': '45', '187': '61', //IE Key codes '186': '59', //IE Key codes '189': '45' //IE Key codes }

var shiftUps = { "96": "~", "49": "!", "50": "@", "51": "#", "52": "$", "53": "%", "54": "^", "55": "&", "56": "*", "57": "(", "48": ")", "45": "_", "61": "+", "91": "{", "93": "}", "92": "|", "59": ":", "39": "\"", "44": "<", "46": ">", "47": "?" };

function getDelimiter(e) { var c = e.which;

if (_to_ascii.hasOwnProperty(c)) {
    c = _to_ascii[c];
}

if (!e.shiftKey && (c >= 65 && c <= 90)) {
    c = String.fromCharCode(c + 32);
} else if (e.shiftKey && shiftUps.hasOwnProperty(c)) {
    c = shiftUps[c];
} else {
    c = String.fromCharCode(c);
}

return c;

}

;(function (f) { 'use strict';

// CommonJS if (typeof exports === 'object' && typeof module !== 'undefined') { module.exports = f(require('jquery'));

// RequireJS } else if (typeof define === 'function' && define.amd) { define(['jquery'], f);

// Githubissues.

  • Githubissues is a development platform for aggregating issues.