TextBox remains in edit mode if clicking outside of diagram

We are having a problem where we click an icon in our application while a go.Textbox is in edit mode, and we open a jQuery dialog. From that point forward all the input from the dialog seems to be sent to the Textbox and it virtually locks up the web browser.

Is there a way to force the TextEditTool to stop editing of a go.TextBox when the user click somewhere on the web browser outside of the GoJS diagram view port. In the forum there are several mentions of the TextEditTool exiting the edit mode if we click on an area within the diagram view away from the TextBox but I did not see anything about if you click outside of the diagram viewport.

Tested this in IE 11.

BTW in previous of GoJS ( > 1.7) we did not experience this issue.

Last Line should say
BTW: In previous versions of GoJS ( < 1.7 ) we did not experience this issue.

Thanks, this may be a bug, we’ll look into it.

Ok. Thanks for letting me know.

What version are you upgrading from? Does it not work the same in older versions, such as 1.6.4?

Version 1.6.20

That funny. I just tried your sample, and it did not work either. Not sure why that is the case.

You can test if the tool is active:

(myDiagram.currentTool instanceof go.TextEditingTool)

And manually end it:

if (myDiagram.currentTool instanceof go.TextEditingTool) {

There may be better solutions, but perhaps you should review your code to see if you already created a solution for this (maybe with our help), and that solution is for some reason no longer working with 1.7. We are very interested in any incompatibilities here so please let us know.

I implemented something like this before I posted. However I was looking for something more elegant like capturing a lost focus event for the diagram or for the textbox control. I am thinking of using something like JQuery to bind the focousout() event to the container div of the diagram. That way I can effectively build an lost focus on the entire diagram and end the textEditingTool with something like this

if (diagram)
        if (diagram.currentTool instanceof go.TextEditingTool) {

I will let you know how it works out.

That did not work well. The focusout event fired even when simply adding a new textbox because the text box became the new element of focus. Is it possible to wire the focusout event directly to the textbox upon creating the textbox. That would be ideal.

It might be easier to implement your own text editor. In version 1.7, take a look at HTMLInfo Text Editor and http://gojs.net/latest/extensions/TextEditor.js. This is basically how the built-in text editor is implemented. Perhaps you can adapt that code to get the behavior that you want.