Skip to content

Conversation

@jmilljr24
Copy link
Collaborator

@jmilljr24 jmilljr24 commented Dec 18, 2025

What is the goal of this PR and why is this important?

We need a new rich text editor as ckeditor v4 was EOL.

How did you approach the change?

Add ActionText to keep aligned with rails. Add Rhino-Editor. This handles attachments etc. with ActionText compatibility based off trix. The editor itself used Tiptap under the hood and is easily expandable with extensions.

Looking at the current ckeditor data being used, the following main features are needed an are included in this PR:

  • Images
  • Tables
  • Tables with images
  • Text alignment
  • Embedded youtube videos

Anything else to add?

Currently added to Resource. This needs to be added to all other rich text fields. Old data can be moved to ActionText via a migrator. RichTextMigrator.new(record, :text).migrate!

View the rendered content /resources/:id/show_test

New has_rich_text associations should following the naming pattern of "rhino_#{old_column}" for example has_rich_text :rhino_text

@jmilljr24 jmilljr24 marked this pull request as ready for review December 18, 2025 17:23
@jmilljr24 jmilljr24 requested a review from maebeale December 18, 2025 17:23
@jmilljr24 jmilljr24 changed the title WIP: Action text rhino Action text rhino Dec 18, 2025
Copy link
Collaborator

@maebeale maebeale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rhino was SUCH a great find, @jmilljr24 !

And this is a critical feature. Well done!!!

class RichTextMigrator
include ActionText::ContentHelper

PLACEHOLDER_TEXT = "image not found"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should add some brackets here so it sticks out more. Maybe [image not found] ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For sure! I should be able to add the file name or some way to identify it with brackets.

@@ -0,0 +1,101 @@
<div class="min-h-screen py-8">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I think this is the best way -- just a full copy of show but calling rhino_text.

@@ -0,0 +1,5 @@
default_allowed_tags = Class.new.include(ActionText::ContentHelper).new.sanitizer_allowed_tags
ActionText::ContentHelper.allowed_tags = default_allowed_tags.merge(%w[iframe table colgroup col tbody tr th td])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should also whitelist thead and tfoot here, if they're not already in default allowed tags

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I don't know the last time I built a table. Good catch

@jmilljr24 jmilljr24 merged commit b64f3ee into main Dec 18, 2025
2 checks passed
@jmilljr24 jmilljr24 deleted the action-text-rhino branch December 18, 2025 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CKEditor 4 is EOL. Need to upgrade to 5 or move to something else

3 participants