SimonB
I'm new here

Make Empty Paragraphs in DOM Editor output <p></p>

Jump to solution

Does anyone know how to make empty paragraphs in the DOM editor output "<p></p>"?

I don't actually like the idea of doing this but we need a way of having the empty lines in the DOM be respected.

At the moment, our content entering people have to place lots of line breaks in the middle of content, it gets very confusing.

Alternatively, is there an actual WYSIWYG text editor for FirstSpirit? One that produces the same XML needed for the DOM object, but that displays the text more as it appears on the website.

0 Kudos
1 Solution

Accepted Solutions

Hello,

no it is not identical. Yours is a little bit longer than the Mithras' one.

That is the Mithras-Code (FS5):

<p class="section">$--

    --$$CMS_IF(#content.isEmpty)$$--

        --$&nbsp ;$--    // <-- here the blank character between the "p" and the ";" has to be removed, when you copy the code

    --$$CMS_ELSE$$--

        --$$CMS_VALUE(#content)$</p>$--

    --$$CMS_END_IF$$--

--$</p>

View solution in original post

0 Kudos
8 Replies
Peter_Jodeleit
Crownpeak employee

What does your template for "p" looks like? If you check the demo project "Mithras Energy" you'll see that it does just what you want.

Peter
0 Kudos

Our current "p" format template looks like this:

$CMS_SET(listLayer,0)$
$CMS_SET(startTag,"

")$
$CMS_SET(endTag,"

")$
$CMS_SET(text,#content.toString.trim())$
$CMS_IF(text.length() > 6 && "
".equals(text.substring(0,6)))$
     $CMS_SET(text,text.substring(6).trim())$
$CMS_END_IF$
$CMS_IF(text.length() > 6 && text.endsWith("
"))$
     $CMS_SET(text,text.substring(0,text.length()-6).trim())$
$CMS_END_IF$
$CMS_IF(!text.isEmpty())$
     $CMS_SET(output,startTag + text + endTag)$
     $CMS_VALUE(output.replaceAll(startTag+endTag,""))$
$CMS_END_IF$


I don't have access to the "Mithras Energy" demo project, so can't compare it to the one in there. Is it identical?

0 Kudos

Hello,

no it is not identical. Yours is a little bit longer than the Mithras' one.

That is the Mithras-Code (FS5):

<p class="section">$--

    --$$CMS_IF(#content.isEmpty)$$--

        --$&nbsp ;$--    // <-- here the blank character between the "p" and the ";" has to be removed, when you copy the code

    --$$CMS_ELSE$$--

        --$$CMS_VALUE(#content)$</p>$--

    --$$CMS_END_IF$$--

--$</p>

0 Kudos

Thanks Michaela, that pointed me in the right direction.

Regarding an alternative WYSIWYG text editor for FirstSpirit, do you know if that's a possibility, either in FS4 or 5?

0 Kudos

Hello,

SimonB schrieb:

Regarding an alternative WYSIWYG text editor for FirstSpirit, do you know if that's a possibility, either in FS4 or 5?

The same question was asked here, i guess.

Jörg answered there, that it is possible to create an "individual" input element with the help of SwingGadgets. This "individual" input element could reference an editor, if the editor offers an interface.

(The manual for developers (components) might help, but it is just available in german.)

Interesting, do you know of anyone who uses an external editor? Or of any such editors that offer an interface?

0 Kudos

I'm sorry, but both questions i can just answer with "No"...

Maybe the author of the linked thread implemented such an input element with an external editor after Jörgs answer... ? But that is just a guess. I don't have futher information if Jörgs answer helped him or not.

0 Kudos
vijay1v
I'm new here

I changed Standard format template and has successfully removed <p></p> where ever empty content found.

$CMS_SET(text,#content.toString.trim())$

$CMS_IF(!text.isEmpty)$
     $CMS_IF(text.startsWith("<ul>"))$
          $CMS_VALUE(text)$
     $CMS_ELSE$
          <p>$CMS_VALUE(text)$</p>
     $CMS_END_IF$
$CMS_END_IF$

0 Kudos