2012-11-15 66 views
1

我正在使用Tridion 2011 SP1和Firefox 16.0.2,Internet Explorer 8,Internet Explorer 9和Chrome 23.0.1271.95。删除文本框中的所有文本会留下<br>标记

当我在任何浏览器中打开组件并删除富文本字段(按多次删除和退格键)的Design视图中的所有文本时,我在Source视图中留下了各种标记。这些因浏览器而异。

  • 火狐:<br />
  • 铬:<p><br /></p>
  • IE8:<p></p>
  • IE9:<p></p>

我已经检查的hot fixes名单并没有什么意义。

任何想法?

+2

您可以使用自定义XSLT过滤器或事件系统删除'
'。 –

+0

@FrankvanPuffelen为什么'
'标签首先留在那里是有原因的吗?这看起来像一个错误。 –

+2

您确定没有自定义XSLT吗?当然,也可以在XSLT中添加br标签。你可以尝试一个全新的富文本字段吗? – Quirijn

回答

4

这听起来像是一个应该提交给SDL客户支持的错误。行为与IE,Chrome和FF有什么不同?

除非支持可以提供热修复,否则我认为您唯一的选择是使用过滤XSLT过滤出唯一的BR(如Frank所示)。创建新的富文本字段时使用的默认XSLT过滤器包含此过滤,如下所示(最后一个<template>节点)。

<stylesheet version="1.0" xmlns="http://www.w3.org/1999/XSL/Transform"> 
    <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(., &apos; &apos;, &apos;&apos;)) = &apos;&apos;  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(., &apos; &apos;, &apos;&apos;)) = &apos;&apos;  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> 
+0

对不起,延迟回复。这种行为在浏览器中确实是不同的。 IE8/9留下了'

'标签。镀铬叶'


'。当我正确地修复它时,我会进行更新。 –

+0

花了一段时间回到这个问题。事实证明,Tridion 2011的默认XSLT过滤器默认删除错误的
标签。我使用的XSLT来自R5.3迁移。 –