Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Why does SharePoint add the following to text entered into rich text fields of list items?

<div class="ExternalClass85AC900AB26A481DBDC8ADAE7A02F039"><p>....</p></div>

We've seen instances where we have two of these ExternalClass DIV tags wrapping content, even though we didn't add them. They cause the text to have weird, extra spacing on top and bottom, with the only solution for us being to go in and remove them from the HTML of the rich text field. We don't mind the P tags; but the unneeded DIVs are too much. And removing them doesn't affect the content in any way.

Anyone have a solution for this? Thanks.

share|improve this question
    
Use JQuery to remove the div/remove spacing from the div? –  Rawling Jan 30 '12 at 13:36
    
Thanks, Rawling. But that doesn't address the issue of why SP2010 adds the DIVs in the first place. –  Alex C Jan 31 '12 at 6:13

2 Answers 2

up vote 1 down vote accepted

Perhaps switching to alternate Rich Text Editor might be best option to get rid of these. At least RadEditor is one relatively common replacement. (I have no affiliation with RadEditor whatsoever).

share|improve this answer

This thread is quite old but there is a solution for it explained in this forum post: http://www.telerik.com/forums/table-formatting-lost-after-saving-a-list-item

Here are the two steps:
In order to workaround this issue you can create a custom content filter, which will strip .ExternalClassxxxxxxxxxxxxxxxxxxxxxxxxxxx class.

  1. Modify the respective ListConfigFile.xml, which is located in the /Program Files/Common Files/Microsoft Shared/web server extensions/wpresources/RadEditorSharePoint/5.x.x.0__1f131a624888eeed/Resources/ folder.
    Add the following element:
<property name="OnClientLoad">OnClientLoad</property>
  1. Add the following JavaScript to the MOSSEditorTools.js, which is located in the mentioned above folder:
function OnClientLoad(editor, args)
{
    editor.get_filtersManager().add(new MyFilter());
}
MyFilter = function()
{
    MyFilter.initializeBase(this);
    this.set_isDom(false);
    this.set_enabled(true);
    this.set_name("RadEditor filter");
    this.set_description("RadEditor filter description");
}
MyFilter.prototype =
{
    getHtmlContent: function(content)
    {
        var newContent = content;
        //Make changes to the content and return it
        newContent = newContent.replace(/\.ExternalClass[^ ]* /ig, "");
        return newContent;
    }
}
MyFilter.registerClass('MyFilter', Telerik.Web.UI.Editor.Filter);
share|improve this answer
    
Please add a brief explanation of the steps outlined in the link you provided. If the link breaks at a later date, your answer will no longer be valuable. –  Phil Greer Jul 11 at 15:28
    
Thanks for the suggestion, I'll do it right away. –  Rumen Jekov Jul 11 at 15:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.