Skip to content

Commit

Permalink
Fix type of icon props in RTE (#3299)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnyomair authored Jan 30, 2025
1 parent 9f9a362 commit 9006e05
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions packages/admin/admin-rte/src/core/Controls/ControlButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { createComponentSlot, ThemedComponentBaseProps } from "@comet/admin";
import { ComponentsOverrides } from "@mui/material";
import { css, Theme, useThemeProps } from "@mui/material/styles";
import { SvgIconProps } from "@mui/material/SvgIcon";
import { MouseEvent, PropsWithChildren } from "react";
import { ForwardRefExoticComponent, MouseEvent, PropsWithChildren, RefAttributes } from "react";

import getRteTheme from "../utils/getRteTheme";

Expand Down Expand Up @@ -73,10 +73,10 @@ export interface IProps
disabled?: boolean;
selected?: boolean;
onButtonClick?: (e: MouseEvent) => void;
icon?: (props: SvgIconProps) => JSX.Element | null;
icon?: ForwardRefExoticComponent<Omit<SvgIconProps, "ref"> & RefAttributes<SVGSVGElement>>;

/** @deprecated use icon instead */
Icon?: (props: SvgIconProps) => JSX.Element | null;
Icon?: ForwardRefExoticComponent<Omit<SvgIconProps, "ref"> & RefAttributes<SVGSVGElement>>;
}

export function ControlButton(inProps: PropsWithChildren<IProps>) {
Expand Down
10 changes: 5 additions & 5 deletions packages/admin/admin-rte/src/core/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SvgIconProps } from "@mui/material/SvgIcon";
import { DraftInlineStyleType, Editor, EditorState } from "draft-js";
import { ComponentType, CSSProperties, MouseEvent, ReactNode, RefObject } from "react";
import { ComponentType, CSSProperties, ForwardRefExoticComponent, MouseEvent, ReactNode, RefAttributes, RefObject } from "react";

import { IRteOptions, SupportedThings } from "./Rte";

Expand All @@ -15,7 +15,7 @@ export interface IBlocktypeConfig {
renderConfig?: DraftBlockRenderConfig; // visual appearance of the blocktype
label?: string | ReactNode; // displayed in the dropdown
group?: "dropdown" | "button"; // displays the element in the dropdown or as button
icon?: (props: SvgIconProps) => JSX.Element | null;
icon?: ForwardRefExoticComponent<Omit<SvgIconProps, "ref"> & RefAttributes<SVGSVGElement>>;
supportedBy?: SupportedThings; // blocktype is active when this "supported thing" is active
}

Expand All @@ -29,11 +29,11 @@ export interface IFeatureConfig<T extends string = string> {
disabled?: boolean;
selected?: boolean;
onButtonClick?: (e: MouseEvent) => void;
icon?: (props: SvgIconProps) => JSX.Element | null;
icon?: ForwardRefExoticComponent<Omit<SvgIconProps, "ref"> & RefAttributes<SVGSVGElement>>;
tooltipText?: ReactNode;

/** @deprecated use icon instead */
Icon?: (props: SvgIconProps) => JSX.Element | null;
Icon?: ForwardRefExoticComponent<Omit<SvgIconProps, "ref"> & RefAttributes<SVGSVGElement>>;
}

type CustomInlineStyleType = "SUP" | "SUB" | string;
Expand Down Expand Up @@ -70,7 +70,7 @@ export interface ICustomBlockTypeMap_Deprecated {
export interface CustomInlineStyles {
[name: string]: {
label: ReactNode;
icon?: (props: SvgIconProps) => JSX.Element | null;
icon?: ForwardRefExoticComponent<Omit<SvgIconProps, "ref"> & RefAttributes<SVGSVGElement>>;
tooltipText?: ReactNode;
style: CSSProperties;
};
Expand Down

0 comments on commit 9006e05

Please sign in to comment.