[RICHTEXT] How to process richtext value before it is submitted, richtext adds spacing on a empty tag automatically
The richtext will automatic add a spacing in a empty tag.
Given that, if we input:
<div class="content border-b"><div class="thumbnail"><span class="icon-phone"></span></div></div>
|
richtext will chage it to:
<div class="content border-b"><div class="thumbnail"><span class="icon-phone"> </span></div></div>
|
In some case, we don’t want that.
The solution:
We will add a listener for richtext field to process the value before submit to CRX.
Config:
<teasertext
jcr:primaryType="cq:Widget"
fieldLabel="Teaser Text"
name="./teasertext"
removeSingleParagraphContainer="{Boolean}true"
xtype="richtext">
<rtePlugins jcr:primaryType="nt:unstructured">
<misctools
jcr:primaryType="nt:unstructured"
features="*"/>
</rtePlugins>
<listeners
jcr:primaryType="nt:unstructured"
sync="function(rt, value){ this.el.dom.value = value.replace(' ', ''); return true;
}"/>
</teasertext>
|
Nhận xét
Đăng nhận xét