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

Forums / Developing with Sitefinity / ImageSelector in RadEditor

ImageSelector in RadEditor

2 posts, 1 answered
  1. Levi Burton
    Levi Burton avatar
    11 posts
    Registered:
    16 Apr 2010
    29 Jun 2010
    Link to this post
    Sorry, my post title is incorrect -- I thought I wanted ImageSelector, but I actually want CmsHyperlinkUrlWebEditor.

    Is it possible to launch a CmsHyperlinkUrlWebEditor in a RadEditor by adding tool to the RadEditor toolbar?  I would like to do this so my users can select a page from the site and insert the returned page into the RadEditor as link.  Is this possible?  If it is possible, how would I go about doing it?

    This is Sitefinity 3.7sp3.
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    29 Jun 2010
    Link to this post
    Hi Levi Burton,

    You have to add a custom button to the RadEditor control - Adding Your Own Buttons. And then add the js code below to it

    Telerik.Web.UI.Editor.CommandList["LinkManager"] = function(commandName, editor, args) {
            var editorArgs = editor.getSelectedElement();
            if (!editorArgs.nodeName || typeof (editorArgs.nodeName) == "undefined" || editorArgs.nodeName != "A") {
                var sel = editor.getSelection();
                editorArgs = sel;
                editorArgs.Html = sel.getHtml();
                editorArgs.Text = sel.getText();
            }
     
            var myCallbackFunction = function(sender, args) {
                if (typeof (editorArgs.nodeName) != "undefined" && editorArgs.nodeName == "A")
                    args.parentNode.replaceChild(editorArgs, args);
                else {
                    var cloned = args.cloneNode(true);
                    var div = args.ownerDocument.createElement("DIV");
                    div.appendChild(cloned);
                    editorArgs.pasteHtml(div.innerHTML);
                }
     
            }
            var path = '<%= ((Telerik.Cms.Web.CmsPageBase)Page).ResolveCmsUrl("~/Sitefinity/UserControls/Dialogs/LinksDialog.aspx") %>';
            editor.showExternalDialog(
       path,
       editorArgs,
       750,
       515,
       myCallbackFunction,
       null,
       'ImageLibraryDialog',
       false,
       Telerik.Web.UI.WindowBehaviors.Close + Telerik.Web.UI.WindowBehaviors.Move,
       false,
       true)
        };


    All the best,
    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
    Answered
2 posts, 1 answered