From d0d2ea23385cfe9559803e67f2b1241ccfc3bab3 Mon Sep 17 00:00:00 2001 From: Steffen Becker Date: Sat, 15 Aug 2026 00:12:24 +0200 Subject: [PATCH] fix: the ribbon's bare icon buttons carry their labels Layout's hyphenation, page numbers, line numbers and page decoration, and Review's accept/reject and comment pane, all passed a label that the icon variant drops. They are small buttons now, stacked two to a column so the band keeps its height, with the caret after the label as a row reads. --- src/lib/components/ribbon/RibbonButton.svelte | 8 +- .../components/ribbon/tabs/LayoutTab.svelte | 160 ++++++++++-------- .../components/ribbon/tabs/ReviewTab.svelte | 67 +++++--- 3 files changed, 127 insertions(+), 108 deletions(-) diff --git a/src/lib/components/ribbon/RibbonButton.svelte b/src/lib/components/ribbon/RibbonButton.svelte index 61d9e11..1fb5ed5 100644 --- a/src/lib/components/ribbon/RibbonButton.svelte +++ b/src/lib/components/ribbon/RibbonButton.svelte @@ -34,21 +34,19 @@ } = $props(); const ICON_SIZE = { big: 28, small: 14, icon: 20 } as const; - - // One button when the whole of it opens the menu, and the caret joins the column - // under the label. - let stackCaret = $derived(caret && !onCaret && variant === 'big'); {#snippet face(withLabel = true)} {#if content}{@render content()} {:else if icon}{/if} - {#if caret && !onCaret && !stackCaret} + {#if caret && !onCaret && variant === 'icon'} {/if} {#if withLabel && label && variant !== 'icon'}{label}{/if} + + {#if caret && !onCaret && variant === 'small'}{/if} {#if variant === 'big' && !onCaret} diff --git a/src/lib/components/ribbon/tabs/LayoutTab.svelte b/src/lib/components/ribbon/tabs/LayoutTab.svelte index 95bb3d5..daf934e 100644 --- a/src/lib/components/ribbon/tabs/LayoutTab.svelte +++ b/src/lib/components/ribbon/tabs/LayoutTab.svelte @@ -242,88 +242,94 @@ {/if} - (hyphenate = !hyphenate)} - /> - -
+
toggleMenu('pageNum')} + variant="small" + icon="hyphenation" + label={t().ribbon.hyphenation} + title={t().ribbon.hyphenationHint} + active={hyphenate} + onclick={() => (hyphenate = !hyphenate)} /> - {#if isMenuOpen('pageNum')} - + {/if} +
+
+ +
+
+ toggleMenu('lineNum')} + /> + {#if isMenuOpen('lineNum')} + + {/if}
- {/if} -
- -
toggleMenu('lineNum')} + variant="small" + icon="watermark" + label={t().ribbon.pageDecor} + title={t().pageDecor.title} + active={!!(pageDecor.background || pageDecor.border || pageDecor.watermark)} + onclick={() => (decorOpen = true)} /> - {#if isMenuOpen('lineNum')} - - {/if}
- - (decorOpen = true)} - /> @@ -379,6 +385,10 @@ .rb-menu-wrap { position: relative; } + /* Two rows of named commands beside the big ones, as the band is one big button tall. */ + .rb-col { display: flex; flex-direction: column; gap: 2px; } + .rb-col :global(.rb-small) { width: 100%; } + .col-preview { flex-shrink: 0; } .margin-menu, .format-menu, .breaks-menu { min-width: 230px; } diff --git a/src/lib/components/ribbon/tabs/ReviewTab.svelte b/src/lib/components/ribbon/tabs/ReviewTab.svelte index 437f057..b651761 100644 --- a/src/lib/components/ribbon/tabs/ReviewTab.svelte +++ b/src/lib/components/ribbon/tabs/ReviewTab.svelte @@ -91,6 +91,7 @@ onclick={() => onNewComment?.()} /> setRecordChanges(!recordChanges())} /> - editor?.chain().focus().acceptRevisions().run()} - /> - editor?.chain().focus().rejectRevisions().run()} - /> - editor?.chain().focus().acceptRevisions(true).run()} - /> - editor?.chain().focus().rejectRevisions(true).run()} - /> + +
+ editor?.chain().focus().acceptRevisions().run()} + /> + editor?.chain().focus().acceptRevisions(true).run()} + /> +
+
+ editor?.chain().focus().rejectRevisions().run()} + /> + editor?.chain().focus().rejectRevisions(true).run()} + /> +
@@ -153,6 +161,9 @@ .rb-menu-wrap { position: relative; } .stats-menu { min-width: 240px; } + .rb-col { display: flex; flex-direction: column; gap: 2px; } + .rb-col :global(.rb-small) { width: 100%; } + .stat { display: flex; justify-content: space-between;