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

Relative versus Absolute Urls

3 Answers 96 Views
WebParts for SharePoint
This is a migrated thread and some comments may be shown as answers.
Bjarke Jonassen
Top achievements
Rank 1
Bjarke Jonassen asked on 12 Feb 2010, 01:51 PM

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

3 Answers, 1 is accepted

Sort by
0
Stanimir
Telerik team
answered on 12 Feb 2010, 03:40 PM
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.
0
Bjarke Jonassen
Top achievements
Rank 1
answered on 15 Feb 2010, 08:02 AM
Hi

The version for The RadEditor we use is: 5.3.2.0

Regards  Bjarke
0
Stanimir
Telerik team
answered on 15 Feb 2010, 08:10 AM
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.
Tags
WebParts for SharePoint
Asked by
Bjarke Jonassen
Top achievements
Rank 1
Answers by
Stanimir
Telerik team
Bjarke Jonassen
Top achievements
Rank 1
Share this question
or