Relatives links... :(

Samuel

I use "Telerik RadEditor for MOSS" and I have a problem with
relative links.I use the "Hyperlink Manager" to add a link: I type my
relative URL in the URL text field (for example: ./Help.aspx) and I
choose the "Other" type. I click "OK".

And finally, when I take a look to the generated HTML code, I
haven’t my relative link but an absolute link has been created:
http://xxx:port/website/Pages/Help.aspx

I really need use a relative link because the website will
be moved on a staging and after a production server... The absolute links will point on the development server pages... :(

Please, help me! Thanks!

Regards,

Samuel

Answer

Rumen

By default, Internet Explorer (IE) converts all relative links to
absolute on the client. This behavior is due to the DOM engine of the
Internet Explorer browser which “fills” the paths (href or src) for the
objects in an editing area. Since RadEditor relies in most part to the
Internet Explorer's engine, one may observe that the editor converts
relative paths to absolute after switching to HTML mode and back to
edit mode. Actually, it is Internet Explorer which is converting the
links. This problem does not apply to NS/Mozilla/Firefox browsers. For
v5, Telerik has employed a flexible mechanism based on regular
expressions that strips absolute paths. For better performance the
mechanism runs only when the user switches to HTML mode or submits the
page. In order to enabled the editor absolute strip path filters you should open the ConfigFile.xml and ListConfigFile.xml files and set the StripAbsoluteImagesPaths and StripAbsoluteAnchorPaths properties to true, e.g.

Nick

Are these config settings listed above only available when RadEditor Lite is installed? I can't find these entries in the config files when using the trial version of RadEditor v5 -- is it configured to strip out absolute paths automatically, or do i need to change something else?

Even when using RadEditor Lite (with the necessary config changes made) and i add a relative link to another page using the Telerik editor, it still prepends the domain name to the URL. I can tell this by switching to the code view. If i manually remove the domain name from the URL while in the code view and save the content, it seems to maintain the relative link. This is great, except i obviously don't want to have to manually edit each hyperlink when entering new content. Can you tell me if i'm missing something here?

Thanks...

Lini

The StripAbsoluteAnchorPaths and StripAbsoluteImagesPaths are not used in the new version of the MOSS full featured editor (5.x). The Lite build is based on the old version (4.x) and it respects the above properties if you set them in the configuration file.

If I understand correctly, you are using the Lite version and you have set the above properties to True. When you enter a relative URL, e.g. "/Pages/Default.aspx", the editor keeps it relative after you save the content. However, when you enter an absolute URL, e.g. "http://server/Pages/Default.aspx", the editor does not automatically convert it to be relative and it is kept absolute when you save the content. I think that this is the expected behavior - all URLs are kept the way you enter them. If you wish to force the editor to strip certain absolute paths, you need to use the AnchorPathToStripproperty - http://www.telerik.com/help/aspnet/editor/radeditor-telerik.webcontrols.radeditor-anchorpathtostrip.html

Kind regards,
Lini
the Telerik team

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

Nick

To clarify, whether i'm using the lite or the full version of RadEditor, it is still adding the domain name to my relative links. This is the same behaviour that is exhibited by the built-in Microsoft editor with Internet Explorer.

I think this is because the Hyperlink Manager button on my RadEditor instance still fires up the original Microsoft dialog -- not the Telerik one. Is this a config setting i need to change?

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()

{

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

newContentnewContent = 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 at the end of MOSSEditorTools.js .

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

Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks or appropriate markings.