Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions demo/components/Playground.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
import {SplitModePreview} from './SplitModePreview';

const fileUploadHandler: FileUploadHandler = async (file) => {
console.info('[Playground] Uploading file: ' + file.name);

Check warning on line 46 in demo/components/Playground.tsx

View workflow job for this annotation

GitHub Actions / Verify Files

Unexpected console statement
await randomDelay(1000, 3000);
return {url: URL.createObjectURL(file)};
};
Expand All @@ -56,6 +56,7 @@
);

export type PlaygroundProps = {
mobile?: boolean;
initial?: MarkupString;
allowHTML?: boolean;
settingsVisible?: boolean | SettingItems[];
Expand Down Expand Up @@ -97,16 +98,17 @@
>;

logger.setLogger({
log: (...data) => console.log('[Deprecated logger]', ...data),

Check warning on line 101 in demo/components/Playground.tsx

View workflow job for this annotation

GitHub Actions / Verify Files

Unexpected console statement
info: (...data) => console.info('[Deprecated logger]', ...data),

Check warning on line 102 in demo/components/Playground.tsx

View workflow job for this annotation

GitHub Actions / Verify Files

Unexpected console statement
warn: (...data) => console.warn('[Deprecated logger]', ...data),

Check warning on line 103 in demo/components/Playground.tsx

View workflow job for this annotation

GitHub Actions / Verify Files

Unexpected console statement
error: (...data) => console.error('[Deprecated logger]', ...data),

Check warning on line 104 in demo/components/Playground.tsx

View workflow job for this annotation

GitHub Actions / Verify Files

Unexpected console statement
metrics: (...data) => console.info('[Deprecated logger]', ...data),

Check warning on line 105 in demo/components/Playground.tsx

View workflow job for this annotation

GitHub Actions / Verify Files

Unexpected console statement
action: (data) => console.info(`[Deprecated logger] Action: ${data.action}`, data),

Check warning on line 106 in demo/components/Playground.tsx

View workflow job for this annotation

GitHub Actions / Verify Files

Unexpected console statement
});

export const Playground = memo<PlaygroundProps>((props) => {
const {
mobile,
initial,
initialEditor,
initialSplitModeEnabled,
Expand Down Expand Up @@ -148,7 +150,7 @@
}, [mdRaw]);

const renderPreview = useCallback<RenderPreview>(
({getValue, md, directiveSyntax}) => (

Check warning on line 153 in demo/components/Playground.tsx

View workflow job for this annotation

GitHub Actions / Verify Files

'directiveSyntax' is already declared in the upper scope on line 139 column 9
<SplitModePreview
getValue={getValue}
allowHTML={md.html}
Expand All @@ -168,12 +170,13 @@
[sanitizeHtml, disabledHTMLBlockModes, disableMarkdownItAttrs],
);

const logger = useMemo(() => new Logger2().nested({env: 'playground'}), []);

Check warning on line 173 in demo/components/Playground.tsx

View workflow job for this annotation

GitHub Actions / Verify Files

'logger' is already declared in the upper scope on line 28 column 5
useLogs(logger);

const mdEditor = useMarkdownEditor(
{
logger,
mobile,
preset: 'full',
wysiwygConfig: {
placeholderOptions: placeholderOptions,
Expand Down Expand Up @@ -261,6 +264,7 @@
},
},
[
mobile,
allowHTML,
linkify,
linkifyTlds,
Expand Down Expand Up @@ -299,7 +303,7 @@
setEditorMode(mode);
}
const onToolbarAction = ({id, editorMode: type}: ToolbarActionData) => {
console.info(`The '${id}' action is performed in the ${type}-editor.`);

Check warning on line 306 in demo/components/Playground.tsx

View workflow job for this annotation

GitHub Actions / Verify Files

Unexpected console statement
};
function onChangeSplitModeEnabled({splitModeEnabled}: {splitModeEnabled: boolean}) {
props.onChangeSplitModeEnabled?.(splitModeEnabled);
Expand Down
1 change: 1 addition & 0 deletions demo/components/PlaygroundMini.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {Playground, type PlaygroundProps} from './Playground';

export type PlaygroundMiniProps = Pick<
PlaygroundProps,
| 'mobile'
| 'initialEditor'
| 'settingsVisible'
| 'breaks'
Expand Down
1 change: 1 addition & 0 deletions demo/defaults/args.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type {PlaygroundMiniProps} from '../components/PlaygroundMini';
export const args: Meta<PlaygroundMiniProps>['args'] = {
initialEditor: 'wysiwyg',
settingsVisible: true,
mobile: false,
allowHTML: true,
breaks: true,
linkify: true,
Expand Down
1 change: 1 addition & 0 deletions demo/stories/playground/Playground.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {getInitialMd} from '../../utils/getInitialMd';

export const Story: StoryObj<typeof component> = {
args: {
mobile: false,
disableMarkdownItAttrs: true,
},
};
Expand Down
28 changes: 14 additions & 14 deletions src/bundle/toolbar/ToolbarButtonWithPopupMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,20 @@ export type MenuItem = {
ignoreActive?: boolean;
};

export type ToolbarButtonWithPopupMenuProps = Omit<
ToolbarBaseProps<never> &
Pick<PopupProps, 'disablePortal'> & {
icon: ToolbarIconData;
iconClassName?: string;
chevronIconClassName?: string;
title: string | (() => string);
menuItems: MenuItem[];
/** @default 'classic' */
_selectionType?: 'classic' | 'light';
qaMenu?: string;
},
'editor'
>;
export type ToolbarButtonWithPopupMenuProps = Pick<
ToolbarBaseProps<never>,
'className' | 'focus' | 'onClick' | 'qa'
> &
Pick<PopupProps, 'disablePortal'> & {
icon: ToolbarIconData;
iconClassName?: string;
chevronIconClassName?: string;
title: string | (() => string);
menuItems: MenuItem[];
/** @default 'classic' */
_selectionType?: 'classic' | 'light';
qaMenu?: string;
};

export const ToolbarButtonWithPopupMenu: React.FC<ToolbarButtonWithPopupMenuProps> = ({
disablePortal,
Expand Down
5 changes: 4 additions & 1 deletion src/bundle/toolbar/custom/ToolbarColors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ export const ToolbarColors: React.FC<ToolbarColorsProps> = (props) => {

return (
<ToolbarButtonWithPopupMenu
{...props}
qa={props.qa}
focus={props.focus}
onClick={props.onClick}
className={props.className}
qaMenu="g-md-toolbar-menu"
title={i18n('colorify')}
menuItems={items}
Expand Down