fix(blog-marketing): 본문 복사 시 HTML 서식 유지
writeText 대신 clipboard.write로 text/html MIME 타입 복사하여 네이버 블로그 에디터에 붙여넣기 시 서식이 유지되도록 개선. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -33,6 +33,14 @@ function fmtMoney(n) {
|
|||||||
if (n == null) return '-';
|
if (n == null) return '-';
|
||||||
return n.toLocaleString('ko-KR') + '원';
|
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) {
|
function scoreColor(v, max = 100) {
|
||||||
const r = v / max;
|
const r = v / max;
|
||||||
if (r >= 0.6) return 'bm-score__value--high';
|
if (r >= 0.6) return 'bm-score__value--high';
|
||||||
@@ -404,7 +412,7 @@ function WriteTab() {
|
|||||||
|
|
||||||
const handleCopy = () => {
|
const handleCopy = () => {
|
||||||
if (!post) return;
|
if (!post) return;
|
||||||
navigator.clipboard.writeText(post.body).then(() => alert('본문이 클립보드에 복사되었습니다!'));
|
copyHtmlToClipboard(post.body);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleAddLink = async () => {
|
const handleAddLink = async () => {
|
||||||
@@ -609,7 +617,7 @@ function PostsTab() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleCopy = (body) => {
|
const handleCopy = (body) => {
|
||||||
navigator.clipboard.writeText(body).then(() => alert('복사 완료!'));
|
copyHtmlToClipboard(body);
|
||||||
};
|
};
|
||||||
|
|
||||||
const filters = [
|
const filters = [
|
||||||
|
|||||||
Reference in New Issue
Block a user