feat: Added search button to Super mobile toolbar

This commit is contained in:
Aman Harwara
2023-02-06 13:31:37 +05:30
parent 56ae3616e8
commit 9808262e9e

View File

@@ -24,8 +24,11 @@ import { GetQuoteBlock } from '../Blocks/Quote'
import { GetTableBlock } from '../Blocks/Table' import { GetTableBlock } from '../Blocks/Table'
import { MutuallyExclusiveMediaQueryBreakpoints, useMediaQuery } from '@/Hooks/useMediaQuery' import { MutuallyExclusiveMediaQueryBreakpoints, useMediaQuery } from '@/Hooks/useMediaQuery'
import { classNames } from '@standardnotes/snjs' import { classNames } from '@standardnotes/snjs'
import { SUPER_TOGGLE_SEARCH } from '@standardnotes/ui-services'
import { useApplication } from '@/Components/ApplicationProvider'
const MobileToolbarPlugin = () => { const MobileToolbarPlugin = () => {
const application = useApplication()
const [editor] = useLexicalComposerContext() const [editor] = useLexicalComposerContext()
const [modal, showModal] = useModal() const [modal, showModal] = useModal()
@@ -107,6 +110,13 @@ const MobileToolbarPlugin = () => {
iconName: 'link', iconName: 'link',
onSelect: insertLink, onSelect: insertLink,
}, },
{
name: 'Search',
iconName: 'search',
onSelect: () => {
application.keyboardService.triggerCommand(SUPER_TOGGLE_SEARCH)
},
},
GetParagraphBlock(editor), GetParagraphBlock(editor),
...GetHeadingsBlocks(editor), ...GetHeadingsBlocks(editor),
...GetIndentOutdentBlocks(editor), ...GetIndentOutdentBlocks(editor),
@@ -125,7 +135,7 @@ const MobileToolbarPlugin = () => {
GetCollapsibleBlock(editor), GetCollapsibleBlock(editor),
...GetEmbedsBlocks(editor), ...GetEmbedsBlocks(editor),
], ],
[editor, insertLink, showModal], [application.keyboardService, editor, insertLink, showModal],
) )
useEffect(() => { useEffect(() => {