app/views/alchemy/admin/clipboard/insert.js.erb
<% if params[:remove] -%>
$(".element-editor[data-element-id='<%= @item.id %>']").remove();
<% if @item.class.name == 'Alchemy::Element' -%>
$('#element_area .sortable-elements').sortable('refresh');
<% if @item.fixed? -%>
Alchemy.FixedElements.removeTab(<%= @item.id %>);
<% end -%>
<% end -%>
Alchemy.growl('<%= j Alchemy.t("item moved to clipboard", name: @item.class.name == "Alchemy::Element" ? @item.display_name_with_preview_text : @item.name) %>');
<% else -%>
Alchemy.growl('<%= j Alchemy.t("item copied to clipboard", name: @item.class.name == "Alchemy::Element" ? @item.display_name_with_preview_text : @item.name) %>')
<% end -%>
$('#clipboard_button alchemy-icon').attr('icon-style', 'fill');
<%# Update add nested element forms for any elements that accept ONLY this as a nested element %>
<% if @item.class == Alchemy::Element %>
if (window.location.pathname == "<%= edit_admin_page_path(@item.page.id) %>") {
<%
@item.page.draft_version.elements.expanded.select do |element|
element.definition["nestable_elements"] == [@item.name]
end.each do |element|
%>
$(".add-nested-element[data-element-id='<%= element.id %>']").replaceWith('<%= j render "alchemy/admin/elements/add_nested_element_form", element: element %>')
<% end %>
}
<% end %>