HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Custom Parser for Rich Text?

I am trying to figure out how to implement my own custom parser for the Richtext editor in 3.3, basically, I would like some old BBCode emojis to parse and display as their gifs. I would also like to implement some sort of short code for James Bond film titles, i.e. [GE] would change to Goldeneye, [NTTD] would become No Time To Die.

I don't mind if this happens before being saved (maybe better for search having the full film name anyway) or at render time but I am struggling to see how I can achieve it.

The nearest event seems to be "BeforeCommentBody" however this is deprecated.

If I upgrade to the latest release does this make the job any easier?

Thanks

Simon

Tagged:

Comments

  • KasparKaspar Moderator

    You might get an idea of how to from the link in this post

    https://open.vanillaforums.com/discussion/comment/259466/#Comment_259466

  • R_JR_J Ex-Fanboy Munich Admin

    The main decision would be if you would like to do it in the frontend or in the backend: JavaScript or PHP.

    The way you describe it, the JavaScript approach would be more intuitive for the users. You should search for ways to extend the Quill editor, which is the script the Rich Editor is based upon.

    If you take the php approach, you need to handle BeforeSaveDiscussion, BeforeSaveComment and BeforeSave of the ConversationMessageModel.

    Linc
Sign In or Register to comment.