Insert HTML Snippet?

I have some snippets of HTML code that users can search for and insert into the editor. Is there a way of inserting HTML at the caret position and converting to nodes automatically?

If not, I’m assuming I’d need to pull out the HTML from the editor, find the insertion point (maybe a temporary element to mark the position?), update the HTML and reload the editor?

You could parse your HTML snippets with a DOMParser and then insert them as a regular fragment using Transaction.replace.

1 Like

Works like an absolute dream! Thank you so much.