fix: Fixed issue where the Super note markdown preview modal could not be closed on mobile
This commit is contained in:
@@ -6,6 +6,7 @@ import { copyTextToClipboard } from '../../Utils/copyTextToClipboard'
|
|||||||
import Modal, { ModalAction } from '@/Components/Modal/Modal'
|
import Modal, { ModalAction } from '@/Components/Modal/Modal'
|
||||||
import { BlocksEditor } from './BlocksEditor'
|
import { BlocksEditor } from './BlocksEditor'
|
||||||
import { BlocksEditorComposer } from './BlocksEditorComposer'
|
import { BlocksEditorComposer } from './BlocksEditorComposer'
|
||||||
|
import { MutuallyExclusiveMediaQueryBreakpoints, useMediaQuery } from '@/Hooks/useMediaQuery'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
note: SNNote
|
note: SNNote
|
||||||
@@ -28,6 +29,8 @@ export const SuperNoteMarkdownPreview: FunctionComponent<Props> = ({ note, close
|
|||||||
setMarkdown(markdown)
|
setMarkdown(markdown)
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
|
const isMobileScreen = useMediaQuery(MutuallyExclusiveMediaQueryBreakpoints.sm)
|
||||||
|
|
||||||
const modalActions: ModalAction[] = useMemo(
|
const modalActions: ModalAction[] = useMemo(
|
||||||
() => [
|
() => [
|
||||||
{
|
{
|
||||||
@@ -36,8 +39,15 @@ export const SuperNoteMarkdownPreview: FunctionComponent<Props> = ({ note, close
|
|||||||
onClick: copy,
|
onClick: copy,
|
||||||
mobileSlot: 'left',
|
mobileSlot: 'left',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: 'Done',
|
||||||
|
type: 'cancel',
|
||||||
|
onClick: closeDialog,
|
||||||
|
mobileSlot: 'right',
|
||||||
|
hidden: !isMobileScreen,
|
||||||
|
},
|
||||||
],
|
],
|
||||||
[copy, didCopy],
|
[closeDialog, copy, didCopy, isMobileScreen],
|
||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user