Jak*_*lcz 3 html rich-text-editor aem
我正在尝试删除<p>CQ5(版本5.6.0.20130125)中的标签自动添加.我试图将这些属性添加到我正在使用的文本组件中,但没有效果.(来源)
removeSingleParagraphContainer true
singeParagraphContainerReplacement (empty string)
Run Code Online (Sandbox Code Playgroud)
我也试过这个解决方案.再一次,没有效果.
是否可以禁用<p>标签的自动添加?
谢谢你的任何想法
编辑我试过这个答案,但CQ仍然<p>在我的代码中添加标签.例如,我有这个HTML代码
<strong>Headquarters:</strong>
<p>MY - COMPANY a.s.<br>
Random Street 77<br>
Random City</p>
Run Code Online (Sandbox Code Playgroud)
在我提交之后,代码变为
<p><strong>Headquarters:</strong></p>
<p>MY - COMPANY a.s.<br>
Random Street 77<br>
Random City</p>
Run Code Online (Sandbox Code Playgroud)
我的RTE看起来像这样
<text jcr:primaryType="cq:widget"
hideLabel="{Boolean}true"
name="./text"
xtype="richtext">
<htmlRules jcr:primaryType="nt:unstructured">
<docType jcr:primaryType="nt:unstructured">
...
</docType>
<blockHandling
jcr:primaryType="nt:unstructured"
removeSingleParagraphContainer="{Boolean}true"/>
</htmlRules>
</text>
Run Code Online (Sandbox Code Playgroud)
小智 10
只要您只创建一个段落,就可以<p>通过设置removeSingleParagraphContainer属性来保持RTE不会使用标记包围文本true.
使用Mac OS X上的Chrome(至少),在按住shift时按住enter换行符而不是段落符号,这样您仍然可以创建多行文本.由于您在上一个问题中说过您正在使用该misctools插件,因此您可以使用源编辑视图随时查看标记.
最后,要设置removeSingleParagraphContainer属性,您需要在对话框中创建blockHandling在htmlRules节点下调用的另一个子节点.您不需要乱用singeParagraphContainerReplacement属性,但如果您这样做,则将其设置在同一节点上:
<rtePlugins jcr:primaryType="nt:unstructured">
...
</rtePlugins>
<htmlRules jcr:primaryType="nt:unstructured">
<docType jcr:primaryType="nt:unstructured">
...
</docType>
<blockHandling
jcr:primaryType="nt:unstructured"
removeSingleParagraphContainer="{Boolean}true"/>
</htmlRules>
Run Code Online (Sandbox Code Playgroud)
关于您的修改的修改:使用misctools插件的源编辑功能并粘贴此精确文本p,在Mac OS X上的Chrome中为我保存并加载没有标签:
<strong>Headquarters:</strong><br>
MY - COMPANY a.s.<br>
Random Street 77<br>
Random City
Run Code Online (Sandbox Code Playgroud)
您确定您的dialog.xml已正确部署吗?也许仔细检查一下你的组件的对话框层次结构在CRXDE Lite中看起来是你期望的:
