How to Enable Rich Text for Articles in RT 5

I have not had any luck searching the documentation for how to enable rich text editing for articles. We rely on images and formatting in all our documentation.

Any help on how to do this would be much appreciated. Thanks!

Hi Wyatt.
Perhaps you already know of the Wiki article here: Rich Text Custom Fields - Request Tracker Wiki
I use(d) that as my base, here are the specific instructions that worked for me on RT 5 (fresh install).

Copy the EditCustomFieldText file into the override area, and make a backup of it there too (so that post-upgrades you can run a diff against the original to merge changes) –

# mkdir -p local/html/Elements
# cp share/html/Elements/EditCustomFieldText local/html/Elements/
# cd local/html/Elements
# cp EditCustomFieldText EditCustomFieldText.orig

It’s the same block of code seen twice - adding the CKEDITOR (Built-in Javascript rich text editor) if the field in question is the “Content” field for Articles. It’s there twice because the field is displayed differently if there are values already present.

The CKEDITOR.replace function is called only for the Content field, based on the field ID. You can find the ID of the “Content” field for Articles in the RT MySQL database:
mysql> select * from CustomFields where Name='Content' and LookupType='RT::Class-RT::Article';

diff -wu EditCustomFieldText.orig EditCustomFieldText

--- EditCustomFieldText.orig    2020-10-13 17:41:55.671988015 -0400
+++ EditCustomFieldText 2020-10-14 06:56:51.835967212 -0400
@@ -54,6 +54,12 @@
 rows="<% $Rows %>" \
 % }
 name="<%$name%>" class="CF-<%$CustomField->id%>-Edit form-control"><% $value->Content %></textarea><br />
+%#   FOR A CustomField WITH ID OF "1" (THE CONTENT FIELD FOR ARTICLES):
+% if($CustomField->Id == 1) {
+     <script>
+      CKEDITOR.replace( '<%$name%>' );
+     </script>
+% }
 % }
 % if (!$MaxValues or !$Values or $Values->Count < $MaxValues) {
 <textarea \
@@ -64,6 +70,12 @@
 rows="<% $Rows %>" \
 % }
 name="<%$name%>" class="CF-<%$CustomField->id%>-Edit form-control"><% defined($Default) ? $Default : '' %></textarea>
+%#   FOR A CustomField WITH ID OF "1" (THE CONTENT FIELD FOR ARTICLES):
+% if($CustomField->Id == 1) {
+     <script>
+      CKEDITOR.replace( '<%$name%>' );
+     </script>
+% }
 % }
 <%INIT>
 # XXX - MultiValue textarea is for now outlawed.
1 Like

Hi Brent:

I think I must have skipped over this one because I was focused on finding the extension and that doesn’t seem to have been updated after RT4. We’ll give this a try. Thanks!

Update

After some discussion with BP, we determined that the full functionality of CKEdit 5 is not available by default. We are looking into some consulting time with BP to get that working along with some other needs. Maybe it will become a standard feature in a future release.

2 Likes