From cc9141c981eaa7165699d918ec3c26fc83b6f84a Mon Sep 17 00:00:00 2001 From: Abdullah Atta Date: Wed, 24 May 2023 15:49:59 +0500 Subject: [PATCH] editor: enable preview attachment button on desktop --- .../src/extensions/attachment/component.tsx | 6 +++++- .../editor/src/toolbar/tool-definitions.ts | 2 +- packages/editor/src/toolbar/toolbar.tsx | 18 ++++++++++++------ 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/packages/editor/src/extensions/attachment/component.tsx b/packages/editor/src/extensions/attachment/component.tsx index bbf602590..75c28189f 100644 --- a/packages/editor/src/extensions/attachment/component.tsx +++ b/packages/editor/src/extensions/attachment/component.tsx @@ -87,7 +87,11 @@ export function AttachmentComponent( {selected && ( [...STATIC_TOOLBAR_GROUPS, ...tools], - [tools] - ); - const isMobile = useIsMobile(); + const toolbarTools = useMemo( + () => + isMobile + ? [...STATIC_TOOLBAR_GROUPS, ...MOBILE_ONLY_TOOLS, ...tools] + : [...STATIC_TOOLBAR_GROUPS, ...tools], + [tools, isMobile] + ); const setToolbarLocation = useToolbarStore( (store) => store.setToolbarLocation