Add RichText to message Create Window

Hi All, I was wondering if there was a way to add richtext support to the message Compose window.

I don’t mind modding the core files, i know migx has richtext support along with the resource content field. I want to stick in the manager interface ideally as i know there are other front end messaging tools available that can do the same thing.

many thanks

If the richtext editor’s JS is loaded, it’s just a matter of adding the class that the RTE is looking for to the input. If you inspect the content field of a page that’s set to use richtext, you should see the class.

Remember that your changes may be overwritten every time you upgrade MODX. You might consider modifying the MessageManager extra. It works in the front end, but it uses the back-end messaging system. It should be easier to modify and it’s seldom upgraded.

I don’t think any of the tinyMCE stuff is being loaded on that page in the manager interface, i could potentially create a plugin that injects it into the header on that page but i think i might need a bit of hand holding on that one

UPDATE :

Think i got it

Created a plugin that injects the following on OnManagerPageInit i was hoping for an event more related to when the messages CMP is loaded but its all i could find.

$modx->regClientStartupHTMLBlock('<script src="/assets/components/tinymcerte/js/vendor/tinymce/tinymce.min.js?v=1.4.0" type="text/javascript"></script>
<script src="/assets/components/tinymcerte/js/vendor/autocomplete.js?v=1.4.0" type="text/javascript"></script>
<script src="/assets/components/tinymcerte/js/mgr/tinymcerte.js?v=1.4.0" type="text/javascript"></script>
<link href="/assets/components/migx/css/mgr.css" rel="stylesheet" type="text/css" />
<link href="/assets/components/tinymcerte/css/mgr/tinymcerte.css?v=1.4.0" rel="stylesheet" type="text/css" />');

Then in the file at location manager/assets/modext/widgets/security/modx.grid.message.js i gave the message textarea field an id (it didn’t have one already)

image

Then on the “show” of the create message window i am adding RTE to the field via its ID

image

Obviously i updated the core file which was not ideal (luckily it was just two lines, one if the id already existed on the field) but if anyone else has any other quick way i could do the same without core modding that would be awesome

End Result

1 Like

Looks great.

Since you’re hacking things, you might consider this in the <head> section, it should take some pressure off your server:

require_once('//cdnjs.cloudflare.com/ajax/libs/tinymce/4.9.11/tinymce.min.js');