+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Add title to inserted image

Add title to inserted image

2 posts, 0 answered
  1. Ancuta Me
    Ancuta Me avatar
    43 posts
    Registered:
    26 Apr 2010
    27 Oct 2010
    Link to this post
    Hi,

    Could anyone share how to add a title field to go to my inserted images?
    I can't seem to find the template that deals with images added from the radEditor.

    Thank you.
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    27 Oct 2010
    Link to this post
    Hello Ancuta,

    The built-in selector does not return the title as argument of the RadWindow control that we use. You can modify Sitefinity\Admin\ControlTemplates\Libraries\Dialogs\ImageEditorDialog.ascx and insertLink() function as shown below to get the image title.

    function insertLink() //fires when the Insert Link button is clicked
    {
        alert('ivan');
        var closeArgument = currentElement;
        selValue = document.getElementById('<%= selectedValueField.ClientID %>')
        editHolder = document.getElementById('<%= editHolder.ClientID %>');
        var uplImg = document.getElementById('<%= uploadedImage.ClientID %>');
        debugger;
     
        if (editHolder.style.display == 'none') {
            if (selectedItem)
                closeArgument.alt = selectedItem.altText;
            else
                closeArgument.alt = '';
            closeArgument.src = selValue.value;
        }
        else {
            var altTextTxt = document.getElementById('<%= altTxt.ClientID %>');
            closeArgument.src = selValue.value;
            if (altTextTxt)
                closeArgument.alt = altTextTxt.value;
        }
     
        if (selValue.value.indexOf("~/") == 0) {
            closeArgument.setAttribute("sfref", selValue.value);
        } else if (selectedItem != undefined && selectedItem.unresolved) {
            closeArgument.setAttribute("sfref", selectedItem.unresolved);
            closeArgument.setAttribute("width", "100");
            closeArgument.setAttribute("height", "100");
        } else if (uplImg != undefined && uplImg.attributes["sfref"] != undefined) {
            closeArgument.setAttribute("sfref", uplImg.attributes["sfref"].value);
            var imgSrc = uplImg.src;
            if (imgSrc.indexOf("?") < 0) {
                closeArgument.src = imgSrc;
            }
            else
                closeArgument.src = imgSrc.slice(0, imgSrc.indexOf("?"));
        } else {
            closeArgument.removeAttribute("sfref");
        }
        closeArgument.title = closeArgument.nameProp;
        if (getRadWindow()) {
            var radWindow = getRadWindow();
            radWindow.argument = closeArgument;
            radWindow.close(closeArgument); //use the close function of the getRadWindow to close the dialog and pass the arguments from the dialog to the callback function on the main page.
        }
     
    }


    Greetings,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered