If you render your XHTML property using @Html.PropertyFor(....) any links will be parsed by Episerver. If you are working with the property html directly, you need to this your self by creating a helper method that parses the html and replaces the guid based links with friendly urls.
The internal url is a good idea to keep since otherwise you will create a lot of 404s if you change urlsegment or move a page/media in the structure. So you probably want to keep it and resolve the friendly url later in the chain instead...
With this specific xhtml editor i need to save it to a seperate database for use in a tool i'm working with so @Html.PropertyFor won't work in this case sadly and this tool won't be able to translate the internal url to the friendly ur.
I would then convert it before saving it. Something like:
public static XhtmlString ToExternalLinks(this XhtmlString xhtmlString) { var result = new StringBuilder(); foreach (var fragment in xhtmlString.Fragments) { var urlFragment = fragment as UrlFragment; result.Append(urlFragment != null ? UrlResolver.Current.GetUrl(new UrlBuilder(urlFragment.InternalFormat), ContextMode.Default) : fragment.InternalFormat); } return new XhtmlString(result.ToString()); }
Then I guess you need parse the html before saving it in the database (you can use Regex to find links in the html).
Is there an easy way of changing the behavior of the edit/insert link plugin in tinymce so that if I pick an episerver page or a media it saves it as a friendly url instead of like /link/cb750554e595497cbee028391fb2e291.aspx?id=17672 or do I need to build a new plugin from scratch?