0

I came across Onebox https://github.com/discourse/onebox - A gem for turning URLs into website previews. How can I use/build similar functionality for Trix Editor based rich_text_area?

vanquishers
  • 358
  • 1
  • 3
  • 18

1 Answers1

1

I would recommend watching Chris Oliver's RailsConf 2020 advanced ActionText talk. The embed mechanism he uses for YouTube is probably the best place to start. You'll need to develop your own WebsiteEmbed model that is added as a TrixAttachment and has a partial that renders a preview of the website to your liking.

https://www.railsconf.org/2020/2020/video/chris-oliver-advanced-actiontext-attaching-any-model-in-rich-text [I wonder if railsconf.org has a bug, the url now has 2020/2020/ but was formerly just 2020/ -jb]

John Bachir
  • 22,495
  • 29
  • 154
  • 227
Olly
  • 7,732
  • 10
  • 54
  • 63