[TYPO3-rte] Extra paragraphs and divs being inserted during RTE round tripping
Nicholas W
4407 at log1.net
Wed Jul 1 14:38:16 CEST 2009
My Current configuration for the RTE editor looks like this:
RTE.default.useCSS = 1
RTE.default.proc {
dontConvBRtoParagraph = 1
keepPDIVattribs = class, style, align, id
remapParagraphTag = p
useDIVasParagraphTagForRTE = 1
allowedClasses := addToList(right,dtext,last)
exitHTMLparser_rte = 1
exitHTMLparser_rte.rmTagIfNoAttrib := addToList(div)
exitHTMLparser_rte.allowTags < RTE.default.proc.allowTags
exitHTMLparser_rte.allowTagsOutside < RTE.default.proc.allowTagsOutside
}
RTE.default.classesCharacter:= addToList(right,dtext,last)
RTE.default.contentCSS = fileadmin/templates/css/expats.css
RTE.config.tt_content.bodytext >
RTE.config.tt_content.bodytext < RTE.default
This is largely the result of trial and error and I feel its a bit of
a hack. I would like to know if there is a better way!
I have some CSS formatted text which should look like this. It doesn't
use <p> at all.
<div class="dtext">
<div class="right">113</div>
<span class="dtext"><strong>Police/Fire/Ambulance (Emergency)</strong></span>
</div>
<div class="dtext">
<div class="right">06 5510</div>
<span class="dtext"><strong>Italian Red Cross Ambulance
(Emergency)</strong></span>
</div>
When I was saving it in the database, it was becoming:
<div class="dtext">
<div class="right"><p>113</p></div>
<p> <span class="dtext"><strong>Police/Fire/Ambulance
(Emergency)</strong></span></p>
</div>
<div class="dtext">
<div class="right"><p>117</p></div>
<p> <span class="dtext"><strong>Red Cross Ambulance
(Emergency)</strong></span></p>
</div>
Both in the final outputted page, and when it was loaded into the
editor again. This was messing up the formatting of the page
completely. (In the outputted page, the <p> also had a class of
"bodytext". I was able to solve the output page using
lib.parseFunc.nonTypoTagStdWrap.encapsLines.nonWrappedTag >
lib.parseFunc_RTE >
lib.parseFunc_RTE < lib.parseFunc
in the template. And in the editor using the code quoted at the top of
this message in the page setup.
If I don't put the sections in relating to : exitHTMLparser_rte I was getting:
<div class="dtext">
<div class="right"><div><div><div>113</div></div></div></div></div>
<div><div><div> <span class="dtext"><strong>Police/Fire/Ambulance
(Emergency)</strong></span></div></div></div></div>
</div>
<div class="dtext">
<div class="right"><div><div><div>117</div></div></div></div></div>
<div><div><div><span class="dtext"><strong>Red Cross Ambulance
(Emergency)</strong></span></div></div></div></div>
</div>
After a few round trips in the editor, each round trip was adding more divs.
So in short, do I have the best configuration for the RTE or is there
a neater way? I am worried that my solution may eventually break
something else as I may have a real reason for wanting divs with no
attributes at some time in the future?
Thanks for your suggestions.
More information about the TYPO3-project-rte
mailing list