From d7085aabde0574396e6ff3acfa11a69ddb5617ac Mon Sep 17 00:00:00 2001 From: batistalucasv Date: Sun, 22 Nov 2026 14:40:08 -0300 Subject: [PATCH] Ribbon: bind command IDs for Table Styles, Borders, Delete, and AutoFit menus (#7324) (#7328) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Ribbon: compact tile sizing for Home › Bullets library dropdown (#7323) In the Home › Bullets dropdown popup (bullets_menu), the Bullet Library grid tiles were rendered with .content_cells() without an explicit thumbnail sizing constraint, causing each bullet tile to expand to default card dimensions (~132×132 pt). Replace .content_cells() with .thumb_size(ThumbSize::Small) so the Bullet Library renders compact square bullet previews (~22×22 pt), matching pre-refactor ribbon dropdown parity. Add a regression test verifying the compact tile dimensions. * Ribbon: bind command IDs for Table Styles, Borders, Delete, and AutoFit menus (#7324) In crates/ui-egui/src/ribbon/table.rs, bind command IDs for four table ribbon menu buttons (Styles -> table.style, Borders -> table.borders, Delete -> table.deleteTable, AutoFit -> table.autofit) instead of None. In crates/ui-egui/src/ribbon/common.rs, update menu_button to apply the bound command's hint/tooltip when the command is disabled. This ensures that menu button availability, disabled states, and disabled tooltips accurately reflect engine command state and document protection rules. --------- Co-authored-by: Martin Ball --- crates/ui-egui/src/ribbon/common.rs | 15 +++--- crates/ui-egui/src/ribbon/table.rs | 38 ++++++++------ crates/ui-egui/src/ribbon/tests.rs | 81 +++++++++++++++++++++++++++++ 3 files changed, 110 insertions(+), 24 deletions(-) diff --git a/crates/ui-egui/src/ribbon/common.rs b/crates/ui-egui/src/ribbon/common.rs index 43759baac6..89cfd930be 100644 --- a/crates/ui-egui/src/ribbon/common.rs +++ b/crates/ui-egui/src/ribbon/common.rs @@ -3,7 +3,7 @@ use std::ops::RangeInclusive; use craft::keymap::CommandRef; use craft::menu::ribbon::{RibbonGroup, RibbonRow}; use craft::ui::buttons::{Arrangement, Button}; -use craft::ui::contract::{Bind, BodyCx, Gap, Props as _, Show as _, ShowContainer as _, Trigger}; +use craft::ui::contract::{Bind, BodyCx, Gap, Props as _, Show as _, ShowContainer as _, TooltipSpec, Trigger}; use craft::ui::controls::disclosure::DisclosureGlyph; use craft::ui::display::Divider; use craft::ui::layout_components::{Row, Stack}; @@ -18,11 +18,6 @@ use super::{Ui, WordApp, json}; use crate::icons; use crate::undo_marks::apply_edits; -/// Whether the command a menu is about can run now; a menu about no command is always open. -pub(super) fn about_enabled(ctx: &egui::Context, about: &str) -> bool { - about.is_empty() || craft::ui::runtime::commands::resolve(ctx, CommandRef::new(about)).enabled -} - /// The arrow after the label of a ribbon menu button: the small filled triangle of the old ribbon. pub(crate) static MENU_ARROW: DisclosureGlyph = DisclosureGlyph::new(1.0); @@ -30,12 +25,16 @@ pub(crate) static MENU_ARROW: DisclosureGlyph = DisclosureGlyph::new(1.0); /// `face` is the caller's button; `about` is that command's id, `None` for a menu about no command. pub(crate) fn menu_button( ui: &mut Ui, - face: Button<'_>, + mut face: Button<'_>, name: impl Into