Rich Text / Redactor Editor API access

With a large project that revolves around extensive Rich Text, we needed Javascript access to the Redactor control that Knack uses for rich text fields.  After lots of research and hacking attempts this might be a starting point for others.

To gain access to the core redactor object

var redactor = $('field_XX').redactor('core.getObject')

In testing using any other selector than the field resulted in the control being duplicated.


redactor.insert.html(htmlstring)    //Inserts html at the selection
redactor.selection.restore()  //handy if a modal form causes the control to lose focus and default to the start.

More documentation



Hey Taylor,

I can outline our use case briefly - built a helpdesk with major reliance on Rich Text fields and needed a way to insert images and files stored in Knack, therefore needing access to the redactor control for direct control of html inserts.

Hey Brad, 

Could you provide some example use cases of where and how you used applied this?