4

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. – the0ther Oct 26 '15 at 16:38
4

In craft/config/redactor/...json add a line paragraphize: false

4

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.

  • 1
    I 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. – philzelnar Apr 9 '15 at 21:58

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.