禁用< p>的自动添加标签 [英] Disable auto-adding of <p> tag
问题描述
我正在尝试删除CQ5(版本5.6.0.20130125)中< p>
标签的自动添加。我试图将这些属性添加到
您可以使用< p>
标记,只要您将 removeSingleParagraphContainer
属性设置为 true
只能创建一个段落。
在Mac OS X上的Chrome(至少)上,按住 shift 的同时按下 enter 插入换行符而不是段落换行符,因此您仍然可以创建多行文本。由于您在最后一个问题中说过,重新使用 misctools
插件,您可以使用源代码编辑视图来查看标记。
最后,要设置 removeSingleParagraphContainer
属性,您需要在<$ c $下创建另一个名为 blockHandling
的子级。对话框中的c> htmlRules 节点。您无需弄乱 singeParagraphContainerReplacement
属性,但是如果这样做,则可以将其设置在同一节点上:
< rtePlugins jcr:primaryType = nt:unstructured>
...
< / rtePlugins>
< html规则jcr:primaryType = nt:unstructured>
< docType jcr:primaryType = nt:unstructured>
...
< / docType>
< blockHandling
jcr:primaryType = nt:unstructured
removeSingleParagraphContainer = {Boolean} true />
< / htmlRules>
根据您的编辑进行编辑:使用<$的源编辑功能c $ c> misctools 插件并粘贴此确切文本,在Mac OS X上的Chrome浏览器中为我保存和加载的 p
标签没有>
< strong>总部:< / strong>< br>
MY-COMPANY a.s.br。
Random Street 77< b>
随机城市
您确定您的dialog.xml正确部署了吗?也许再次检查组件的对话框层次结构是否符合CRXDE Lite中的期望:
I'm trying to remove auto-adding of <p>
tag in CQ5(Version 5.6.0.20130125). I've tried to add these properties to the text component I'm using but with no effect.(source)
removeSingleParagraphContainer true
singeParagraphContainerReplacement (empty string)
I've also tried this solution. Again, no effect.
Is it possible to disable auto-adding of <p>
tag?
Thanks for any ideas
EDIT I've tried this answer but CQ still adds <p>
tags to my code. For example, I have this HTML code
<strong>Headquarters:</strong>
<p>MY - COMPANY a.s.<br>
Random Street 77<br>
Random City</p>
and after I submit it, the code changes to
<p><strong>Headquarters:</strong></p>
<p>MY - COMPANY a.s.<br>
Random Street 77<br>
Random City</p>
my RTE looks like this
<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>
EDIT2 this is what my hierarchy looks like
You can keep the RTE from surrounding your text with <p>
tags by setting the removeSingleParagraphContainer
property to true
as long as you only create one paragraph.
With Chrome on Mac OS X (at least), holding shift while pressing enter inserts line breaks instead of paragraph breaks so you can still create text with multiple lines. Since you said in your last question that you're using the misctools
plugin, you can use the source edit view to peek at the markup as you go.
Finally, to set the removeSingleParagraphContainer
property, you'll need to create another child called blockHandling
under your htmlRules
node in your dialog. You don't need to mess with singeParagraphContainerReplacement
property, but if you did, you would set it on the same node:
<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>
Edit regarding your edit: using the source edit feature of the misctools
plugin and pasting this exact text saves and loads without p
tags for me in Chrome on Mac OS X:
<strong>Headquarters:</strong><br>
MY - COMPANY a.s.<br>
Random Street 77<br>
Random City
Are you sure your dialog.xml deployed properly? Maybe double-check that your component's dialog hierarchy looks how you'd expect it to in CRXDE Lite:
这篇关于禁用< p>的自动添加标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!