Reputation: 21
When I press the button do execCommand('mceInsertContent', '#') and insert # to the tinymce editor, but the autocompleter doesnt display.
Upvotes: 2
Views: 315
Reputation: 1104
Ok Since Tinymce 7 you can do that
editor.ui.registry.addButton("addMentionUser", {
text: "User",
onAction: () => {
editor.insertContent("$");
editor.execCommand("mceAutocompleterReload");
},
});
Upvotes: 0
Reputation: 1104
Hey I managed to do it this way (tested with TinyMCE 6.7)
editor.ui.registry.addButton("addMentionUser", {
text: "User",
onAction: () => {
editor.insertContent("$");
editor.fire("keypress");
},
});
Upvotes: 0