Hi,
I have an app that is using gojs-angular components and is based on gojs-angular-basic demo (GitHub - NorthwoodsSoftware/gojs-angular-basic: Simple project demonstrating usage of our GoJS/Angular components). I want my node data to contain arrays which would specify previous and next nodes that are linked to given node.
public diagramNodeData = [
{
id: 1,
key: "1",
body: "Alpha",
prev: [],
next: [2],
},
{
id: 2,
key: "2",
body: "Beta",
prev: [1],
next: [],
},
];
The problem I have is that undo works only if I change position of node with mouse. It does not work in situations such as changing text in TextBlock
, copying nodes or dropping external objects from palette. When I remove prev
and next
arrays from objects in diagramNodeData
everything seems to work just fine. diagramNodeData
is synchronized with diagram nodes by DataSyncService
provided by gojs-angular.
Here is my node template:
dia.nodeTemplate = $(
go.Node,
"Spot",
$(
go.Panel,
"Auto",
$(go.Shape, "RoundedRectangle", { stroke: null, fill: "lightblue" }),
$(
go.TextBlock,
{ margin: 8, editable: true },
new go.Binding("text", "body").makeTwoWay()
)
),
// Ports
makePort("t", go.Spot.TopCenter),
makePort("l", go.Spot.Left),
makePort("r", go.Spot.Right),
makePort("b", go.Spot.BottomCenter)
);
Thank you in advance for your help.