TextEditor measureTemporaryTextBlock always got 0 width when original TextBlock width is zero

The measureTemporaryTextBlock return always 0 width when
original TextEditingTool.textBlock width is 0, according to it the textArea width not automatically expand to as desired width.

new go.Binding("text", "text", function(t, item) { 
  if (t == "") {
    item.desiredSize = new go.Size(0,0); // hide it 
  } else {
    item.desiredSize = new go.Size(NaN,NaN); // auto expand
}
return t; 
}).makeTwoWay(),

my binding is this, want to auto hide and auto expand.

You really shouldn’t be making side-effects that way. Isn’t it simpler and clearer to bind the desiredSize instead, using the data “text” property value as the source?

new go.Binding("desiredSize", "text", t => t ? new go.Size(NaN, NaN) : new go.Size(0, 0))

Thank you, Walter. it works!