I have users copying and pasting content from a webpage into a SharePoint 2010 RTE. Unbeknownst to them, they are also copying styles that the RTE converts to span tags. Upon paste, I'd like to automatically remove any/all span tags but keep any remaining markup. I realize that there will be other related issues but removing the span tags will get me much closer to where I need to be.
I've found a code snippet here that removes all markup upon paste.
//Disable the RTE paste option. Restricts to "Paste Plain Text"
function disableMarkupPasteForRTE()
{
Type.registerNamespace("RTE");
if (RTE)
{
if(RTE.RichTextEditor != null)
{
RTE.RichTextEditor.paste = function() { RTE.Cursor.paste(true); }
// Handle Ctrl+V short cut options in rich text editor
RTE.Cursor.$3C_0 = true;
}
}
}
_spBodyOnLoadFunctionNames.push("disableMarkupPasteForRTE");
Is anyone able to modify the above code to only remove span tags?