%= form_with model: table, scope: :item, url: path, data: {
controller: "content--editor--table",
} do |form| %>
<%= render "hidden_fields", form: %>
<%= render "form_errors", form: %>
<%= form.label :heading %>
<%= form.text_field :heading %>
<%= form.label :heading_style %>
<%= form.collection_radio_buttons :heading_style, Katalyst::Content.config.heading_styles, :itself, :itself %>
<%= form.label :background %>
<%= form.select :background, Katalyst::Content.config.backgrounds %>
<%= form.label :visible %>
<%= form.check_box :visible %>
<%= form.label :content %>
<% content = sanitize_content_table(normalize_content_table(form.object, heading: false)) %>
<%= form.hidden_field :content, value: content, data: { content__editor__table_target: "input" } %>
<%= form.label :heading_rows %>
<%= form.text_field :heading_rows, type: :number, data: { action: "input->content--editor--table#update" } %>
<%= form.label :heading_columns %>
<%= form.text_field :heading_columns, type: :number, data: { action: "input->content--editor--table#update" } %>
<%= form.submit "Done" %>
<%= link_to "Discard", :back %>
<%= form.button "Update",
formaction: table.persisted? ? content_routes.table_path : content_routes.tables_path,
data: { content__editor__table_target: "update" } %>
<% end %>