~/talk

Advanced ActionText: Attaching any Model in rich text

Talkat RailsConf 2020 CE · 2020-05-04..05-05· [ruby-on-rails, web-platform]
slides:none on file

Shows how ActionText attaches @mentions and YouTube embeds by having the browser request a Signed Global ID from Rails, then inserting an ActionText attachment that renders differently in the Trix editor and the final view. Uses Trix, Active Storage, server-side controllers that return attachable SGIDs and HTML partials, and client code with Tribute.js and Stimulus for mentions plus a regex-based URL detector for YouTube. Mentions render as single noneditable attachment objects and updating a user’s name updates every mention on refresh, so the demos work end to end.

AI-written summary · about

  1. 0:00Intro
  2. 0:35What is Action Text?
  3. 1:48Why not Markdown?
  4. 5:02How do I use Action Text?
  5. 7:58ActionText:RichText Stores the rich text content
  6. 8:24ActionText:Content
  7. 13:33ActiveStorage::Attachment Stores attachments for Action Text::Rich Texts
  8. 14:04Customizing Trix
  9. 18:24Rendering YouTube embed Server generates the HTML from the YouTube video ID
  10. 20:28Attachable Models YouTube attachable
  11. 23:54Trix Partials Attachables can have separnte templates for Trix
  12. 24:14Rendering Attachables Render with to partial path
  13. 26:07Zurb Tribute
  14. 26:54Adding Tribute Using a Stimulus Controller
  15. 29:57User lookup Search users matching the Tributejs query
  16. 34:02Inserting Tribute selection Trix needs a bit of cleanup before inserting the attachment
  17. 34:15Attachable Model Mentions response
  18. 37:04Inserting Trix Attachment
  19. 37:56User mentions
  20. 39:03Updating records
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.