From 9808262e9e26a9ecd3069ff342f853db5cab06a8 Mon Sep 17 00:00:00 2001 From: Aman Harwara Date: Mon, 6 Feb 2023 13:31:37 +0530 Subject: [PATCH] feat: Added search button to Super mobile toolbar --- .../MobileToolbarPlugin/MobileToolbarPlugin.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/web/src/javascripts/Components/NoteView/SuperEditor/Plugins/MobileToolbarPlugin/MobileToolbarPlugin.tsx b/packages/web/src/javascripts/Components/NoteView/SuperEditor/Plugins/MobileToolbarPlugin/MobileToolbarPlugin.tsx index 9bcf17a80..dc2c962c0 100644 --- a/packages/web/src/javascripts/Components/NoteView/SuperEditor/Plugins/MobileToolbarPlugin/MobileToolbarPlugin.tsx +++ b/packages/web/src/javascripts/Components/NoteView/SuperEditor/Plugins/MobileToolbarPlugin/MobileToolbarPlugin.tsx @@ -24,8 +24,11 @@ import { GetQuoteBlock } from '../Blocks/Quote' import { GetTableBlock } from '../Blocks/Table' import { MutuallyExclusiveMediaQueryBreakpoints, useMediaQuery } from '@/Hooks/useMediaQuery' import { classNames } from '@standardnotes/snjs' +import { SUPER_TOGGLE_SEARCH } from '@standardnotes/ui-services' +import { useApplication } from '@/Components/ApplicationProvider' const MobileToolbarPlugin = () => { + const application = useApplication() const [editor] = useLexicalComposerContext() const [modal, showModal] = useModal() @@ -107,6 +110,13 @@ const MobileToolbarPlugin = () => { iconName: 'link', onSelect: insertLink, }, + { + name: 'Search', + iconName: 'search', + onSelect: () => { + application.keyboardService.triggerCommand(SUPER_TOGGLE_SEARCH) + }, + }, GetParagraphBlock(editor), ...GetHeadingsBlocks(editor), ...GetIndentOutdentBlocks(editor), @@ -125,7 +135,7 @@ const MobileToolbarPlugin = () => { GetCollapsibleBlock(editor), ...GetEmbedsBlocks(editor), ], - [editor, insertLink, showModal], + [application.keyboardService, editor, insertLink, showModal], ) useEffect(() => {