Telerik RadEditor 渲染问题
我一直在开发一个使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
请参阅以下帮助文章,其中提供了如何解决问题的指导:
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
结果发现这个问题是 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.
请尝试使用下面的代码:
Please try using below code: