LinkManager extension

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

    Posted 08 Dec 2009 Link to this post


    The LinkManager is now extended with the DocumentManager button, that works great.

    I need the same functionality with the Image Manager.
    I tried to copy and rework the DocumentManager code, but I am stuck on how to get the parameters back to the LinkManager form.

    Is there any chance that this functionality can be added?

  2. Answer
    Dobromir avatar
    1633 posts

    Posted 11 Dec 2009 Link to this post

    Hi Marc,

    In order to get the parameters back to the LinkManager you need to modify the callback function. The difference between document and image managers is the element that you are working with so you have to make the following changes:
    1) the link.tagName should be IMG not A 
    2) the attribute that you have to set as a href should be src
    3) the _linkText.value should be changed so it outputs the needed string (<img> tag in my code>

    Here is an example of the modified function:

    var callbackFunction = Function.createDelegate(this, function(sender, args) {
        var link = args.get_value ? args.get_value() : args.Result;
        if (link && link.tagName == "IMG") {
            var href = link.getAttribute("src", 2);
            this._linkUrl.value = href;
            if (!this._linkText.value) this._linkText.value = "<img src=\"" + href + "\" />";
            var className = link.className;
            if (className) this._linkCssClass.set_value(className);

    Also, in order to place the image as a link in the editor's content area, you need to replace &lt; and &gt; which will replace  < and > when the editor executes pasteHtml to place the linkText.value. You can do this by using the following approach:

    <telerik:RadEditor ID="RadEditor1" runat="server" OnClientPasteHtml="OnClientPasteHtml" ExternalDialogsPath="~/EditorDialogs"
        <ImageManager UploadPaths="~/Images/" ViewPaths="~/Images/" DeletePaths="~/Images/" />
    <script type="text/javascript">
        function OnClientPasteHtml(sender, args) {
            var commandName = args.get_commandName();
            var value = args.get_value();
            if (commandName == "LinkManager") {
                value = value.replace(/\<(.*)>/gi, "<$1>");

    I hope this information helps.

    Sincerely yours,
    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.
  3. Fit2Page
    Fit2Page avatar
    375 posts
    Member since:
    Feb 2007

    Posted 16 Dec 2009 Link to this post

    Thank you Dobromir , works OK!
Back to Top