Wednesday, June 8, 2011

SharePoint 2010 - Issues with Styles and Markup Styles drop downs in Rich Text Editor. Access is denied / 'undefined' is null or not an object - sp.ui.rte.js


Problem:

In the Rich Text Editor (CEWP / Page Content Area), when a user clicks on Markup Styles or Styles, the popups do not show up. A JS error shows up. (Access is denied / 'undefined' is null or not an object - sp.ui.rte.js)

Click inside a Rich Text Editor (CEWP or Page Content Field)



Click on Styles / Markup Styles



You will notice that the status bar reports a JS error.


Clicking on the error in status bar brings the below dialog:


Explanation:

I initially thought that the jQuery registration call or addThis script might be causing the issues and therefore tried removing jQuery references from Google and replaced them with local references, removed "Add This" widget, etc..

Finally it turned out to be that there are some empty CSS/JavaScript files in the master page that are causing the js error.

Resolution:

Make sure that there are no empty css files that are included in the master page.
Just add a comment like /* Styles */ in the CSS file
Check-In/Publish the CSS file and the error should disappear.