1- import { FireOutlined } from '@ant-design/icons' ;
1+ import { CopyOutlined , FireOutlined } from '@ant-design/icons' ;
22import { faStar } from '@fortawesome/free-solid-svg-icons' ;
33import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' ;
4- import { Button , Col , Divider , Grid , Input , Modal , Row , Tooltip , Typography } from 'antd' ;
4+ import { Button , Col , Divider , Grid , Input , message , Modal , Row , Tooltip , Typography } from 'antd' ;
55import marked from 'marked' ;
66import React , { MutableRefObject , useContext , useState } from 'react' ;
7+ import { CopyToClipboard } from 'react-copy-to-clipboard' ;
78import { generateSectionTitleMarkdown } from '../components/Section' ;
89import { FIELD_TYPES } from '../config/global' ;
910import { globalContext } from '../context/GlobalContextProvider' ;
@@ -120,6 +121,10 @@ export const Preview = ({ scrollRef }: { scrollRef: MutableRefObject<any> }) =>
120121 ) ;
121122 } ;
122123
124+ const showCopiedSuccessfullyMessage = ( ) => {
125+ message . success ( 'Markdown has been copied to your clipboard.' ) ;
126+ } ;
127+
123128 return (
124129 < div ref = { scrollRef } >
125130 < Row justify = "space-between" >
@@ -141,10 +146,21 @@ export const Preview = ({ scrollRef }: { scrollRef: MutableRefObject<any> }) =>
141146 dangerouslySetInnerHTML = { { __html : generateMarkdown ( ) . html } }
142147 />
143148 < Modal
144- title = "Generated Markdown"
149+ title = {
150+ < >
151+ Generated Markdowns{ ' ' }
152+ < CopyToClipboard
153+ text = { generateAdvertisedMarkdown ( generateMarkdown ( ) . markdown ) }
154+ onCopy = { showCopiedSuccessfullyMessage }
155+ >
156+ < Button type = "primary" ghost >
157+ < CopyOutlined /> Copy
158+ </ Button >
159+ </ CopyToClipboard >
160+ </ >
161+ }
145162 width = "70vw"
146163 visible = { showMarkdown }
147- onCancel = { toggleShowMarkdown }
148164 onOk = { toggleShowMarkdown }
149165 >
150166 < h3
0 commit comments