jodit / jodit-react

React wrapper for Jodit
MIT License
358 stars 120 forks source link

Inserting text snippets via a plugin #45

Open gplatt opened 4 years ago

gplatt commented 4 years ago

I'd like to have a list of words which a user can select from, then have that word inserted at the cursor. I see there is a insertHTMl() which can be used in a Jodit plugin, but how do I define a plugin when using jodin-react?

gplatt commented 4 years ago

I have made some progress with inserting the text, now to work out how to do a drop down list of text options: (I've got no icon in the toolbar but the tooltip and insert work)

buttons:[ 'source', 'fullsize', '|','bold','strikethrough',
{ iconURL: '', tooltip: 'Insert My Name', exec: function (editor) { editor.selection.insertHTML("Hi this is Guy"); } }]