Skip to content

Commit 93a97b6

Browse files
authored
fix(bundle): dont pass invalid props to dom in ToolbarColors component (#836)
1 parent 53cc46f commit 93a97b6

File tree

6 files changed

+25
-15
lines changed

6 files changed

+25
-15
lines changed

demo/components/Playground.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ const wCommandMenuConfig = wysiwygToolbarConfigs.wCommandMenuConfig.concat(
5656
);
5757

5858
export type PlaygroundProps = {
59+
mobile?: boolean;
5960
initial?: MarkupString;
6061
allowHTML?: boolean;
6162
settingsVisible?: boolean | SettingItems[];
@@ -107,6 +108,7 @@ logger.setLogger({
107108

108109
export const Playground = memo<PlaygroundProps>((props) => {
109110
const {
111+
mobile,
110112
initial,
111113
initialEditor,
112114
initialSplitModeEnabled,
@@ -174,6 +176,7 @@ export const Playground = memo<PlaygroundProps>((props) => {
174176
const mdEditor = useMarkdownEditor(
175177
{
176178
logger,
179+
mobile,
177180
preset: 'full',
178181
wysiwygConfig: {
179182
placeholderOptions: placeholderOptions,
@@ -261,6 +264,7 @@ export const Playground = memo<PlaygroundProps>((props) => {
261264
},
262265
},
263266
[
267+
mobile,
264268
allowHTML,
265269
linkify,
266270
linkifyTlds,

demo/components/PlaygroundMini.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {Playground, type PlaygroundProps} from './Playground';
66

77
export type PlaygroundMiniProps = Pick<
88
PlaygroundProps,
9+
| 'mobile'
910
| 'initialEditor'
1011
| 'settingsVisible'
1112
| 'breaks'

demo/defaults/args.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type {PlaygroundMiniProps} from '../components/PlaygroundMini';
55
export const args: Meta<PlaygroundMiniProps>['args'] = {
66
initialEditor: 'wysiwyg',
77
settingsVisible: true,
8+
mobile: false,
89
allowHTML: true,
910
breaks: true,
1011
linkify: true,

demo/stories/playground/Playground.stories.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {getInitialMd} from '../../utils/getInitialMd';
66

77
export const Story: StoryObj<typeof component> = {
88
args: {
9+
mobile: false,
910
disableMarkdownItAttrs: true,
1011
},
1112
};

src/bundle/toolbar/ToolbarButtonWithPopupMenu.tsx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,20 @@ export type MenuItem = {
3131
ignoreActive?: boolean;
3232
};
3333

34-
export type ToolbarButtonWithPopupMenuProps = Omit<
35-
ToolbarBaseProps<never> &
36-
Pick<PopupProps, 'disablePortal'> & {
37-
icon: ToolbarIconData;
38-
iconClassName?: string;
39-
chevronIconClassName?: string;
40-
title: string | (() => string);
41-
menuItems: MenuItem[];
42-
/** @default 'classic' */
43-
_selectionType?: 'classic' | 'light';
44-
qaMenu?: string;
45-
},
46-
'editor'
47-
>;
34+
export type ToolbarButtonWithPopupMenuProps = Pick<
35+
ToolbarBaseProps<never>,
36+
'className' | 'focus' | 'onClick' | 'qa'
37+
> &
38+
Pick<PopupProps, 'disablePortal'> & {
39+
icon: ToolbarIconData;
40+
iconClassName?: string;
41+
chevronIconClassName?: string;
42+
title: string | (() => string);
43+
menuItems: MenuItem[];
44+
/** @default 'classic' */
45+
_selectionType?: 'classic' | 'light';
46+
qaMenu?: string;
47+
};
4848

4949
export const ToolbarButtonWithPopupMenu: React.FC<ToolbarButtonWithPopupMenuProps> = ({
5050
disablePortal,

src/bundle/toolbar/custom/ToolbarColors.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,10 @@ export const ToolbarColors: React.FC<ToolbarColorsProps> = (props) => {
7676

7777
return (
7878
<ToolbarButtonWithPopupMenu
79-
{...props}
79+
qa={props.qa}
80+
focus={props.focus}
81+
onClick={props.onClick}
82+
className={props.className}
8083
qaMenu="g-md-toolbar-menu"
8184
title={i18n('colorify')}
8285
menuItems={items}

0 commit comments

Comments
 (0)