2

I have read previous questions and answers about the redactor rich text editor but in this version of Craft i only found simple.json and standard.json under craft/config/redactor. I have tried with both but <div> tags are still replaced by <p>. Is there another way to add <div> into a redactor rich text field?

2 Answers 2

3

You can create a new redactor config under craft/config/redactor named Simple-With-Divs.json with the following code:

{
    buttons: ['bold', 'italic'],
    toolbarFixed: true,
    replaceDivs: false
}

Now you can select Simple With Divs under the Rich Text field type.

1
  • If you found this answer acceptable, please consider approving it ;D May 5, 2016 at 13:17
2

Adding "replaceDivs": false to the config file should prevent this.

When I add a div in code view and save the entry, the div is still there when I open the entry again. Once I remove this setting the div is gone once I re-open the entry.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.