<% if can? :update, @comment %>
  $('#<%= dom_id(@comment) %> .content').hide();
  $('#<%= dom_id(@comment) %> [data-action~=edit]').hide();
  $('#<%= dom_id(@comment) %> .body').append("<%= j render 'form' %>");
  Mentions.init($('#<%= dom_id(@comment) %> [data-behavior~=mentionable]')[0]);

  $('[data-behavior~=rich-toolbar]', '#<%= dom_id(@comment) %>').each(function() {
    new EditorToolbar($(this));
  });

  $('[data-behavior~=local-auto-save]', '#<%= dom_id(@comment) %>').each(function() {
    new LocalAutoSave(this);
  });

  $('[data-behavior~=rich-toolbar]').on('focus', function() {
    window.lastActiveEditor = $(this).data('editorToolbar');
  });
<% end %>
