Forum

Thread tagged as: Question, Problem

Can only get line break by using CKEditor

I've a content textarea with html set to true:

<perch:content id="construction" label="Construction" type="textarea" html="true" editor="ckeditor" suppress="true" />

This is displayed in a 'table' later:

<div class="value"><perch:content id="construction" suppress="false" html="true"/></div>

Problem I am having is the only way to get a line break is to set the editor to CKEditor, leaving no editor or specifying markitup simply ignores any line breaks or paragraph the user inputs.

I don't want to use CKEditor as it's hogs so much space ( I understand I can control the buttons shown, but ending up with multiple CKEditors isn't something I want to do).

Any alternative methods?

Tony Astley

Tony Astley 0 points

  • 1 year ago

Maybe because you aren't specifying a type? If you want to be able to type HTML directly into a textarea, this should work:

<div class="value"><perch:content id="construction" type="textarea" html="true" label="Construction" /></div>

type="textarea" is in the first instance. I don't believe I require it in the second instance as I'm simply returning the value.

Am I wrong?

Oh sorry, I misunderstood. If you’re just reusing content within the template, then you can use the same <perch:content /> attributes that you use in the first instance of the ID in the template, minus the suppress=“true”. Perch will only display the editor in the CMS for the first instance of the ID.

Yeah, it works if the editor is set to CKEditor, however the just a standard textarea with html set to true doesn't seem to save line breaks.

Never mind... the user will have to live with multiple CKEditors for now.

Do you mean multiple CKEditors on one edit page for two perch:content with the same id? You shouldn’t end up with two CKEditors at the same time.

No, sorry what I have are a few different content areas within the region that all require simple text but with support for line breaks. e.g.:

<perch:content id="construction" label="Construction" type="textarea" html="true" editor="ckeditor" suppress="true" />
<perch:content id="materials" label="Materials" type="textarea" html="true" editor="ckeditor" suppress="true" />
<perch:content id="guarantee" label="Guarantee" type="textarea" html="true" editor="ckeditor" suppress="true" />

Ideally I didn't want the user to see a page full of CKEditors, but they'll have to live with it for now.

Hussein Al Hammad

Hussein Al Hammad 103 points
Registered Developer

What if you use markdown with no editor?

<perch:content id="construction" label="Construction" type="textarea" html="true" markdown="true" suppress="true" />