%= form_with model: note, url: note.new_record? ? aircraft_notes_path(aircraft) : aircraft_note_path(aircraft, note), class: "card card-body space-y-4 max-w-2xl" do |f| %>
<%= f.errors_summary %>
<%= f.label :text, "Note", class: "block text-sm font-medium text-slate-700" %>
<%= f.text_area :text, rows: 8, autofocus: true, class: "input font-mono text-sm", data: { markdown_editor_target: "input" },
placeholder: "**Bold**, *italic*, - lists, - [ ] checklists, [links](https://…), | tables |" %>
<% if note.errors[:text].any? %>
<%= note.errors.full_messages_for(:text).to_sentence %>
<% end %>
Markdown works: **bold**, *italic*, # headings, lists, - [ ] checklists, links, `code` and tables.
<%= f.field :public, as: :checkbox, label: "Show on share links" %>
<%= f.submit "Save Note" %><%= link_to "Cancel", aircraft_notes_path(aircraft), class: "btn-secondary" %>
<% end %>
<% if note.persisted? %><%= delete_button "Delete note", aircraft_note_path(aircraft, note) %>
<% end %>