How to save changes done through tinyMCE setContent in Gutenberg?

Question

I’m trying to make a custom wrapper for selected content in richtext:

   var selection = tinyMCE.activeEditor.selection.getContent();
   var str = '<'+$(this).attr('data-elem')+' style="font-weight: bold;">' + selection + '</'+$(this).attr('data-elem')+'>';
   tinyMCE.activeEditor.selection.setContent(str);

But Getenberg does not save that new content. How to make it work?

0
, FredMer 8 months 0 Answers 97 views 0

Leave an answer