0

I've been using trix editor as my WYSIWYG in my application so far. Now that I've added best_in_place gem for inline editing i would like to know if there is a way to implement trix editor or any other WYSIWYG editor, or if I have to change the best in place gem for some alternative since i need the WYSIWYG.

Integration of WYSIWYG editor to best-in-place textarea

This should be something similar, but I can't really figure it out.

$(document).on('best_in_place:activate', function(el) { 
     $(element).trix-editor(); 
});

doesn't seem to work.

Thank you!

flenning12
  • 41
  • 8

1 Answers1

0

You should be able to do something like

$(document).on('best_in_place:activate', function(el) { 
    // code to initialize the editor on
    // $(element).editor(); ? 
});
Josh Brody
  • 5,153
  • 1
  • 14
  • 25
  • what would the initialization look like for trix editor? can't seem to find anything about it – flenning12 Jul 30 '18 at 22:50
  • See this answer to an unrelated question for a basic example of how to implement Trix editor (you may need to create some of this with jquery or js based on your use case, but this should give you the framework you need): https://stackoverflow.com/a/51572517/9958942 – benvc Jul 31 '18 at 21:05
  • im not that familiar with jquery, may u help me with this? – flenning12 Jul 31 '18 at 23:12
  • I looked into it briefly and it is not trivial so you may want to rethink using `best_in_place` if wyswig is a requirement. See this [related SO question](https://stackoverflow.com/questions/20300098/integration-of-wysiwyg-editor-to-best-in-place-textarea) for some approaches if you want to give it a go. – benvc Aug 01 '18 at 15:54