diff options
Diffstat (limited to 'components')
-rw-r--r-- | components/contextmenu.tsx | 3 | ||||
-rw-r--r-- | components/preview.tsx | 20 |
2 files changed, 23 insertions, 0 deletions
diff --git a/components/contextmenu.tsx b/components/contextmenu.tsx index 755bd9d..39b1895 100644 --- a/components/contextmenu.tsx +++ b/components/contextmenu.tsx @@ -55,6 +55,7 @@ export default interface ContextMenuProps { scope: { nodeIds: string[] } deleteNodeInEmacs: (node: OrgRoamNode) => void createNodeInEmacs: (node: OrgRoamNode) => void + getOrgText: any } export const ContextMenu = (props: ContextMenuProps) => { @@ -69,6 +70,7 @@ export const ContextMenu = (props: ContextMenuProps) => { openNodeInEmacs, deleteNodeInEmacs, createNodeInEmacs, + getOrgText, } = props const { isOpen, onOpen, onClose } = useDisclosure() const copyRef = useRef<any>() @@ -157,6 +159,7 @@ export const ContextMenu = (props: ContextMenuProps) => { Permenantly delete note </MenuItem> )} + <MenuItem onClick={() => getOrgText(node)}>Preview</MenuItem> </MenuList> </Menu> </Box> diff --git a/components/preview.tsx b/components/preview.tsx new file mode 100644 index 0000000..8d3a1ca --- /dev/null +++ b/components/preview.tsx @@ -0,0 +1,20 @@ +import { Box, Heading } from '@chakra-ui/react' +import React from 'react' +import UniOrg from '../util/uniorg' +import getOrgText from '../util/getOrgText' + +export interface PreviewProps { + id: string + title: string +} +export const Preview = (props: PreviewProps) => { + const { id, title } = props + const text = getOrgText(id) + + return ( + <Box> + <Heading>{title}</Heading> + <UniOrg orgText={text} /> + </Box> + ) +} |