var types = require('../../components/basic-element/basic-element.jsx').types;
var api = require('../../lib/api');
var reportError = require('../../lib/errors');
var dispatcher = require('../../lib/dispatcher');

module.exports = {
  componentDidMount: function () {
    // Handle button actions
    dispatcher.on('linkClicked', (event) => {
      if (event.targetPageId && this.state.isPageZoomed) {
        this.zoomToPage( this.pageIdToCoords(event.targetPageId) );
      } else {
        this.highlightPage(event.targetPageId, 'selected');
      }
    });
  },

  setDestination: function () {
    var patchedState = this.state.routeData.linkState;

    patchedState = types.link.spec.expand(patchedState);

    // Patch old attributes object to prevent overwritten properties
    patchedState.attributes.targetPageId = this.state.selectedEl;
    patchedState.attributes.targetProjectId = this.state.params.project;
    patchedState.attributes.targetUserId = this.state.params.user;

    this.setState({loading: true});
    api({
      method: 'patch',
      uri: `/users/${this.state.routeData.userID}/projects/${this.state.routeData.projectID}/pages/${this.state.routeData.pageID}/elements/${this.state.routeData.elementID}`,
      json: {
        attributes: patchedState.attributes
      }
    }, (err, data) => {
      this.setState({loading: false});
      if (err) {
        reportError('There was an error updating the element', err);
      }

      if (window.Platform) {
        window.Platform.goBack();
      }
    });
  }
};

@@ -347,24 +347,30 @@
   if (event.
+props.
 targetPageId
@@ -447,24 +447,30 @@
 oords(event.
+props.
 targetPageId
@@ -522,16 +522,22 @@
 e(event.
+props.
 targetPa

Fix link breakage. Fixes #274.