A href rewritten in FF, Chrome, Opera and Safari

6 posts, 1 answers
  1. Fit2Page
    Fit2Page avatar
    375 posts
    Member since:
    Feb 2007

    Posted 18 Dec 2009 Link to this post

    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
  2. Fit2Page
    Fit2Page avatar
    375 posts
    Member since:
    Feb 2007

    Posted 18 Dec 2009 Link to this post

    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
  3. Dobromir
    Admin
    Dobromir avatar
    1633 posts

    Posted 19 Dec 2009 Link to this post

    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.
  4. Fit2Page
    Fit2Page avatar
    375 posts
    Member since:
    Feb 2007

    Posted 21 Dec 2009 Link to this post

    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



  5. Answer
    Dobromir
    Admin
    Dobromir avatar
    1633 posts

    Posted 21 Dec 2009 Link to this post

    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.
  6. Fit2Page
    Fit2Page avatar
    375 posts
    Member since:
    Feb 2007

    Posted 21 Dec 2009 Link to this post

    Hi Dobromir,

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

    Regards,
    Marc
Back to Top