 
 {Actions}  = require('../smc-react')
 
+# Used for copy/paste.  We make a single global clipboard, so that
+# copy/paste between different notebooks works.
+global_clipboard = undefined
 
 ###
 The actions -- what you can do with a jupyter notebook, and also the

    # Copy all currently selected cells into our internal clipboard
    copy_selected_cells: =>
        cells = @store.get('cells')
        clipboard = immutable.List()
        for id in @store.get_selected_cell_ids_list()
            clipboard = clipboard.push(cells.get(id))
        @setState(clipboard: clipboard)
        return

    # Cut currently selected cells, putting them in internal clipboard

        else
            before_pos = cells.getIn([cell_before_pasted_id, 'pos'])
            after_pos  = cells.getIn([@store.get_cell_id(+1, cell_before_pasted_id), 'pos'])
        positions = @_positions_between(before_pos, after_pos, global_clipboard.size)
        global_clipboard.forEach (cell, i) =>
            cell = cell.set('id', @_new_id())   # randomize the id of the cell
            cell = cell.set('pos', positions[i])
            @_set(cell, false)
