Need help to hide all properties button form the dialogue and default target to New Window

2 posts, 0 answers
  1. Abhay
    Abhay avatar
    1 posts
    Member since:
    Sep 2013

    Posted 21 Sep 2013 Link to this post

    HI All,

    I want to hide the All properties button in Insert Link dialogue  and default target to new window in the Insert Link dialogue of radedior.Can you please give me idea how to do this? I can see when I create the is post on the forum I found the Insert Link dialogue doesn't have all properties button.

    How can I do this?

    I have used below code


      <telerik:radeditor runat="server" ID="RadEditor1" >
       <Tools>
          <telerik:EditorToolGroup>
                 <telerik:EditorTool Name="InsertLink" Text="Insert Special Link" Enabled="true" />
          </telerik:EditorToolGroup>
       </Tools>
     
    </telerik:radeditor>

    When I use the custom dialogue it show the command hasn't implemented. e.g


       <telerik:radeditor runat="server" ID="RadEditor1" >
       <Tools>
          <telerik:EditorToolGroup>
                 <telerik:EditorTool Name="InsertSpecialLink" Text="Insert Special Link" Enabled="true" />
          </telerik:EditorToolGroup>
       </Tools>
     
    </telerik:radeditor>

    <style type="text/css">
    .reToolbar.Default .InsertSpecialLink
    {
            background-image: url(http://www.telerik.com/DEMOS/ASPNET/RadControls/Editor/Skins/Default/buttons/Custom.gif);
    }
    </style>
         <script type="text/javascript">
            
             Telerik.Web.UI.Editor.CommandList["InsertSpecialLink"] = function (commandName, editor, args) {
                 alert("1");
                 var elem = editor.getSelectedElement(); //returns the selected element.

                 if (elem.tagName == "A") {
                     editor.selectElement(elem);
                     argument = elem;
                 }
                 else {
                     //remove links if present from the current selection - because of JS error thrown in IE
                     editor.fire("Unlink");

                     //remove Unlink command from the undo/redo list
                     var commandsManager = editor.get_commandsManager();
                     var commandIndex = commandsManager.getCommandsToUndo().length - 1;
                     commandsManager.removeCommandAt(commandIndex);

                     var content = editor.getSelectionHtml();

                     var link = editor.get_document().createElement("A");

                     link.innerHTML = content;
                     argument = link;
                 }

                 var myCallbackFunction = function (sender, args) {
                     editor.pasteHtml(String.format("<a href={0} target='{1}' class='{2}'>{3}</a> ", args.href, args.target, args.className, args.name))
                 }

                 editor.showExternalDialog(
                      'InsertLink.aspx',
                      argument,
                      270,
                      300,
                      myCallbackFunction,
                      null,
                      'Insert Link',
                      true,
                      Telerik.Web.UI.WindowBehaviors.Close + Telerik.Web.UI.WindowBehaviors.Move,
                      false,
                      false);
             };
            
        </script>


      
  2. Ianko
    Admin
    Ianko avatar
    1940 posts

    Posted 25 Sep 2013 Link to this post

    Hello Abhay,

    For the desired customization you could modify the built-in dialog (LinkManager) with the desired elements. This approach is described with step by step demonstration in this online demo.

    About the InsertSpecialLink tool I suppose that you are trying to use the dialog from our Custom Dialogs demo. In addition to complete this customization you should have the InsertLink.aspx file in the root folder of the application with accordingly implemented logic.

    When a custom dialog is used, its implementation is in a different aspx file, which is called via request trough the showExternalDialog() method.

    Currently I can only make assumptions on why this warning is thrown, although I can suggest you to check if the tool's name is the same as in the CommandList["ToolsName"].

    Let me know if you need further assistance on this matter.

    Regards,
    Ianko
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Back to Top