在SDL 2011内容管理系统中,当编辑富文本字段(RTF)中的组件时,我注意到按enter键会导致源中不同的HTML标记。
我认为这是基于浏览器的,因为我有Chrome的<div>。如何确保在所有浏览器中获得<p>标记?
更新:SDLTridion2011 SP1在默认的XSLT富文本过滤器中有以下内容,它似乎修复了编辑常规正文文本或段落时按enter的场景。当按下标题后的enter键时,我仍然有问题,标题在Chrome中是作为div出现的。
<stylesheet xmlns="http://www.w3.org/1999/XSL/Transform" version="1.0">
<output omit-xml-declaration="yes" method="xml" cdata-section-elements="script"></output>
<template match="/ | node() | @*">
<copy>
<apply-templates select="node() | @*"></apply-templates>
</copy>
</template>
<template match="*[ (self::br or self::p or self::div) and normalize-space(translate(., ' ', '')) = '' and not(@*) and not(processing-instruction()) and not(comment()) and not(*[not(self::br) or @* or * or node()]) and not(following::node()[not( (self::text() or self::br or self::p or self::div) and normalize-space(translate(., ' ', '')) = '' and not(@*) and not(processing-instruction()) and not(comment()) and not(*[not(self::br) or @* or * or node()]) )]) ]">
<!-- ignore all paragraphs and line-breaks at the end that have nothing but (non-breaking) spaces and line breaks -->
</template>
<template match="br[parent::div and not(preceding-sibling::node()) and not(following-sibling::node())]">
<!-- Chrome generates <div><br/></div>. Renders differently in different browsers. Replace it with a non-breaking space -->
<text> </text>
</template>
</stylesheet>更新后的问题如下:
<p>标记,即使在标题后按enter?发布于 2012-05-05 18:28:56
这个问题不是新问题,是使用内容可编辑的一个普遍问题。
Telerik提出了一个解决方案,您可以指定您想要的行为,我建议SDL也这样做。http://www.telerik.com/help/aspnet-ajax/editor-using-newlinebr-property.html
但它似乎还没有引起注意。更大的问题是,SDL什么时候开始使用HTML 5.
发布于 2012-04-25 18:11:15
我们有完全相同的问题-这是基于特定的浏览器行为。我发现Fire,IE和Chrome都给出了不同的结果。如果记忆正常的话:
<p>标签<br/><div/>标签我有一张向客户支持提交的罚单,但到目前为止,我还没有一个解决方案。因此,我们现在将内容粘贴到字段中,而不是实际在其中进行编辑,否则会破坏我们的XHTML标准,并且我们的CSS无法正常工作。
https://webmasters.stackexchange.com/questions/29505
复制相似问题