Telerik RadEditor for MOSS - 如何抑制最小宽度内联 CSS?

发布于 2024-08-23 16:09:50 字数 610 浏览 10 评论 0原文

我在使用 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 技术交流群。

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

发布评论

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

评论(4

话少情深 2024-08-30 16:09:50

最小宽度/高度样式是从编辑器添加的。 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.

月光色 2024-08-30 16:09:50

虽然使用 javascript/jQuery 来纠正此问题并没有错,但实现此目的的一种更高效且资源消耗更少的方法是最初定义样式(在 RadEditor 之前)。大多数用例不会受此影响太大,但我发现通过使用以下内容,加载时间减少了 30%:

<style>
  div.RadEditor {
    min-width: inherit !important;
  }
</style>

快乐编码!

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:

<style>
  div.RadEditor {
    min-width: inherit !important;
  }
</style>

Happy coding!

奢望 2024-08-30 16:09:50

我认为你可以把它压缩得更小。刚刚测试了一下...

  $('.RadEditor').css('width','auto');

I think you can compact it even smaller. Just tested it out...

  $('.RadEditor').css('width','auto');
星光不落少年眉 2024-08-30 16:09:50

我最终放弃了一个覆盖脚本,如果您需要它,就放在这里。

// Hack/Fix for Telerik editor controls, this removes the strange inline css property min-width that is being set somewhere deep in the Telerik scripts.

$(document).ready(
    function() {
        var items = $(".RadEditor").filter("div");
        items.each(function(index) {
            var that = $(this);
            if (that.css("min-width")) {
                that.css("min-width", "inherit");
            }
        });
    }
);

I ended up throwing down an override script, here it is in case you need it.

// Hack/Fix for Telerik editor controls, this removes the strange inline css property min-width that is being set somewhere deep in the Telerik scripts.

$(document).ready(
    function() {
        var items = $(".RadEditor").filter("div");
        items.each(function(index) {
            var that = $(this);
            if (that.css("min-width")) {
                that.css("min-width", "inherit");
            }
        });
    }
);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文