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

Stripping domain name from Urls

1 Answer 80 Views
WebParts for SharePoint
This is a migrated thread and some comments may be shown as answers.
ajd
Top achievements
Rank 1
ajd asked on 24 Jun 2009, 01:29 PM
I am using the fully featured RadEditor for MOSS - version 5.4.1.0.

When I use the editor in a WCM scenario the domain name of Urls are stripped. For example, http://mydomain.com/Pages/default.aspx becomes /Pages/default.aspx This is exactly what I want and what I would expect.

However, when I use the editor as a web part as described here

http://www.telerik.com/help/aspnet-ajax/using-radeditor-webpart.html

the Url's do not get stripped.

I am not using the Link manager, I am inserting Reusable Content and the reusable content html does not have absolute Url's in the source. The domain name gets attached once it is inserted in the web part. Typing an anchor tag in manually produces the same result - no stripping.

I have these properties set in my Config and ListConfig files.

<property name="StripAbsoluteImagesPaths">true</property>
<property name="StripAbsoluteAnchorPaths">true</property>

 Is there a way around this?

Thanks.

1 Answer, 1 is accepted

Sort by
0
Stanimir
Telerik team
answered on 24 Jun 2009, 01:42 PM
Hi ajd,
StripAbsoluteImagesPaths and StripAbsoluteAnchorPaths are obsolete. In order to achieve the desired functionality you need to create your own custom content filter for the RadEditor for MOSS.

Here is an example of how to do this.
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 or ListConfigFile.xml, which are located in the \Program Files\Common Files\Microsoft Shared\web server extensions\wpresources\RadEditorSharePoint\5.4.1.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 absolute URL 
        newContent = newContent.replace(/http:\/\/mydomain.com\//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.



All the best,
Stanimir
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
WebParts for SharePoint
Asked by
ajd
Top achievements
Rank 1
Answers by
Stanimir
Telerik team
Share this question
or