How to get out of focus and activate click on the same time while in text block edit mode


I have a node which holds a text block that is editable.
When clicking the node the text block is focused and is editable to enter text.
Now, right or left clicking on any other node or anywhere else will only make the text block to lose focus.
So, when the text block is in edit mode, the user will always have to click twice in order to do anything else, once to lose focus and second for the action it self.
Is it possible to make a single mouse click both cancel the editing and take affect?

Thanks, Ofir.

First, I should say, for the benefit of anyone else reading this, that you must have already set TextEditingTool.starting to go.TextEditingTool.SingleClick:

    "textEditingTool.starting": go.TextEditingTool.SingleClick

I should also clarify that clicking somewhere in the diagram outside of the text editor does not cancel the editing but commits it. Furthermore, text validation is performed ( GoJS Validation -- Northwoods Software near the bottom of the page), which may cause focus to be kept in the TextArea element.

My guess is that it might be possible to override some methods of the TextEditingTool to cause the mouse down not only to finish editing but also to start editing the other TextBlock if and only if the validation succeeded. This will require some investigation next week, not on this long holiday weekend.

Thank you for the quick reply!
Looking forward on your final conclusion

Try this:

  function ContinuedTextEditingTool() {;
    this.starting = go.TextEditingTool.SingleClick;
  go.Diagram.inherit(ContinuedTextEditingTool, go.TextEditingTool);

  ContinuedTextEditingTool.prototype.doMouseDown = function() {;
    if (!this.isActive) {

Install by replacing the standard TextEditingTool in your Diagram initialization:

          textEditingTool: new ContinuedTextEditingTool(),

Thanks walter,

but I’m guessing this will only solve the issue when clicking on another text box.
What I need is a more global solution which will do the mouse down anywhere on the diagram.

while one of the text blocks in node X is in edit:

  • if I left click another node Y it will not only commit the text block but also select node Y.
  • if I double click another node Y or same node X it will not only commit the text block but also trigger that node “ObjectDoubleClicked” event.
  • etc…

in other words any keyboard or mouse input anywhere on the diagram should just act as if the text block was not in edit mode + commit the text block text.

Thanks, Ofir.

Have you tried it yet? I think it does what you are asking for.

Thanks walter, works like a charm!