Is it possible to configure redactor so it will only accept a single line of text and not wrap it's content in a paragraph tag? Essentially, I'm looking to allow an editor to submit some formatted text (bold, italic, links) but place that inside an existing paragraph tag that is coming out of my templates.
-
wish this question were in stackoverflow, but hey! i found what i was looking for anyway.– Randy LOct 26, 2015 at 16:38
2 Answers
In my tests the paragraphize setting did not seem to fully prevent paragraphs from being generated. Instead { linebreaks: true }
seems to reliably convert all would-be paragraphs to <br>
tags.
If you're really serious about sticking to single lines then you can go even further and block all forms of line breaks:
{
deniedTags: ['br'],
enterKey: false,
pastePlainText: true,
linebreaks: true
}
The only flaw with this seems to be that linebreaks still show up in the editor if they're pasted in, but they are stripped when the entry is saved.
-
1I tried removing <p>'s by way of allowedTags, deniedTags, and paragraphize: false. After testing, all seemed to allow p's to get in one way or another. The above settings have worked much better. Apr 9, 2015 at 21:58