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

A href rewritten in FF, Chrome, Opera and Safari

5 Answers 80 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Fit2Page
Top achievements
Rank 2
Iron
Iron
Iron
Fit2Page asked on 18 Dec 2009, 12:18 PM
Hi,

In FireFox (3.5.6) and others the href property of an A becomes a relative link.

So if my CMS page is content/edit.aspx, all links in the editor become /content/<original link here>

This is not happening in IE8.
I tried to solve with Telerik.Web.UI.Editor.StripPathsFilter but didn't work.

BR,
Marc

5 Answers, 1 is accepted

Sort by
0
Fit2Page
Top achievements
Rank 2
Iron
Iron
Iron
answered on 18 Dec 2009, 01:01 PM
ATTENTION!!

This problem occurs since I installed the new hotfix DLL from your site yesterday!!

Seems a very serious bug to me.....

Hope to hear from you soon.

Marc
0
Dobromir
Telerik team
answered on 19 Dec 2009, 01:06 PM
Hi Marc,

I tried to reproduce this behavior with all the hotfixes after the service pack ( RadControls for ASP.NET AJAX Q3 2009 ver 2009.3.1208 ) but to no avail. Would you please open a new support ticket and send me a sample, fully runnable reproduction demo along with detailed reproduction instructions?

For your convenience I have attached a video that demonstrates my actions.

Sincerely yours,
Dobromir
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Fit2Page
Top achievements
Rank 2
Iron
Iron
Iron
answered on 21 Dec 2009, 08:11 AM
Good morning Dobromir,

I localized the problem.

I use

function OnClientLoad(editor)
{
editor.get_filtersManager().add(new Telerik.Web.UI.Editor.StripPathsFilter(["http://insight.fit2page.nl","http://insight1.fit2page.nl","http://f2p-server:8001/"]));
}

to strip absolute paths on drag-and-drop images in the editor.
This function is also amending the a href links.

Can you provide a solution for this?

BR,
Marc



0
Accepted
Dobromir
Telerik team
answered on 21 Dec 2009, 12:37 PM
Hi Marc,

The RadEditor Built-in StripFilterPaths filter is applied to <A> <AREA> <IMG> and <EMBEDED> tags and does not provide the functionality to be applied to a specific tag. In order to make specific elements with relative paths I would suggest you to create a custom filter.

The following example demonstrates a custom filter that removes a specific parts from the SRC attribute of an image:

function OnClientLoad(editor, args) {
    var pathsToStrip = ["http://localhost:4235/somefolder/", "http://www.cnn.com/", "http://cnn.com/", "http://i2.cdn.turner.com/cnn/"];
    editor.get_filtersManager().add(new MyFilter(pathsToStrip));
}
MyFilter = function(pathsToStrip) {
    MyFilter.initializeBase(this);
    this.set_isDom(true);
    this.set_enabled(true);
    this.set_name("RadEditor filter");
    this.set_description("RadEditor filter description");
    this._pathsToStrip = pathsToStrip;
}
MyFilter.prototype =
{
    getDesignContent: function(content) {
        this._updateElements(content, "IMG", "src");
        return content;
    },
    getHtmlContent: function(content) {
        this._updateElements(content, "IMG", "src");
        return content;
    },
    _getElements: function(content, tagName) {
        var result = content.getElementsByTagName(tagName);
        if (!result) result = content.ownerDocument.getElementsByTagName(tagName);
        return result;
    },
    _updateElements: function(content, tagName, attrName) {
        var elements = this._getElements(content, tagName);
        for (var i = 0; i < elements.length; i++) {
            var elem = elements[i];
            var attrValue = $telerik.isIE ? elem.getAttribute(attrName, 2) : elem[attrName];
            for (var j = 0; j < this._pathsToStrip.length; j++) {
                var toRemove = this._pathsToStrip[j];
                attrValue = attrValue.replace(toRemove, "");
            }
            elem.setAttribute(attrName, attrValue);
        }
    }
}
MyFilter.registerClass('MyFilter', Telerik.Web.UI.Editor.Filter);        

I hope this helps you.

All the best,
Dobromir
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Fit2Page
Top achievements
Rank 2
Iron
Iron
Iron
answered on 21 Dec 2009, 02:02 PM
Hi Dobromir,

Thank you very much, this function works OK for the application.

Regards,
Marc
Tags
Editor
Asked by
Fit2Page
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Fit2Page
Top achievements
Rank 2
Iron
Iron
Iron
Dobromir
Telerik team
Share this question
or