code: function(data) {
  
          data || (data = {});
  
          var model = data.model || this.model;
          var paper = data.paper || this.paper;
          var graph = paper.model;
  
          model.startBatch('to-front');
  
          // Bring the model to the front with all his embeds.
          model.toFront({ deep: true, ui: true });
  
          // Note that at this point cells in the collection are not sorted by z index (it's running in the batch, see
          // the dia.Graph._sortOnChangeZ), so we can't assume that the last cell in the collection has the highest z.
          var maxZ = graph.getElements().reduce(function(max, cell) {
              return Math.max(max, cell.attributes.z || 0);
          }, 0);
  
          // Move to front also all the inbound and outbound links that are connected
          // to any of the element descendant. If we bring to front only embedded elements,
          // links connected to them would stay in the background.
          var connectedLinks = graph.getConnectedLinks(model, { deep: true, includeEnclosed: true });
          connectedLinks.forEach(function(link) {
              if (link.attributes.z <= maxZ) link.set('z', maxZ + 1, { ui: true });
          });
  
          model.stopBatch('to-front');
  
          // Before we start looking for suitable parent we remove the current one.
          var parentId = model.parent();
          if (parentId) {
              graph.getCell(parentId).unembed(model, { ui: true });
          }
      }
docs: Embedding mode methods. -----------------------