Customize Link in document editor on click

I would like to customize the behavior of a link once it is clicked in the document editor. 

I have already customized the toolbar to allow for links of existing documents within my website. 
Now, i would like it so that when i click that link in the editor itself,i get another popup that shows the document.

How do i modify the behavior of the link upon click within the document editor?

Thanks!

1 Reply

HC Harini Chellappa Syncfusion Team May 6, 2020 07:15 AM UTC

Hi Amanda, 

Syncfusion Greetings! 

You can use requestNavigate event of document editor to achieve your requirement. 


By default, we have added requestNavigate event for the document editor to navigate to the requested Url. 

Please refer the below code snippet, which is defined when initializing the document editor container, which will navigate to the specified URL when clicking on url. 

onRequestNavigate(args: RequestNavigateEventArgs){ 
        if (args.linkType !== 'Bookmark') { //if the link type is bookmark, please skip. Since this will navigate to the bookmarked content in the document editor. 
            let link: string = args.navigationLink; 
            if (args.localReference.length > 0) { 
                link += '#' + args.localReference; 
           
            window.open(link); 
            args.isHandled = true; 
       
   

 


you can handle this event in sample level. Please refer the below code snippet. 

containerInstance.documentEditor.requestNavigate = function(args){
      if (args.linkType !== 'Bookmark') {
 
           // Handle your code. 
    } 
} 
 

Kindly check this and let us know whether this suits your requirement. 

Regards, 

Harini C 


Loader.
Up arrow icon