Make Empty Paragraphs in DOM Editor output <p></p>
Author: SimonB
Publication Date: 3/1/2013 15:47
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.
-
Author: Peter_Jodeleit - 3/4/2013 10:32
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.
0 -
Author: SimonB - 3/4/2013 11:08
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 -
Author: MichaelaReydt - 3/4/2013 11:35
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)$$--
--$  ;$-- // <-- 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 -
Author: SimonB - 4/2/2013 9:47
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 -
Author: MichaelaReydt - 4/2/2013 10:07
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.)
0 -
Author: SimonB - 4/2/2013 10:35
Interesting, do you know of anyone who uses an external editor? Or of any such editors that offer an interface?
0 -
Author: MichaelaReydt - 4/2/2013 10:56
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 -
Author: vijay1v - 7/21/2014 11:08
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
Vous devez vous connecter pour laisser un commentaire.
Commentaires
8 commentaires