Hi, I want to be able to only edit part from the textblock of a node, could it be posible?
for example, in the node shown in the image, I’d like to be able to change only the condition of the if:
Thank you!
Well, the obvious solution is to use three separate TextBlocks:
function init() {
var $ = go.GraphObject.make;
myDiagram =
$(go.Diagram, "myDiagramDiv",
{ "undoManager.isEnabled": true });
myDiagram.nodeTemplateMap.add("Conditional",
$(go.Node, "Auto",
{ locationSpot: go.Spot.Center },
new go.Binding("location", "loc", go.Point.parse).makeTwoWay(go.Point.stringify),
$(go.Shape, "Diamond",
{ fill: "lightgray" },
new go.Binding("figure")),
$(go.Panel, "Horizontal",
{ margin: 2 },
$(go.TextBlock, "if ("),
$(go.TextBlock,
{ editable: true },
new go.Binding("text").makeTwoWay()),
$(go.TextBlock, ")")
)
));
myDiagram.linkTemplate =
$(go.Link,
{ routing: go.Link.Orthogonal, corner: 5 },
$(go.Shape, { strokeWidth: 1.5 }),
$(go.Shape, { toArrow: "Standard" })
)
myDiagram.model = $(go.GraphLinksModel,
{
nodeDataArray: [
{ key: 1, category: "Conditional", text: "x > 3", loc: "0 0" },
]
});
}
1 Like
it worked perfectly, didn’t thought about that, thank you so much!!