CommandButtonItem.size is defined in schema but ignored by prebuilt toolbar renderer
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- Mezza giornata
- Idoneità per principianti
- 70/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- react, typescript
- Ambito
- frontend
Direzione di ricerca
Start in the toolbar item renderer where a command-button item is turned into a CommandButton element; the payload's bundled snippet passes commandId, documentId, itemId and variant but drops item.size. Then read the CommandButton props type and the icon className line that hardcodes "h-5 w-5". Done means item.size flows through to CommandButton and the button and icon classes change for sm, md and lg, verified by rendering a command-button with size 'lg'.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Description
CommandButtonItem.size is exposed in the public UI schema type, but the prebuilt toolbar renderer does not pass item.size to the command button component. As a result, setting size: 'sm' | 'md' | 'lg' on a command-button toolbar item has no visual effect.
The icon size is also hardcoded as h-5 w-5, so toolbar icons cannot be resized through the documented schema.
Version
@embedpdf/react-pdf-viewer: 2.15.1
@embedpdf/snippet: 2.15.1
Expected behavior
Given this toolbar item:
{
type: 'command-button',
id: 'print-button',
commandId: 'custom.print',
variant: 'icon',
size: 'lg',
}
the rendered button/icon should use the large size.
Actual behavior
The rendered SVG keeps h-5 w-5.
Evidence
The schema supports size:
export interface CommandButtonItem {
type: 'command-button';
id: string;
commandId: string;
variant?: 'icon' | 'text' | 'icon-text' | 'tab';
size?: 'sm' | 'md' | 'lg';
}
But the rendered command button props do not include size:
type CommandButtonProps = {
commandId: string;
documentId: string;
variant?: 'icon' | 'text' | 'icon-text' | 'tab';
itemId?: string;
className?: string;
};
And the bundled renderer drops item.size:
j(ax, {
commandId: t.commandId,
documentId: n,
itemId: t.id,
variant: t.variant
})
The icon is hardcoded:
className: pb("h-5 w-5", c.className)
Suggested fix
Pass item.size from the toolbar item renderer into CommandButton, then map the size to button/icon classes.
Pseudo-code:
<CommandButton
commandId={item.commandId}
documentId={documentId}
itemId={item.id}
variant={item.variant}
size={item.size}
/>
Then:
type CommandButtonSize = 'sm' | 'md' | 'lg';
const buttonSizeClass: Record<CommandButtonSize, string> = {
sm: 'p-1',
md: 'p-1.5',
lg: 'p-2',
};
const iconSizeClass: Record<CommandButtonSize, string> = {
sm: 'h-4 w-4',
md: 'h-5 w-5',
lg: 'h-8 w-8',
};
Use the mapped classes instead of hardcoded h-5 w-5.
Reproduction
- Register a custom command.
- Add it to the toolbar schema as a command-button.
- Set size: 'lg'.
- Observe that the rendered icon remains h-5 w-5.
- Lingua principale
- TypeScript
- Stelle
- 4.5k
- Fork
- 317
- Merge medio
- 10h 16m
- PR unite (30g)
- 174
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di embedpdf/embed-pdf-viewer
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
embedpdf/embed-pdf-viewer#1098 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
embedpdf/embed-pdf-viewer#921 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
embedpdf/embed-pdf-viewer#889 ·
I maintainer di solito rispondono entro 1 giorno
-
[v2] TaskQueue: equal-priority tasks can run out of order when a randomUUID id starts with digitsAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
embedpdf/embed-pdf-viewer#874 ·
I maintainer di solito rispondono entro 1 giorno
-
Free text stays scrolled to the caret after editing endsForse già presa @chahore l’ha presa 36 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
embedpdf/embed-pdf-viewer#861 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di embedpdf/embed-pdf-viewer
Issue simili
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
lingdojo/kana-dojo#34223 · 1 commento · 5 reazioni ·
I maintainer di solito rispondono entro 1 giorno
-
bug status: needs triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
mastra-ai/mastra#30587 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
area:web p2 product:business triage:active type:bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
cuadrao-ai/argus#2228 ·
I maintainer di solito rispondono entro 1 giorno
-
.Needs Triage .Team/Metabot Priority:P3 Type:Bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
metabase/metabase#87252 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
NuGet registry builds every URL from ROOT_URL, ignoring the host the client usedForse già presa @gritse l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno