Alternative for onfocusout?

I'm using onfocusout to invoke a function when I open an external web-url from inside the Rich Text Editor.  It works as it should, however, onfocusout is also invoked by the 'sub-popups' of the standard popup, which means that a script that the function invokes is running a lot more than I want it to.

Question:

Is there an event that I could use instead of onfocusout, to trigger my script, when a url is opened?

or

Is there a way of preventing onfocusout from being triggered by the 'sub-popups'?

Many thanks for any help,

Grant

( What I mean by 'sub-popups': )


8 Replies

GS Grant Symon May 3, 2026 09:25 AM UTC

Just adding to the question, because I've realised, that all I need is to be able to trigger my function, when the 'Open Link' button is clicked in the URL-Pop-up.  Is there a way to do this??

Image_4629_1777800283828



VJ Vinitha Jeyakumar Syncfusion Team May 4, 2026 11:24 AM UTC

Hi Grant Symon,


Your requirement to trigger your function when clicking the OpenLink tool of the link quick toolbar can be achieved by using the toolbarClick event.

Code snippet:
 
var defaultRTE = new ej.richtexteditor.RichTextEditor({
  toolbarClick: toolbarClick,
});
defaultRTE.appendTo('#defaultRTE');

function toolbarClick(args) {
  if (args.item.subCommand == 'OpenLink') {
    // here you can handle your code.
  }
}




Regards,
Vinitha


GS Grant Symon May 5, 2026 08:28 AM UTC

Hi Vinitha,

I hope you're well.

Thank you for the code which works well.  However, I can't find out how to make the button also perform its intended task, i.e., open the URL/Link.  (Sorry 😬... I'm not a programmer. 🙁)

This is what I have ... how do I make it also open the link?

function toolbarClick(args) {
  if (args.item.subCommand == 'OpenLink') {
FileMaker.PerformScriptWithOption ( 'Get-Source-JSFunction', "JSFn_fromCode", '5' )
()}}


VJ Vinitha Jeyakumar Syncfusion Team May 5, 2026 11:44 AM UTC

Hi Grant,

Please note that the default behavior of opening a URL link works as expected unless the action is explicitly canceled using the cancel event argument in the toolbarClick event.
Kindly refer to the code snippet below for guidance. 
Code snippet:
 function toolbarClick(args) {
  if (args.item.subCommand == 'OpenLink') {
    alert('function worked');
    // here you can handle your code.
  }
}


Samplehttps://stackblitz.com/edit/7uncgxmt-dmnwrw19?file=index.js


If you continue to face any issues, please share a simple, reproducible sample so we can validate the behavior further on our end.




GS Grant Symon May 7, 2026 08:18 AM UTC

Hi Vinitha,

thank you for the reply.

I'm not sure why it is being cancelled when run with my function... perhaps it's loosing focus??  Can you suggest anything that could work around the problem?

Best wishes,

Grant

(I've attached a video-grab of the problem)


Attachment: GSymonvideoGrabSyncfusionopenLink_9d59912f.zip


VJ Vinitha Jeyakumar Syncfusion Team May 8, 2026 07:14 AM UTC

Hi Grant,


We attempted to reproduce the reported issue by returning a function within the toolbarClick event to simulate a scenario similar to yours. However, we were unable to observe the issue you described. Please refer to the sample provided below for reference.

To help us validate this further on our end, could you please share the exact function code that you are handling within the toolbarClick event?




GS Grant Symon May 8, 2026 10:28 AM UTC

Hi Vinitha,

thank you for your reply.

I'm sorry to have wasted your time!!  🫣  I found the problem was an extra  "( )"  in the Filemaker function.  Sigh... I don't have html/js writing software so it's just down to visual checking and trial-and-error. I'm really sorry I missed it.  I hope you didn't waste too much of your time.


Anyway ... the good news is that your toolbarClick fix works perfectly!! 😊😎  So thank you very much for providing it.


Best wishes,


Grant



VJ Vinitha Jeyakumar Syncfusion Team May 14, 2026 11:19 AM UTC

Grant,



We are glad to assist you.


Loader.
Up arrow icon