replace undo all function with undo once using NSUndoManager.