Anyone have an example of handling this efficiently? I can of course use an HTMLHelper to parse the value and do a search and replace, just curious if there are any other putfals in this topic.
Thanks,
Reid
4 Answers, 1 is accepted
By default the Image and Link Managers of RadEditor insert images and links with relative paths:
<img alt="" src="/Images/myImage.gif" />
<a href="/Documents/myDocument.docx">myDocument.docx</a>
So if the Images and Documents folders are configured in IIS as virtual folders pointing to the root of the web application then they will be visible in the public and in the development sites.
Of course, if you have paths with absolute URL then you can use String.Replace on the server to strip the domain name from the url/src paths.
All the best,
Rumen
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

This is resolved, local paths are being rendered.
Thanks!
Reid
If you cut and paste a link then the browser could create an absolute path. In this case try the solution provided at the end of the description of this live demo: OnClientPasteHtml, e.g.
The OnClientPasteHtml event is also fired when the Paste (Ctrl+V) command is executed. It is useful in scenarios when the pasted content should be modified and inserted in the content area.
For example when copying and pasting a link or an image with a relative path in Internet Explorer, the browser automatically converts the path to absolute. The code below demonstrates how to attach to the OnClientPasteHtml event and strip the desired url path using the StripPathFilter content filter. The StripPathsFilter() method receives as a parameter an array of strings (devided by a white space) that will be stripped from the absolute path.
<script type="text/javascript">
function OnClientPasteHtml(sender, args)
{
var commandName = args.get_commandName();
var value = args.get_value();
if (commandName == "Paste")
{
// The StripPathsFilter() method receives as a parameter an array of strings (devided by a white space) that will be stripped from the absolute links.
var domainName = "http://" + window.location.host; //returns the hostname and port number of the current URL
var filter = new Telerik.Web.UI.Editor.StripPathsFilter([domainName]); //strip the domain name from the absolute path
var contentElement = document.createElement("SPAN");
contentElement.innerHTML = value;
var newElement = filter.getHtmlContent(contentElement);
alert(newElement.outerHTML);
args.set_value(newElement.outerHTML); //set the modified pasted content in the editor
}
}
</script>
Please, note that the OnClientPasteHtml event fires the Paste command only when the StripFormattingOnPaste property is not set to "NoneSupressCleanMessage". In this case the editor does not process the pasted content and pastes it without modifications.
Best wishes,
Rumen
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Thanks again,
Reid