How can we automatically size a textblock so that as we type the block expands.
Here is how we are declaring our node:
$$(go.Node, "Auto",
{
minSize: new go.Size(20, 20),
resizable: true,
rotatable: true,
locationSpot: go.Spot.Center,
click: function (e, node) {
var obj = node.findObject("TEXTBLOCK");
var diagram = node.diagram;
diagram.currentTool = diagram.toolManager.textEditingTool;
var tool = diagram.toolManager.textEditingTool;
tool.textBlock = obj;
tool.doStart();
},
},
$$(go.TextBlock,
{
name: "TEXTBLOCK",
text: "Click to edit",
stroke: "black",
editable: true,
margin: 3,
textAlign: "left",
wrap: go.TextBlock.None
},
new go.Binding("text").makeTwoWay()),
new go.Binding("location", "loc", go.Point.parse).makeTwoWay(go.Point.stringify),
new go.Binding("desiredSize", "size", go.Size.parse).makeTwoWay(go.Size.stringify),
new go.Binding("angle").makeTwoWay(),
new go.Binding("position", "pos", go.Point.parse).makeTwoWay(go.Point.stringify),