开发者

Telerik RadEditor for MOSS - How do I suppress min-width inline CSS?

开发者 https://www.devze.com 2022-12-22 10:43 出处:网络
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,

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:开发者_StackOverflow中文版 100%; min-height: 300px; min-width: 1133px;"
 class="RadEditor Default reWrapper ms-input">
  • Related thread


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.


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!


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

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


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

精彩评论

暂无评论...
验证码 换一张
取 消