import Ember from 'ember';

export default Ember.Component.extend({
  aviaryApiClient: null, // injected
  classNames: ['edit-icon'],
  image: null,
  url: null,
  imageSelector: null,
  closeOnSave: false,

  imageToEdit: function() {
    var imageNotSet = Ember.isEmpty(this.get('image'));
    var selector = this.get('imageSelector');
    return imageNotSet ? this.get('parentView').$(selector || 'img') : this.get('image');
  }.property('parentView', 'image', 'imageSelector'),

  click: function() {
    var self = this;
    var options = {
      image: this.get('imageToEdit'),
      url: this.get('url'),
      onSave: function(imageId, src) {
        self.send('onSave', imageId, src);
      }
    };

    this.aviaryApiClient.launch(options);

    return false;
  },

  actions: {
    onSave: function(imageId, src) {
      this.sendAction('onSave', imageId, src);

      var closeOnSave = this.get('closeOnSave');
      var featherEditor = this.aviaryApiClient.get('featherEditor');
      if(closeOnSave) { featherEditor.close(); }
    }
  }
});

@@ -127,16 +127,63 @@
 icon'%5D,%0A
+  classNameBindings: %5B'featherActive:active'%5D,%0A
   image:
@@ -189,16 +189,16 @@
 : null,%0A
-
   url: n
@@ -246,16 +246,40 @@
 : false,
+%0A  featherActive: false,
 %0A%0A  imag
@@ -758,16 +758,83 @@
 , src);%0A
+      %7D,%0A      onClose: function() %7B%0A        self.send('onClose');%0A
       %7D%0A
@@ -882,16 +882,53 @@
 ptions);
+%0A    this.set('featherActive', true);
 %0A%0A    re
@@ -1157,24 +1157,24 @@
 erEditor');%0A
-
       if(clo
@@ -1210,16 +1210,89 @@
 se(); %7D%0A
+    %7D,%0A    onClose: function() %7B%0A      this.set('featherActive', false);%0A
     %7D%0A  

Add 'active' class bindings for component that is added when Aviary Editor is launched and removed with Aviary's 'onClose' callback