Relative versus Absolute Urls

4 posts, 0 answers
  1. Bjarke Jonassen
    Bjarke  Jonassen avatar
    2 posts
    Member since:
    Sep 2004

    Posted 12 Feb 2010 Link to this post

    When we use the RadEditor on our SharePoint site, it converts all relative urls given by the SharePoint page picker dialog to absolute urls.

    It’s a big issue because, the editors accesses the site on port :8080 and because RadEditor converts the url, the port specification gets added to all the links.

    The result is broken links for all visitors on port :80.

     

    Can we do some configuration to force the RadEditor to use relative urls for links and images?

     

    Our current setup is we use the RadEditor for SharePoint, and have activated the website features on both root site, and all subwebs.

    We use the config file in the RadEditor install directory to set picture list, etc. and css files.

    We have tried this settings in config.xml but with no luck (taken from another thread in the forum)
    You can enable relative URLs in the editor by setting the StripAbsoluteAnchorPaths and StripAbsoluteImagesPaths editor properties to true in the configuration file.

    Regards, Bjarke

  2. Stanimir
    Admin
    Stanimir avatar
    1653 posts

    Posted 12 Feb 2010 Link to this post

    Hi Bjarke,
    Could you confirm, which version of RadEditor for MOSS you are using? I need this information in order to give you an corresponding solution.

    Regards,
    Stanimir
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.

  3. Bjarke Jonassen
    Bjarke  Jonassen avatar
    2 posts
    Member since:
    Sep 2004

    Posted 15 Feb 2010 Link to this post

    Hi

    The version for The RadEditor we use is: 5.3.2.0

    Regards  Bjarke
  4. Stanimir
    Admin
    Stanimir avatar
    1653 posts

    Posted 15 Feb 2010 Link to this post

    Hi Bjarke ,
    You can solve this problem by creating your own content filter.

    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, which is located in the /Program Files/Common Files/Microsoft Shared/web server extensions/wpresources/RadEditorSharePoint/5.x.x.0__1f131a624888eeed/Resources/ folder.
    <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()
    {
        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;
              
            //here you replace the 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, which is located in the mentioned above folder.

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

    I hope this helps.


    Best wishes,
    Stanimir
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Back to Top