Forum

Thread tagged as: Question, Problem, CKEditor

Adding specific html tags in a text area

In my HTML code I've got:

<p class="peoplepgp" data-ix="display-none-on-load">

This enables me to show/hide a paragraph of text.

But when I set up a text editor bit (CKeditor) for this text it obviously just adds in standard <p></p> tags around the text thus removing the class and data-ix code.

Any idea how to set this up so it works?

I've set up my content block like this:

      <p class="peoplepgp" data-ix="display-none-on-load"><perch:content id="profile" type="textarea" label="Profile" editor="ckeditor" html="true" size="s autowidth" required="false" order="7"  /></p>

But obviously the CKeditor is putting it's own <p> tags in.

Andrew Areoff

Andrew Areoff 0 points

  • 6 years ago

I've got it to work by using a repeater on a text block rather than text area. Might be a bit cumbersome for the client if it's a long chunk of text and they need to "add another" each time the want another paragraph of text but it seems to work.

Unless there's a better way of handling this?

I think striptags="true" might work here, if you add it like this:

<p class="peoplepgp" data-ix="display-none-on-load"><perch:content id="profile" type="textarea" label="Profile" editor="ckeditor" html="true" striptags="true" size="s autowidth" required="false" order="7"  /></p>

This should remove html tags from the output

Michael Harrison said:

I think striptags="true" might work here, if you add it like this:

<p class="peoplepgp" data-ix="display-none-on-load"><perch:content id="profile" type="textarea" label="Profile" editor="ckeditor" html="true" striptags="true" size="s autowidth" required="false" order="7"  /></p>

This should remove html tags from the output

Thanks Michael, I'll give this a try.