RadEditor Hyperlink document manager Insert button event

0 Answers 108 Views
Editor
jamsheer
Top achievements
Rank 1
Veteran
jamsheer asked on 17 Mar 2023, 01:05 PM | edited on 17 Mar 2023, 01:25 PM

Hi Telerik,

 

I want to trigger the Document manager insert button event when I inserting an attachments into the hyperlink manager when I open the document manager from the hyperlink manager.

 

I tried by adding the below code based on the documentation, 

Added OnClientPasteHtml event for RadEditor

<telerik:RadEditor ID="reNotes" runat="server" Width="800" Height="300" Skin="Windows7" 
                                OnClientLoad="OnClientLoad" EnableResize="False" AutoResizeHeight="true" EditModes="Design"
                                OnClientCommandExecuting="OnClientCommandExecuting" OnClientPasteHtml="OnClientPasteHtml" >
                                <DocumentManager MaxUploadFileSize="20000000" SearchPatterns="*.*" />
                                <Content>                                     
                                
                                </Content>
                            </telerik:RadEditor>
Also added the corresponding function in the script
 function OnClientPasteHtml(sender, args) {
                    alert(10);
                    debugger;
                    var commandName = args.get_commandName();
                    var value = args.get_value();

                    if (commandName == "Paste") {
                        // The StripPathsFilter() method receives as a parameter an array of strings (devided by a white space) that will be stripped from the absolute links.
                        var domainName = "http://" + window.location.host; //returns the hostname and port number of the current URL
                        var filter = new Telerik.Web.UI.Editor.StripPathsFilter([domainName]); //strip the domain name from the absolute path

                        var contentElement = document.createElement("SPAN");
                        //contentElement.innerHTML = value;
                        var newElement = filter.getHtmlContent(contentElement);
                        alert(newElement.outerHTML);
                        //args.set_value(newElement.outerHTML);  //set the modified pasted content in the editor
                    }
                }

But the event not triggering when the insert button clicked.

 

Please note : I opened the document manager from the hyperlink manager popup.

Please see the screenshot

 

Is there any way to trigger the insert button event, So that I can access the current attachment url and replace the same with an encrypted url and also display the encrypted URL in the url field of the hyperlink manager.

 

Thanks & regards,


Rumen
Telerik team
commented on 22 Mar 2023, 11:05 AM

Hi Jamsheer,

You can find out how to manipulate the dialog opened by clicking on the DocumentManagerCaller button control and what is returned through it when closed in the following article:

Opening a custom dialog instead of DocumentManager from within LinkManager.

There is a similar article for the ImageManager - 

Call a custom dialog from the Image Manager ImageDialogCaller button.

If you want to manipulate what is inserted by the Hyperlink manager (opened via the Hyperlink Manager toolbar button), you can use the OnClientDomChange client event.

No answers yet. Maybe you can help?

Tags
Editor
Asked by
jamsheer
Top achievements
Rank 1
Veteran
Share this question
or