mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-09-16 14:00:56 +02:00
feat: allow the hiding of default fonts
This commit is contained in:
@@ -58,6 +58,7 @@ interface FontPickerProps {
|
|||||||
onHover: (fontFamily: FontFamilyValues) => void;
|
onHover: (fontFamily: FontFamilyValues) => void;
|
||||||
onLeave: () => void;
|
onLeave: () => void;
|
||||||
onPopupChange: (open: boolean) => void;
|
onPopupChange: (open: boolean) => void;
|
||||||
|
compactMode?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const FontPicker = React.memo(
|
export const FontPicker = React.memo(
|
||||||
@@ -69,6 +70,7 @@ export const FontPicker = React.memo(
|
|||||||
onHover,
|
onHover,
|
||||||
onLeave,
|
onLeave,
|
||||||
onPopupChange,
|
onPopupChange,
|
||||||
|
compactMode = false,
|
||||||
}: FontPickerProps) => {
|
}: FontPickerProps) => {
|
||||||
const defaultFonts = useMemo(() => DEFAULT_FONTS, []);
|
const defaultFonts = useMemo(() => DEFAULT_FONTS, []);
|
||||||
const onSelectCallback = useCallback(
|
const onSelectCallback = useCallback(
|
||||||
@@ -82,15 +84,17 @@ export const FontPicker = React.memo(
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div role="dialog" aria-modal="true" className="FontPicker__container">
|
<div role="dialog" aria-modal="true" className="FontPicker__container">
|
||||||
<div className="buttonList">
|
{!compactMode && (
|
||||||
<RadioSelection<FontFamilyValues | false>
|
<div className="buttonList">
|
||||||
type="button"
|
<RadioSelection<FontFamilyValues | false>
|
||||||
options={defaultFonts}
|
type="button"
|
||||||
value={selectedFontFamily}
|
options={defaultFonts}
|
||||||
onClick={onSelectCallback}
|
value={selectedFontFamily}
|
||||||
/>
|
onClick={onSelectCallback}
|
||||||
</div>
|
/>
|
||||||
<ButtonSeparator />
|
</div>
|
||||||
|
)}
|
||||||
|
{!compactMode && <ButtonSeparator />}
|
||||||
<Popover.Root open={isOpened} onOpenChange={onPopupChange}>
|
<Popover.Root open={isOpened} onOpenChange={onPopupChange}>
|
||||||
<FontPickerTrigger selectedFontFamily={selectedFontFamily} />
|
<FontPickerTrigger selectedFontFamily={selectedFontFamily} />
|
||||||
{isOpened && (
|
{isOpened && (
|
||||||
|
Reference in New Issue
Block a user