This is a migrated thread and some comments may be shown as answers.

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

1 Answer 29 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Abhay
Top achievements
Rank 1
Abhay asked on 21 Sep 2013, 09:59 AM
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>


  

1 Answer, 1 is accepted

Sort by
0
Ianko
Telerik team
answered on 25 Sep 2013, 02:22 PM
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.
Tags
Editor
Asked by
Abhay
Top achievements
Rank 1
Answers by
Ianko
Telerik team
Share this question
or