diff --git a/src/pages/blog-marketing/BlogMarketing.jsx b/src/pages/blog-marketing/BlogMarketing.jsx index 954b931..f602d1c 100644 --- a/src/pages/blog-marketing/BlogMarketing.jsx +++ b/src/pages/blog-marketing/BlogMarketing.jsx @@ -33,6 +33,14 @@ function fmtMoney(n) { if (n == null) return '-'; return n.toLocaleString('ko-KR') + '원'; } +function copyHtmlToClipboard(html) { + const blob = new Blob([html], { type: 'text/html' }); + const plainBlob = new Blob([html.replace(/<[^>]*>/g, '')], { type: 'text/plain' }); + navigator.clipboard.write([ + new ClipboardItem({ 'text/html': blob, 'text/plain': plainBlob }), + ]).then(() => alert('본문이 클립보드에 복사되었습니다! (서식 포함)')); +} + function scoreColor(v, max = 100) { const r = v / max; if (r >= 0.6) return 'bm-score__value--high'; @@ -404,7 +412,7 @@ function WriteTab() { const handleCopy = () => { if (!post) return; - navigator.clipboard.writeText(post.body).then(() => alert('본문이 클립보드에 복사되었습니다!')); + copyHtmlToClipboard(post.body); }; const handleAddLink = async () => { @@ -609,7 +617,7 @@ function PostsTab() { }; const handleCopy = (body) => { - navigator.clipboard.writeText(body).then(() => alert('복사 완료!')); + copyHtmlToClipboard(body); }; const filters = [