StevenDevooght / tinyMCE-mention

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

Onclick button delimiter not registered #51

Closed Flatlinezor closed 7 years ago

Flatlinezor commented 7 years ago

Hello!

Is there a way to get the delimiter registered via a button click?

@ does not seem to trigger mentions although if I were to manually enter it, it works like charm.

onclick: function () {

                    tinymce.activeEditor.execCommand('mceInsertContent', false, "@");
                                }
                    });
StevenDevooght commented 7 years ago

I don't really understand the question. You want to get the configured delimiter from the mention plugin?

Flatlinezor commented 7 years ago

No :) I have two delimiters # and @ configured properly and they work flawlessly. What I wish to do is having a button on the toolbar for each, which I have done but since i guess editor.insertcontent is not listened to by mentions because it does not have onkeyup or onkeydown? Meaning the delimiters appear in the aditor after pressing the button(s) but they dont start to engage with mentions as ut normally would. What Am I missing?

On 12 Jan 2017 7:26 p.m., "Steven Devooght" notifications@github.com wrote:

I don't really understand the question. You want to get the configured delimiter from the mention plugin?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/StevenDevooght/tinyMCE-mention/issues/51#issuecomment-272241574, or mute the thread https://github.com/notifications/unsubscribe-auth/ABw_F1kCG1biW-PVYRP3BfocbmLxsu1Oks5rRnArgaJpZM4Lhy17 .

StevenDevooght commented 7 years ago

Ah, ok

Indeed that functionality is not build in at the moment. I think it should be possible to trigger a keyup event in the button click handler. This should trigger the plugin. Of course it would be nice if we could put this behavior in the plugin itself.

Flatlinezor commented 7 years ago

Unforrunately I am afraid I am not good enough to commit that in. If you ever get time, please try to look into it , maybe it is not that time consuming

On 13 Jan 2017 8:46 a.m., "Steven Devooght" notifications@github.com wrote:

Ah, ok

Indeed that functionality is not build in at the moment. I think it should be possible to trigger a keyup event in the button click handler. This should trigger the plugin. Of course it would be nice if we could put this behavior in the plugin itself.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/StevenDevooght/tinyMCE-mention/issues/51#issuecomment-272381315, or mute the thread https://github.com/notifications/unsubscribe-auth/ABw_F9zeBvwtDQ5cbAfG1iYVbgIiiJ-tks5rRyvegaJpZM4Lhy17 .

StevenDevooght commented 7 years ago

What you can do in your button callback is fire the keyup events instead of calling the insertContent command.

See example here.

You can find the keycodes for your delimiters here.

Flatlinezor commented 7 years ago

Thanks for the help. Eventually I will need to use something that guarantees me that the delimiters will be placed in the proper editor (since I will have multiple editors on my page because all the text that I am allowing to be edited are presented as section per section.)

Your example lines will be a good addon for the full plugin since the test one you use is considerably smaller than your full fledged plugin.

And I get the editor.fire "fire" event undefined unfortunately :( (Sorry to suck :D )

Flatlinezor commented 7 years ago

Well yes I suck, could not do it after all :) Will wait I guess until it might get implemented ^_^

taskeenhaiderbaloch commented 6 years ago

@StevenDevooght man its not workingin my case in angular4

taskeenhaiderbaloch commented 6 years ago

please help me i have same issue and i m trying it from previous 4 days and i have nothing to write in my jira story for time logging 😢