joint.all.js
function(graph, opt) {

        opt = opt || {};

        if (opt.useLocalStorage && this.length === 0 && window.localStorage) {

            this.reset(JSON.parse(localStorage.getItem('joint.ui.Clipboard.cells')));
        }

	graph.trigger('batch:start');

        this.each(function(cell) {

            cell.unset('z');
            if ((cell instanceof joint.dia.Link) && opt.link) {

                cell.set(opt.link);
            }
            
            graph.addCell(cell.toJSON());
        });

	graph.trigger('batch:stop');
    }
function(graph, opt) {

        opt = opt || {};

        if (opt.useLocalStorage && this.length === 0 && window.localStorage) {

            this.reset(JSON.parse(localStorage.getItem('joint.ui.Clipboard.cells')));
        }

	graph.trigger('batch:start');

        this.each(function(cell) {

            cell.unset('z');
            if ((cell instanceof joint.dia.Link) && opt.link) {

                cell.set(opt.link);
            }
            
            graph.addCell(cell.toJSON());
        });

	graph.trigger('batch:stop');
    }
`opt.link` is attributes that will be set all links before they are added to the `graph`. This is useful for e.g. setting `z: -1` for links in order to always put them to the bottom of the paper.