public startEdit() {
this.history = null;
this.updateHandle = this.sketchViewModel.on('update', this.onGraphicUpdate.bind(this));
}
private onGraphicUpdate(event) {
const graphic: __esri.Graphic = event.graphics[0];
if (event.state === 'complete' || event.state === 'cancel') {
this.sketchViewModel.update([graphic], {
tool: 'reshape',
});
return;
}
}
This should work (notice that this is Typescript).
If you want to take the undo stack to the newly started update session you have to do some hacking on the sketchViewModel and save the history (not recommended):
public startEdit() {
this.updateHandle = this.sketchViewModel.on('update', this.onGraphicUpdate.bind(this));
}
private onGraphicUpdate(event) {
const graphic: __esri.Graphic = event.graphics[0];
if (event.state === 'complete') {
this.sketchViewModel.update([graphic], {
tool: 'reshape',
});
if (this.history && (this.sketchViewModel as any)._operationHandle) {
(this.sketchViewModel as any)._operationHandle.history = this.history;
}
return;
}
this.history = (this.sketchViewModel as any)._operationHandle.history;
}
(hope Esri will support this in a future release):