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

No longer works on tinymce 6.7 #93

Open
ghazpar opened this issue Nov 19, 2023 · 6 comments · May be fixed by #94
Open

No longer works on tinymce 6.7 #93

ghazpar opened this issue Nov 19, 2023 · 6 comments · May be fixed by #94

Comments

@ghazpar
Copy link

ghazpar commented Nov 19, 2023

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 ?

@mellevsen
Copy link

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.

@mellevsen
Copy link

TinyMCE Version: 5.10.8 (2023-10-19) works fine, so defect was injected with TinyMCE v5.10.9.

@mellevsen
Copy link

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.

@mellevsen mellevsen linked a pull request Dec 13, 2023 that will close this issue
@ghazpar
Copy link
Author

ghazpar commented Dec 13, 2023

Yes, this easy fix has brought back the functionality. Thank you!

@NicolasCARPi
Copy link

I hope this helps others.

It does, thank you @mellevsen !

@CollapsedMetal
Copy link

Fixed the project to work with tinymce 6.x
Checkout my PR #96

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

Successfully merging a pull request may close this issue.

4 participants