Telerik RadEditor 渲染问题

发布于 2024-07-23 17:30:42 字数 2725 浏览 1 评论 0原文

我一直在开发一个使用 Telerik RadEditor 控件(版本 2009.1.402.35)的项目。 在大多数情况下,一切似乎都可以很好地配合它(即粗体、斜体、颜色等)。 但问题是,当用户编辑内容时,缩进和列表(带项目符号和编号)功能无法在屏幕上正确呈现。 有趣的是,当单击缩进或列表按钮时,它确实会向 html 添加正确的标记。

该问题出现在 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>

I've been working on a project where we are using the Telerik RadEditor control (version 2009.1.402.35). For the most part everything seems to work fine with it (i.e., bold, italics, color etc). What is an issue though is that the indent and list (bulleted and numbered) functions do not properly render on the screen while the user is editing the content. What is interesting about this is that when the indent or list button is clicked it does add the correct markup to the html.

The problem manifests in MSIE 6,7, 8 and FireFox 3 (the only ones i've tested so far). The editor is being used inside of a usercontrol that is running in the context of a SharePoint environment. My suspicions are that it is some type of a CSS conflict, or incompatibility with the way that i'm using it. Any ideas on why some of the functions work but not other with this control?

  <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>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

橘和柠 2024-07-30 17:30:42

请参阅以下帮助文章,其中提供了如何解决问题的指导:
http://www.telerik.com/ help/aspnet-ajax/editor-content-area-appearance-problems.html

Please, see the following help article which provides guidance how to solve the problem:
http://www.telerik.com/help/aspnet-ajax/editor-content-area-appearance-problems.html

愚人国度 2024-07-30 17:30:42

结果发现这个问题是 CSS 冲突。 主站点 CSS 文件具有与 BLOCKQUOTE、OL、UL 和 LI 匹配的选择器,这会干扰 RadEditor。 考虑到 RadEditor 使用 IFrame 来呈现用户正在编辑的内容,这一点令人惊讶。 我不认为它应该从容器站点中提取 css。 这看起来像是控件中的一个错误,它允许样式渗透到 Iframe,而 Iframe 应该是一个没有外部 CSS 的孤岛。

The problem on this turned out to be conflicting CSS. The main site CSS file had selectors that were matching BLOCKQUOTE, OL, UL, and LI, which interfered with the RadEditor. This is surprising given the fact that the RadEditor uses an IFrame to render the content that the user is editing. I don't believe it should be pulling css from the the container site. This seems like a bug in the control that it allows styles to bleed through to the Iframe which should be an island with no outside CSS.

攀登最高峰 2024-07-30 17:30:42

请尝试使用下面的代码:

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);
            }

Please try using below code:

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);
            }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文