Using anchors in CMS with the Telerik r.a.d. editor
Some customers switched to the Telerik r.a.d. editor for CMS because this placeholder has a lot more features than the standard CMS placeholders. Currently it's free if you have a valid CMS license.
But using anchors causes sometimes a lot of trouble. Instead of going to the anchor, the posting switches to edit-mode!
We did some searching and found this page.
This behaviour is by design??? Strange, the placeholder doesn't have to store the URL of the page, just the anchor. So why does it point to the unpublished page? This looks more like a bug then a feature!
Here's some Javascript to replace the unpublished URL by the published URL for the anchors:
<script language="javascript">
var link = "";
var anchor = "";
var as = 0;
for (var i=0;i<window.document.links.length;i++) {
link = window.document.links(i).href;
as = link.indexOf("#");
if (as > -1) {
anchor = link.substring(as);
if (anchor.length > 1) {
window.document.links(i).href = "<%= ContentManagement.Publishing.CmsHttpContext.Current.Posting.URL%>" + anchor;
}
}
}
</script>
But using anchors causes sometimes a lot of trouble. Instead of going to the anchor, the posting switches to edit-mode!
We did some searching and found this page.
This behaviour is by design??? Strange, the placeholder doesn't have to store the URL of the page, just the anchor. So why does it point to the unpublished page? This looks more like a bug then a feature!
Here's some Javascript to replace the unpublished URL by the published URL for the anchors:
<script language="javascript">
var link = "";
var anchor = "";
var as = 0;
for (var i=0;i<window.document.links.length;i++) {
link = window.document.links(i).href;
as = link.indexOf("#");
if (as > -1) {
anchor = link.substring(as);
if (anchor.length > 1) {
window.document.links(i).href = "<%= ContentManagement.Publishing.CmsHttpContext.Current.Posting.URL%>" + anchor;
}
}
}
</script>
0 Comments:
Post a Comment
<< Home