Prolems with the StripFormattingOptions property

2 posts, 0 answers
  1. Thomas
    Thomas avatar
    7 posts
    Member since:
    Mar 2009

    Posted 02 Apr 2009 Link to this post


    I'm using the RadEditor v. 5.3.2 (I can't change) and I have to strip the Text links. I'm adding the editor programatically (eg. MOSSRadEditor editor = new MOSSRadEditor();) and I am trying to add the link using the default link manager (<tool name="MOSSLinkManager" shortcut="CTRL+K" />). However, when I try to add the link on a text, it changes the link to a absolute path instead of a relative path, but I need a RELATIVE path. I tried to use the StripFormatingOptions property setting it to ALL, but It just strip Image paths and not the links. The link are just relatives when I try to add a link on a image, but not when I try to add on a text.

    I have some restrictions:

    I can't change the ToolsFile.xml
    I can't add a javascript in the page
    I have to do it in the code-behind, like before, when I was setting the property StripAbsoluteAnchorPaths in the older versions (It was working with the version 4.3.4).

    Thank you,

  2. Stanimir
    Stanimir avatar
    1654 posts

    Posted 06 Apr 2009 Link to this post

    Hello Thomas,

    One thing that I can suggest you is to use the LinkManager dialogue Provided by Telerik. There you will not be able to use the Asset Picker, but the URLs will be absolute. You can modify your code from <tool name="MOSSLinkManager" shortcut="CTRL+K" /> to <tool name="LinkManager" shortcut="CTRL+K" />.

    Other solution to your problem is to create a custom content filter, and I am sorry but it is not a serverside one. This would require access to the ConfigFile.xml, ListConfigFile.xml and MOSSEditorTools.js located in the \Program Files\Common Files\Microsoft Shared\web server extensions\wpresources\RadEditorSharePoint\\Resources folder.

    Here how this is done.

    1. You should use the OnClientLoad property of the RadEditor to attach a handler. To do this you should add the following line in the ConfigFile.xml
    <property name="OnClientLoad">OnClientLoad</property>  

    2. You can use MOSSEditorTools.js to add custom java script code to RadEditor. There you should define the OnClientLoad handler and your custom content filter.
    Here is an example that you may find useful:
    function OnClientLoad(editor, args)  
        editor.get_filtersManager().add(new MyFilter());  
    MyFilter = function()  
        this.set_name("RadEditor filter");  
        this.set_description("RadEditor filter description");  
    MyFilter.prototype =  
        getHtmlContent : function(content)  
            var newContent = content;  
            //here you replace absolute URL 
            newContent = newContent.replace(/http:\/\/mossrtm\//g, "");  
            return newContent;  
        getDesignContent : function(content)  
            var newContent = content;  
            return newContent;  
    MyFilter.registerClass('MyFilter', Telerik.Web.UI.Editor.Filter);  

    Just add this code in the end of MOSSEditorTools.js .

    Once you follow these steps, the absolute part of the URL should be stripped.

    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Back to Top