From 958315acc0f41684e511ed4755f081fe29828f73 Mon Sep 17 00:00:00 2001 From: Andy Smith Date: Tue, 26 Aug 2025 15:27:57 -0500 Subject: [PATCH] Center figure attachments and use normal size for Save Changes button --- app/assets/stylesheets/rich-text-content.css | 23 ++++++++++++++------ app/assets/stylesheets/utilities.css | 1 + app/views/cards/edit.html.erb | 2 +- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/app/assets/stylesheets/rich-text-content.css b/app/assets/stylesheets/rich-text-content.css index c758ed5e2..118d3d77e 100644 --- a/app/assets/stylesheets/rich-text-content.css +++ b/app/assets/stylesheets/rich-text-content.css @@ -21,7 +21,7 @@ :where(h6) { font-size: 0.67em; } :where(p, ul, ol, dl, blockquote, figure, .attachment) { - margin-block: var(--block-margin); + margin-block: 0 var(--block-margin); &:not(lexxy-editor &) { overflow-wrap: break-word; @@ -171,13 +171,22 @@ margin-inline: 0; max-inline-size: 100%; - &:is(figure) img, - &:is(figure) video { - block-size: auto; - display: block; + &:is(figure) { + inline-size: fit-content; margin-inline: auto; - max-inline-size: 100%; - user-select: none; + display: block; + + img, video { + block-size: auto; + display: block; + margin-inline: auto; + max-inline-size: 100%; + user-select: none; + } + + > a { + display: block; + } } :where(progress) { diff --git a/app/assets/stylesheets/utilities.css b/app/assets/stylesheets/utilities.css index 44e6a3afb..1691a36eb 100644 --- a/app/assets/stylesheets/utilities.css +++ b/app/assets/stylesheets/utilities.css @@ -79,6 +79,7 @@ .half-width { inline-size: 50%; } .max-width { max-inline-size: 100%; } .min-content { inline-size: min-content; } + .fit-content { inline-size: fit-content; } .max-inline-size { max-inline-size: 100%; } /* Overflow */ diff --git a/app/views/cards/edit.html.erb b/app/views/cards/edit.html.erb index 5775947fe..e1b2a01bb 100644 --- a/app/views/cards/edit.html.erb +++ b/app/views/cards/edit.html.erb @@ -14,7 +14,7 @@ <%= general_prompts(@card.collection) %> <% end %> - <%= form.button "Save changes", type: :submit, class: "btn btn--reversed", style: "--btn-background: #{@card.color}" %> + <%= form.button "Save changes", type: :submit, class: "btn btn--reversed fit-content", style: "--btn-background: #{@card.color}" %> <%= link_to "Close editor and discard changes", collection_card_path(@card.collection, @card), data: { form_target: "cancel" }, hidden: true %> <% end %> <% end %>