基于示例http://gojs.net/latest/samples/flowchart.html,我创建了如下所示的自定义节点模板。
myDiagram.nodeTemplateMap.add("Action-node",
$(go.Node, "Spot", nodeStyle(),
$(go.Panel, "Auto",
$(go.Shape, "Rectangle",
{ minSize: new go.Size(40, 40), fill: "#FF9191", stroke: null }),
$(go.Panel, "Vertical",
$(go.TextBlock, "Start",
{
font: "8pt Helvetica, Arial, sans-serif",
margin: 8,
stroke: lightText,
editable: true
},
new go.Binding("text")),
$(go.TextBlock, "...",
{
font: "8pt Helvetica, Arial, sans-serif",
margin: 8,
stroke: lightText,
editable: true
},
new go.Binding("text", "subtitle"))
)
),
// three named ports, one on each side except the top, all output only:
makePort("T", go.Spot.Top, false, true),
makePort("L", go.Spot.Left, true, false),
makePort("R", go.Spot.Right, true, false),
makePort("B", go.Spot.Bottom, true, false)
));
问题是调用的保存按钮(save() 函数)
myDiagram.model.toJson();
仅将默认值保存到 json 字符串。位置和链接等其他内容已正确保存。我的自定义模板是否有问题,或者如何保存对图中节点值的更改?