Most of my undo/redo actions have stopped working. I've written a simple example.
aNewNoteFor successfully adds an OutlineItem to its sibling's parent's children and inserts it into the OutlineView row following its sibling.
deleteAChild: is supposed to remove the row and delete it from its parent's children.
But neither undo or redo are enabled.
- (void)aNewNoteFor:(OutlineItem*) sibling
{
//Ignore note. it's unimportant
Note* note = [self.document makeDraft:YES];
OutlineItem* newChild = [[OutlineItem alloc]initWithNote:note];
NSInteger index = [sibling.parent.children indexOfObject:sibling] +1;
[sibling.parent.children insertObject:newChild atIndex:index];
newChild.parent = sibling.parent;
[_document updateChangeCount:NSChangeDone];
[_outlineOutlet reloadData];
[_undoManager registerUndoWithTarget:self selector:@selector(deleteAChild:) object:newChild];
}
-(void)deleteAChild: (OutlineItem*)child
{
OutlineItem* parent = child.parent;
[parent.children removeObject:child];
[_outlineOutlet reloadData];
[_undoManager registerUndoWithTarget:self selector:@selector(aNewNoteFor:) object:parent];
}
''''