chore: fix modal close on escape
This commit is contained in:
@@ -234,7 +234,7 @@ export const SuperEditor: FunctionComponent<Props> = ({
|
||||
</BlocksEditorComposer>
|
||||
</FilesControllerProvider>
|
||||
</LinkingControllerProvider>
|
||||
<ModalOverlay isOpen={showMarkdownPreview}>
|
||||
<ModalOverlay isOpen={showMarkdownPreview} close={closeMarkdownPreview}>
|
||||
<SuperNoteMarkdownPreview note={note.current} closeDialog={closeMarkdownPreview} />
|
||||
</ModalOverlay>
|
||||
</ErrorBoundary>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { SNNote } from '@standardnotes/snjs'
|
||||
import { FunctionComponent, useCallback, useEffect, useMemo, useState } from 'react'
|
||||
import { FunctionComponent, useCallback, useMemo, useState } from 'react'
|
||||
import { ErrorBoundary } from '@/Utils/ErrorBoundary'
|
||||
import MarkdownPreviewPlugin from './Plugins/MarkdownPreviewPlugin/MarkdownPreviewPlugin'
|
||||
import { copyTextToClipboard } from '../../Utils/copyTextToClipboard'
|
||||
@@ -7,8 +7,6 @@ import Modal, { ModalAction } from '@/Components/Modal/Modal'
|
||||
import { BlocksEditor } from './BlocksEditor'
|
||||
import { BlocksEditorComposer } from './BlocksEditorComposer'
|
||||
import { MutuallyExclusiveMediaQueryBreakpoints, useMediaQuery } from '@/Hooks/useMediaQuery'
|
||||
import { useApplication } from '../ApplicationProvider'
|
||||
import { ESCAPE_COMMAND } from '@standardnotes/ui-services'
|
||||
|
||||
type Props = {
|
||||
note: SNNote
|
||||
@@ -16,8 +14,6 @@ type Props = {
|
||||
}
|
||||
|
||||
export const SuperNoteMarkdownPreview: FunctionComponent<Props> = ({ note, closeDialog }) => {
|
||||
const application = useApplication()
|
||||
|
||||
const [markdown, setMarkdown] = useState('')
|
||||
const [didCopy, setDidCopy] = useState(false)
|
||||
|
||||
@@ -54,16 +50,6 @@ export const SuperNoteMarkdownPreview: FunctionComponent<Props> = ({ note, close
|
||||
[closeDialog, copy, didCopy, isMobileScreen],
|
||||
)
|
||||
|
||||
useEffect(() => {
|
||||
return application.keyboardService.addCommandHandler({
|
||||
command: ESCAPE_COMMAND,
|
||||
onKeyDown: () => {
|
||||
closeDialog()
|
||||
return true
|
||||
},
|
||||
})
|
||||
}, [application.keyboardService, closeDialog])
|
||||
|
||||
return (
|
||||
<Modal title="Markdown Preview" close={closeDialog} actions={modalActions}>
|
||||
<div className="relative w-full px-4 py-4">
|
||||
|
||||
Reference in New Issue
Block a user