tinyMCE-mention
tinyMCE-mention copied to clipboard
No longer works on tinymce 6.7
I've been using this plugin for several years without any problem (with tinymce 5 and 6), but it recently stopped working. I've noticed it a few days ago; not sure exactly when it stopped working. Anyway, the current tinymce version is 6.7.3.
The problem seems to be located in the call to the source function. The function is called, but its 1st argument, the query, is always an empty string, so there is nothing to search for.
I guess something must have changed in tinymce, and this change has broken the plugin ?
Anyone has a clue on how to fix this ?
I'm getting the same symptom with TinyMCE Version: 5.10.9 (2023-11-15).
In my case too, the query is always an empty string. Haven't yet figured out a hack.
TinyMCE Version: 5.10.8 (2023-10-19) works fine, so defect was injected with TinyMCE v5.10.9.
I have a fix.
CAUSE: TinyMCE v5.10.9 and v6.7.3 explicitly changed how the "zero width no-break space" character(U+FEFF) is handled. Unfortunately, the mention plugin uses U+FEFF as a delimiter for the user-entered search text.
SOLUTION: Change the U+FEFF character to U+200B ("zero width space") in the 2 places it is used. Here's the affected lines.
OLD
# 67: '<span id="autocomplete-searchtext"><span class="dummy">\uFEFF</span></span>' +
#187: this.query = $.trim($(this.editor.getBody()).find('#autocomplete-searchtext').text()).replace('\ufeff', '');
NEW
# 67: '<span id="autocomplete-searchtext"><span class="dummy">\u200b</span></span>' +
#187: this.query = $.trim($(this.editor.getBody()).find('#autocomplete-searchtext').text()).replace('\u200b', '');
The line numbers reference the un-minimized plugin of course, so you'll also need to make equivalent changes in the minimized version. I'll open a pull request, although I'm not sure whether it'll ever be merged as this plugin seems to no longer be actively maintained.
I hope this helps others.
Yes, this easy fix has brought back the functionality. Thank you!
I hope this helps others.
It does, thank you @mellevsen !
Fixed the project to work with tinymce 6.x Checkout my PR #96