Rich text editor inserting text using templates/snippets

1
Hi, We are using the Rich Text Editor to create email body texts. When the user is working on the body text he wants to be able to insert text snippets from a library of snippets. However, the selected snippet needs to be inserted/pasted inside the body text that's already present and preferably at the cursor position. How to handle this requirement? I was thinking about using the Copy Paste functionality available in the Rich Text Editor but this requires 2 actions (Copy and Paste) and seems to cause some security issues in Firefox (the browser used at the project). Using Microflows requires determining the position of the cursor and I do not know how to do that. Note: we already generate an email using a signature selected by the user, my question focuses on inserting text in an already 'in progress' email.
asked
1 answers
5

The Rich Text Editor is build on tiny-mce. You can modify the widget and run a command from javascript. This inserts text on the cursor position.

tinyMCE.execCommand ('mceInsertContent', (see doc)

The most generic way to do this is call a microflow from the widget that returns a string. In that case you are free to open a select form, read a snippet from the database.

answered