2009-06-08 99 views
0

我一直在使用Telerik RadEditor控件(版本2009.1.402.35)的項目。大多數情況下,一切似乎都可以正常工作(即粗體,斜體,顏色等)。但是,問題是,當用戶編輯內容時,縮進和列表(項目符號和編號)功能無法在屏幕上正確呈現。有趣的是,當單擊縮進或列表按鈕時,它會將正確的標記添加到html中。Telerik RadEditor渲染問題

這個問題體現在MSIE 6,7,8和FireFox 3(我迄今爲止測試過的唯一)。該編輯器正在SharePoint環境的上下文中運行的用戶控件內部使用。我懷疑它是某種類型的CSS衝突,或者與我使用它的方式不兼容。任何想法爲什麼一些功能工作,但沒有其他與此控制?

<telerik:RadEditor ID="topicBody" Runat="server" Width="100%" height="300" > 
    <Tools> 
     <telerik:EditorToolGroup Tag="Top"> 
      <telerik:EditorTool Name="Bold" /> 
      <telerik:EditorTool name="Italic"/> 
      <telerik:EditorTool name="Underline"/> 
      <telerik:EditorTool name="StrikeThrough"/> 
      <telerik:EditorSeparator Visible="true" /> 
      <telerik:EditorTool name="JustifyLeft"/> 
      <telerik:EditorTool name="JustifyCenter"/> 
      <telerik:EditorTool name="JustifyRight"/> 
      <telerik:EditorTool name="JustifyFull"/> 
      <telerik:EditorSeparator Visible="true" /> 
      <telerik:EditorTool name="InsertOrderedList"/> 
      <telerik:EditorTool name="InsertUnorderedList"/> 
      <telerik:EditorTool name="Outdent"/> 
      <telerik:EditorTool name="Indent"/> 
      <telerik:EditorSeparator Visible="true" /> 
      <telerik:EditorTool name="FontName"/> 
      <telerik:EditorTool name="FontSize"/> 
      <telerik:EditorTool name="ForeColor"/> 
      <telerik:EditorTool name="BackColor"/>     
     </telerik:EditorToolGroup> 
     <telerik:EditorToolGroup Tag="Middle"> 
      <telerik:EditorTool name="Undo"/> 
       <telerik:EditorTool name="Redo"/> 
       <telerik:EditorSeparator Visible="true" />    
      <telerik:EditorTool name="LinkManager"/> 
      <telerik:EditorTool name="Unlink"/> 
      <telerik:EditorSeparator Visible="true" /> 
      <telerik:EditorTool name="InsertTable"/> 
      <telerik:EditorSeparator Visible="true" />  
       <telerik:EditorTool name="Cut"/> 
      <telerik:EditorTool name="Copy"/> 
       <telerik:EditorTool name="PasteAsHtml"/> 
       <telerik:EditorTool name="PastePlainText"/> 
       <telerik:EditorSeparator Visible="true" /> 
       <telerik:EditorTool name="Print"/>         
     </telerik:EditorToolGroup> 
    </Tools> 
</telerik:RadEditor> 

回答

1

這個問題原來是相互矛盾的CSS。主站點CSS文件具有匹配BLOCKQUOTE,OL,UL和LI的選擇器,這些選項與RadEditor相干擾。考慮到RadEditor使用IFrame渲染用戶正在編輯的內容,這是令人驚訝的。我不相信它應該從容器站點拉CSS。這看起來像是控件中的一個錯誤,它允許樣式滲透到Iframe中,該Iframe應該是沒有外部CSS的島嶼。

0

請嘗試使用下面的代碼:

if (Request.Browser.Browser.ToLowerInvariant() == "firefox") 
      { 
       System.Reflection.FieldInfo browserCheckedField = typeof(RadEditor).GetField("_browserCapabilitiesRetrieved", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic); 
       browserCheckedField.SetValue(RadEditor1, true); 
       System.Reflection.FieldInfo browserSupportedField = typeof(RadEditor).GetField("_isSupportedBrowser", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic); 
       browserSupportedField.SetValue(RadEditor1, true); 
      }