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
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.
-
If you found this answer acceptable, please consider approving it ;D May 5, 2016 at 13:17
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.