Hi,
I need to remove all the tags that are automatically inserted inside a richtext.
The default use case converts a string X to <p>X</p> and sometimes to <p>X</p><p></p>
First of all anyone can explain me in which case the X is converted to <p>X</p><p></p> ? I have only one row, not two rows...
removeSingleParagraphContainer
True if the paragraph element of texts that consist only of a single paragraph should be removed on getValue/syncValue (defaults to false). For example, if a text is <p>Single paragraph text</p>, the surrounding "p" tag would get removed if this option was set to true. This option is mainly for backward compatibility with CQ 5.1, where container tags had not yet been available. Hence texts that were created by a CQ 5.1 instance will be surrounded by a single "p" element before they are edited in a CQ 5.2 instance. By setting this option to true, this automatically added "p" tag will get removed before the text is saved, at least if no other paragraphs or containers were added.
With this variable set to true the result becomes X<br> and if i write 2 rows (enter command) the result becomes <p>firstrow</p><p>secondrow</p>
singleParagraphContainerReplacement
Specifies the name of the tag that has to be used if a paragraph container cannot be simply removed because it carries additional info (for example, alignment and/or CSS classes; defaults to "div"). Note that this setting only takes effect if removeSingleParagraphContainer is set to true.
This parameter is completely useless...
I'm not able to find anything else to remove the unwanted tags, the only way is to delete the occurrencies when the variable is read.
The problem of this approach is how to differentiate the default tags to the tags inserted by the user.
How this issue is managed inside the other projects?