How to re-implement event callback for clicking outside of custom text editor

I implemented custom text editor for particular node.
It opens a (bootstrap) dialog and the dialog has ‘cancel’, ‘save’ buttons.
Gojs update node text that I modified in the custom text editor when I click outside of the dialog.
I want to block this implementation and cancel the modification in this case.
But it seems that gojs doesn’t supply any callback or interface for this.

Please help me!

If you look at how the default text editor is defined, in https://gojs.net/latest/extensions/TextEditor.js, you will see its definition of a “blur” listener.

walter, thank you for your answer.
‘blur’ event for the textarea is works well.

But it’s been catched even cancel, save button click on the bs dialog.
I want to catch the click on outside of the dialog only.

Finally, I want to prevent the mistake that some users discard changes in the custom text editor by clicking outside of the dialog or pressing ‘ESC’ key.

You should be able to detect whether the click is inside your dialog HTML or not.

Look at that implementation again to see how its “keydown” listener handles the “Escape” key and “Tab” key.

I think gojs has some conflict with CodeMirror module from ‘https://codemirror.net’.
I’m using CodeMirror module in the dialog body for show and edit text instead textarea.
More specifically, codemirror uses (static) textarea on its constructor and I implemented show(), hide() on codemirror instance.
In this case, the listeners of textarea are NOT working.
I have to set the listeners to codemirror instance.

Have you ever seen like this case?

I had never even heard of CodeMirror before.

It works fine now.
I cannot explain how I solve this problem well.
It’s a little complicated cuz it made by the combination of gojs and CodeMirror.
It looks a kind of trick that is not obey gojs architecture of my solution.
Thank you, walter.