This is a migrated thread and some comments may be shown as answers.

StripFormattingOnPaste CSS

6 Answers 81 Views
WebParts for SharePoint
This is a migrated thread and some comments may be shown as answers.
Espen
Top achievements
Rank 1
Espen asked on 27 Feb 2008, 08:25 AM
Hello,

In your StripFormattingOnPaste property documentation it says that the CSS member removes style attributes, but does it in fact clean out more? From what i can tell it also cleans out classes. Can you please give a more detailed description of what the CSS member cleans?

Thanks.
Espen G

6 Answers, 1 is accepted

Sort by
0
Accepted
Rumen
Telerik team
answered on 27 Feb 2008, 08:58 AM
Hi Espen,

The StripFormattingOnPaste="Css" setting cleans not only the style attributes, but also the class attributes. You can see how the Css property setting works in the attached video.


Best regards,
Rumen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Espen
Top achievements
Rank 1
answered on 27 Feb 2008, 09:53 AM
Ok, thank you for your answer.
Have you considered including an option that just cleans out inline css styles?

Espen G.
0
Rumen
Telerik team
answered on 27 Feb 2008, 02:12 PM
Hi Espen,

Could you please tell me under which MOSS scenario you are using RadEditor: Web Part, WCM or Lists, Wikis, Blogs, etc?

Once we receive this info, we will try to provide a code solution based on your requirement.

Best regards,
Rumen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Espen
Top achievements
Rank 1
answered on 27 Feb 2008, 02:30 PM
That would be great.

We use RadEditor for WCM. We want it to strip down everything pasted except non-empty html tags and their classes, plus plain text.

Espen G.
0
Rumen
Telerik team
answered on 04 Mar 2008, 05:08 PM
Hi Espen,

To achieve your goal you should override the Paste command of the editor and implement your own stripping functionality that will remove the desired attributes.

The example below demonstrates how to override the Paste command by attaching a function to the OnClientCommandExecuted property event of RadEditor. In the \Common Files\Microsoft Shared\web server extensions\wpresources\RadEditorSharePoint\4.5.0.0__1f131a624888eeed\RadControls\Editor\ConfigFile.xml file you should put the following two tag declarations:

<property name="OnClientCommandExecuted">OnClientCommandExecuted</property>
<property name="StripFormattingOnPaste">NoneSupressCleanMessage</property>

After that in the page with the editor ( <rade:RadHtmlField...) put the following JavaScript code above the editor's declaration:

<script type="text/javascript">
function OnClientCommandExecuted(editor, commandName, oTool)
{
    if(commandName == "Paste")
    {
            window.setTimeout(
            function()
            {
                var elems = editor.Document.getElementsByTagName("*"); //reference to all elements in the content area
           
                for (var i = 0; i < elems.length; i++)
                {
                   var elem = elems[i];
                   //write your code here to strip the non-desired attributes
                }
             }, 150);

    }
}
</script>
<rade:RadHtmlField id="Content" FieldName="PublishingPageContent"  runat="server"/>


Best regards,
Rumen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Espen
Top achievements
Rank 1
answered on 05 Mar 2008, 01:55 PM
Thank you very much for your help!

Espen G.
Tags
WebParts for SharePoint
Asked by
Espen
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Espen
Top achievements
Rank 1
Share this question
or