StripFormattingOnPaste CSS

7 posts, 1 answers
  1. Espen
    Espen avatar
    6 posts
    Member since:
    Jul 2007

    Posted 27 Feb 2008 Link to this post

    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
  2. Answer
    Rumen
    Admin
    Rumen avatar
    12846 posts

    Posted 27 Feb 2008 Link to this post

    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

  3. Espen
    Espen avatar
    6 posts
    Member since:
    Jul 2007

    Posted 27 Feb 2008 Link to this post

    Ok, thank you for your answer.
    Have you considered including an option that just cleans out inline css styles?

    Espen G.
  4. Rumen
    Admin
    Rumen avatar
    12846 posts

    Posted 27 Feb 2008 Link to this post

    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
  5. Espen
    Espen avatar
    6 posts
    Member since:
    Jul 2007

    Posted 27 Feb 2008 Link to this post

    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.
  6. Rumen
    Admin
    Rumen avatar
    12846 posts

    Posted 04 Mar 2008 Link to this post

    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
  7. Espen
    Espen avatar
    6 posts
    Member since:
    Jul 2007

    Posted 05 Mar 2008 Link to this post

    Thank you very much for your help!

    Espen G.
Back to Top