﻿
Telerik.Web.UI.Editor.CommandList["pageLink"] = function(commandName,editor,oTool)
{
    // RadEditor old version using editor.ShowDialog function
    // RadEditor Ajax version using editor.showExternalDialog function
    editor.showExternalDialog(
        "/common/plugins/RadEditorAjax/pageLink/PageLinkRadAjax.aspx" + window.location.search,
        editor,
        //dimension
        600,600, 
        function(sender, args){
           var text = args.text;
           if(editor.getSelection() && editor.getSelection().getText())
                text = editor.getSelection().getText();
           var htmlText = String.format("<a href='{0}'>{1}</a>", args.url, text);
           editor.pasteHtml(htmlText);            
        },
        null,
        'Insert Page Link',
        true,
        Telerik.Web.UI.WindowBehaviors.Close + Telerik.Web.UI.WindowBehaviors.Move,
        false,
        true);
};


///showExternalDialog(url (aspx/html file), argument, width, height, callbackFunction, callbackArgs, title, modal, behaviors, showStatusbar, showTitlebar);
