Telerik RadEditor for MOSS - 如何抑制最小宽度内联 CSS?
我在使用 MOSS 的 RadEditor 时遇到问题,我真的很困惑这个问题的根源。我尝试使用 Firebug 查找任何 min-* CSS 设置发生的位置,并且搜索结果为空,但我知道它正在发生,因为下载的页面标记没有该内联 CSS。
我相信 Telerik 控件发出的 Javascript 之一是将内联 CSS 样式添加到编辑器的顶级 div,即 min-height、min-width。这导致我的页面出现布局问题。我的问题是为什么要这样做,更重要的是我如何防止这种情况发生?
<div style="height: 300px; width: 100%; min-height: 300px; min-width: 1133px;"
class="RadEditor Default reWrapper ms-input">
I'm having an issue with the RadEditor for MOSS, I'm really baffled as to the source of this issue. I tried using Firebug to find where any min-* CSS settings are happening and search came up empty, but I know it's happening because the downloaded page markup does not have that inline CSS.
I believe that one of the Telerik control emitted Javascripts is what is adding inline CSS style to the top level div of the editor, namely min-height, min-width. This is causing layout issues on my page. My question is why is it doing this, and more importantly how do I prevent this from happening?
<div style="height: 300px; width: 100%; min-height: 300px; min-width: 1133px;"
class="RadEditor Default reWrapper ms-input">
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
最小宽度/高度样式是从编辑器添加的。 AFAIK 除非您覆盖控件的 JavaScript,否则无法阻止它们出现。但是,我认为这不会有帮助,因为样式显然与编辑器大小相关,如果删除它们,控件的视觉外观可能会破坏。
您应该尝试通过修改页面布局来解决该问题。例如,MOSS 页面通常以怪异模式呈现,添加有效的 XHTML 文档类型应该会让事情变得更好。
The min-width/height style is added from the editor. AFAIK there is no way to stop them from appearing unless you override the control's JavaScript. However, I don't think that this will help, since the styles are obviously tied to the editor size and if you remove them, the control's visual appearance is likely to break.
You should try to workaround the issue by modifying your page layout. For example - the MOSS pages are usually rendered in quirks mode and adding a valid XHTML doctype should change things for the better.
虽然使用 javascript/jQuery 来纠正此问题并没有错,但实现此目的的一种更高效且资源消耗更少的方法是最初定义样式(在 RadEditor 之前)。大多数用例不会受此影响太大,但我发现通过使用以下内容,加载时间减少了 30%:
快乐编码!
While using javascript/jQuery to correct this issue isn't wrong, a more performant and less resource intensive way of accomplishing this would be to define the style initially (before the RadEditor). Most use cases wouldn't be affected by this too much, but I've seen as much as a 30% reduction in load time by using the following:
Happy coding!
我认为你可以把它压缩得更小。刚刚测试了一下...
I think you can compact it even smaller. Just tested it out...
我最终放弃了一个覆盖脚本,如果您需要它,就放在这里。
I ended up throwing down an override script, here it is in case you need it.