feat(outreach): 설정 화면 세로 2단(메일 | DM) + 메일 본문 서식 편집기, {이름} 빨강 굵게
- 설정 = 왼쪽 메일(제목·(광고)·보내는 이름·본문 편집기·끝 문구·사진), 오른쪽 인스타 DM, 위 저장 막대
- 메일 본문 = Quill 2.0.3 편집기(글자 크기·굵게·기울임·밑줄·취소선·색·배경·정렬·목록·링크·서식 지우기·되돌리기),
vendor/quill 에 자체 호스팅
- 본문 HTML 저장(fmt=html) — 서버 sanitize_html 로 허용 태그·스타일만, 예전 글은 text_to_html 로 자동 변환
- {이름} 은 두 편집기에서 빨강 굵게(화면에서만, 메일에는 남지 않음), 글자마다 서식이 달라도 이름으로 바꿈
- DM 편집기: 서식 없음, 글자 수, [메일 본문 글 가져오기]
- 테스트: 정리기·예전 글 변환·웹 흐름, 설정 화면 브라우저 테스트 추가
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+40
-5
@@ -65,12 +65,47 @@
|
||||
.otr-set-card { display: flex; flex-direction: column; gap: 10px; }
|
||||
.otr-field { display: flex; flex-direction: column; gap: 4px; }
|
||||
.otr-field .erp-input { width: 100%; min-width: 0; box-sizing: border-box; }
|
||||
.otr-body { font-size: 14px; line-height: 1.6; resize: vertical; }
|
||||
.otr-tpl-sub { margin: 10px 0 0; padding-top: 14px; border-top: 1px solid var(--color-subtle-ash, #e5e5e5); }
|
||||
.otr-count { align-self: flex-end; font-size: 12px; }
|
||||
.otr-count.is-over { color: #c0392b; }
|
||||
.otr-count { font-size: 12px; }
|
||||
.otr-count.is-over { color: #c22b10; font-weight: 700; }
|
||||
.otr-check { display: flex; align-items: baseline; gap: 6px; font-size: 13px; }
|
||||
.otr-set-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
|
||||
/* 설정 — 위 저장 막대(스크롤해도 보임) + 세로 2단(왼쪽 메일 | 오른쪽 DM), 좁으면 위아래 */
|
||||
.otr-set-bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0;
|
||||
padding: 10px 14px; background: #fff; border: 1px solid #e3e5e8; border-radius: 10px; box-shadow: 0 2px 8px rgba(15, 23, 42, .06); }
|
||||
.otr-set-saved { font-size: 12px; }
|
||||
.otr-set-bar-gap { flex: 1; }
|
||||
.otr-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
|
||||
.otr-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
|
||||
.otr-col-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 15px; padding-bottom: 10px; border-bottom: 1px solid #eef0f2; }
|
||||
.otr-col-head .erp-muted { font-size: 12px; }
|
||||
.otr-dm-card { position: sticky; top: 72px; }
|
||||
.otr-note { margin: 0; font-size: 12.5px; line-height: 1.6; }
|
||||
.otr-dm-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
|
||||
.otr-tag { color: #e11d48; font-weight: 700; }
|
||||
@media (max-width: 1100px) {
|
||||
.otr-split { grid-template-columns: minmax(0, 1fr); }
|
||||
.otr-dm-card { position: static; }
|
||||
}
|
||||
/* 편집기(Quill snow) — 메일과 같은 글꼴·크기·줄 간격, {이름} 빨강 굵게(화면에서만) */
|
||||
.otr-settings .ql-toolbar.ql-snow { border-color: #d8dce2; border-radius: 8px 8px 0 0; background: #fafbfc; font-family: inherit; }
|
||||
.otr-settings .ql-toolbar.ql-snow .ql-formats { margin-right: 8px; }
|
||||
.otr-editor.ql-container.ql-snow { border-color: #d8dce2; border-radius: 0 0 8px 8px; font-family: Pretendard, 'Malgun Gothic', sans-serif; font-size: 14px; }
|
||||
.otr-editor-plain.ql-container.ql-snow { border-top: 1px solid #d8dce2; border-radius: 8px; }
|
||||
.otr-editor .ql-editor { min-height: 420px; max-height: 68vh; overflow-y: auto; line-height: 1.7; color: #111; }
|
||||
.otr-editor-plain .ql-editor { min-height: 320px; }
|
||||
.otr-editor .ql-editor.ql-blank::before { font-style: normal; color: #9aa1aa; }
|
||||
.otr-editor .otr-nametag-on { color: #e11d48 !important; font-weight: 700 !important; }
|
||||
.otr-settings .ql-snow .ql-picker.ql-size { width: 76px; }
|
||||
.otr-settings .ql-snow .ql-picker.ql-size .ql-picker-label::before,
|
||||
.otr-settings .ql-snow .ql-picker.ql-size .ql-picker-item::before { content: "기본"; }
|
||||
.otr-settings .ql-snow .ql-picker.ql-size .ql-picker-label[data-value]::before,
|
||||
.otr-settings .ql-snow .ql-picker.ql-size .ql-picker-item[data-value]::before { content: attr(data-value); }
|
||||
.otr-settings .ql-toolbar .ql-undo, .otr-settings .ql-toolbar .ql-redo { font-size: 17px; line-height: 1; color: #444; }
|
||||
.otr-settings .ql-snow .ql-tooltip { z-index: 5; }
|
||||
.otr-settings .ql-snow .ql-tooltip::before { content: "링크:"; }
|
||||
.otr-settings .ql-snow .ql-tooltip[data-mode=link]::before { content: "링크 주소:"; }
|
||||
.otr-settings .ql-snow .ql-tooltip a.ql-action::after { content: "고치기"; }
|
||||
.otr-settings .ql-snow .ql-tooltip a.ql-remove::before { content: "빼기"; }
|
||||
.otr-settings .ql-snow .ql-tooltip.ql-editing a.ql-action::after { content: "저장"; }
|
||||
.otr-images { display: flex; gap: 12px; flex-wrap: wrap; }
|
||||
.otr-image { margin: 0; width: 200px; border: 1px solid #e3e5e8; border-radius: 8px; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
|
||||
.otr-image img { width: 100%; height: 150px; object-fit: cover; border-radius: 6px; background: #f6f7f9; }
|
||||
|
||||
+127
-23
@@ -1,7 +1,7 @@
|
||||
/* 안내문 발송(2026-10-27) — 리스트 화면: 붙여 넣기 → 미리보기(메일/DM/오류) → 추가, 걸러 보기, 이름 고치기,
|
||||
메일 = 고른 줄 [고른 메일 보내기](서버가 본인 Gmail 로 한 통씩, 보내는 동안 2초마다 다시 읽음),
|
||||
DM = [DM 보내기](그 사람 이름이 들어간 문구를 클립보드에 + ig.me DM 창을 새 탭) → [보냄].
|
||||
설정 화면 = [기본 문구로 되돌리기], DM 문구 글자 수. */
|
||||
설정 화면 = 세로 2단(메일 | DM) — 메일 본문 서식 편집기·DM 편집기(Quill), {이름} 빨강 굵게, [기본 문구로 되돌리기], DM 글자 수. */
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
@@ -39,31 +39,135 @@
|
||||
}
|
||||
|
||||
// ── 설정 화면 ──
|
||||
const defBtn = document.getElementById("otr-default");
|
||||
if (defBtn) {
|
||||
defBtn.addEventListener("click", function () {
|
||||
let d = {};
|
||||
try { d = JSON.parse(document.getElementById("otr-default-data").textContent); } catch (_) { d = {}; }
|
||||
if (!confirm("제목·본문·보내는 이름·끝 문구·DM 문구를 기본 문구로 바꿀까요? ([저장]을 눌러야 적용)")) return;
|
||||
const f = document.getElementById("otr-set-form");
|
||||
f.subject.value = d.subject || "";
|
||||
f.body.value = d.body || "";
|
||||
f.sender_name.value = d.sender_name || "";
|
||||
f.footer.value = d.footer || "";
|
||||
f.dm_body.value = d.dm_body || "";
|
||||
f.ad_label.checked = !!d.ad_label;
|
||||
const setForm = document.getElementById("otr-set-form");
|
||||
if (setForm) {
|
||||
if (window.Quill) initSettings(window.Quill, setForm);
|
||||
else toast("편집기를 불러오지 못했습니다 — 새로 고침해 주세요.", true);
|
||||
}
|
||||
|
||||
// 메일 본문 = 서식 편집기(글자 크기·굵게·기울임·밑줄·취소선·글자/배경 색·정렬·목록·링크·서식 지우기·되돌리기),
|
||||
// DM = 서식 없는 편집기. 두 편집기 모두 {이름} = 빨강 굵게(class 만 — 저장하면 서버가 class 를 지워 메일에는 안 남음).
|
||||
// 저장 = 메일 본문 getSemanticHTML() → body(fmt=html, 서버가 허용 태그만 남김), DM getText() → dm_body.
|
||||
function initSettings(Quill, form) {
|
||||
const TAG = "{이름}";
|
||||
const SIZES = ["12px", "16px", "18px", "20px", "24px", "30px"]; // 없음(false) = 기본 14px
|
||||
const Parchment = Quill.import("parchment");
|
||||
Quill.register(new Parchment.ClassAttributor("nametag", "otr-nametag", { scope: Parchment.Scope.INLINE }), true);
|
||||
const Size = Quill.import("attributors/style/size");
|
||||
Size.whitelist = SIZES;
|
||||
Quill.register(Size, true);
|
||||
Quill.register(Quill.import("attributors/style/align"), true);
|
||||
|
||||
function readJson(id) {
|
||||
try { return JSON.parse(document.getElementById(id).textContent) || {}; } catch (_) { return {}; }
|
||||
}
|
||||
const mail = new Quill("#otr-body-editor", {
|
||||
theme: "snow", placeholder: "메일 본문",
|
||||
modules: {
|
||||
history: { userOnly: true },
|
||||
toolbar: {
|
||||
container: [
|
||||
[{ size: [false].concat(SIZES) }],
|
||||
["bold", "italic", "underline", "strike"],
|
||||
[{ color: [] }, { background: [] }],
|
||||
[{ align: [] }],
|
||||
[{ list: "ordered" }, { list: "bullet" }],
|
||||
["link", "clean"],
|
||||
["undo", "redo"],
|
||||
],
|
||||
handlers: { undo: function () { mail.history.undo(); }, redo: function () { mail.history.redo(); } },
|
||||
},
|
||||
},
|
||||
});
|
||||
const dmEl = document.getElementById("otr-dm-editor");
|
||||
const dm = new Quill(dmEl, { theme: "snow", placeholder: dmEl.dataset.placeholder || "",
|
||||
formats: ["nametag"], modules: { toolbar: false, history: { userOnly: true } } });
|
||||
|
||||
// 도구 막대 — 되돌리기 아이콘, 한글 도움말
|
||||
const tb = mail.getModule("toolbar").container;
|
||||
tb.querySelector(".ql-undo").innerHTML = "↶";
|
||||
tb.querySelector(".ql-redo").innerHTML = "↷";
|
||||
const tips = { ".ql-size": "글자 크기", ".ql-bold": "굵게 (Ctrl+B)", ".ql-italic": "기울임 (Ctrl+I)", ".ql-underline": "밑줄 (Ctrl+U)",
|
||||
".ql-strike": "취소선", ".ql-color": "글자 색", ".ql-background": "배경 색", ".ql-align": "정렬",
|
||||
'.ql-list[value="ordered"]': "번호 목록", '.ql-list[value="bullet"]': "글머리 목록", ".ql-link": "링크",
|
||||
".ql-clean": "서식 지우기", ".ql-undo": "되돌리기 (Ctrl+Z)", ".ql-redo": "다시 하기 (Ctrl+Y)" };
|
||||
Object.keys(tips).forEach(function (sel) { tb.querySelectorAll(sel).forEach(function (el) { el.title = tips[sel]; }); });
|
||||
|
||||
// {이름} 빨강 굵게 — 지금 칠한 곳과 있어야 할 곳이 다를 때만 고친다(글자 칠 때마다 DOM 을 건드리지 않게, 한글 조합 중엔 쉼)
|
||||
function markNames(q) {
|
||||
if (q.composition && q.composition.isComposing) return;
|
||||
const text = q.getText(), want = [];
|
||||
for (let i = text.indexOf(TAG); i >= 0; i = text.indexOf(TAG, i + TAG.length)) {
|
||||
const last = want[want.length - 1];
|
||||
if (last && last[1] === i) last[1] = i + TAG.length; else want.push([i, i + TAG.length]);
|
||||
}
|
||||
const have = [];
|
||||
let pos = 0;
|
||||
q.getContents().ops.forEach(function (op) {
|
||||
const len = typeof op.insert === "string" ? op.insert.length : 1;
|
||||
if (op.attributes && op.attributes.nametag) {
|
||||
const last = have[have.length - 1];
|
||||
if (last && last[1] === pos) last[1] = pos + len; else have.push([pos, pos + len]);
|
||||
}
|
||||
pos += len;
|
||||
});
|
||||
if (JSON.stringify(want) === JSON.stringify(have)) return;
|
||||
have.forEach(function (r) { q.formatText(r[0], r[1] - r[0], "nametag", false, "silent"); });
|
||||
want.forEach(function (r) { q.formatText(r[0], r[1] - r[0], "nametag", "on", "silent"); });
|
||||
}
|
||||
function setMail(html) {
|
||||
mail.setContents(mail.clipboard.convert({ html: html || "" }), "silent");
|
||||
markNames(mail);
|
||||
}
|
||||
function setDm(text) {
|
||||
dm.setText(text || "", "silent");
|
||||
markNames(dm);
|
||||
dmCount();
|
||||
}
|
||||
|
||||
// DM 글자 수(인스타 DM 한 통 한도)
|
||||
const countEl = document.getElementById("otr-dm-count"), dmMax = Number(countEl.dataset.max) || 1000;
|
||||
function dmValue() { return dm.getText().replace(/\s+$/, ""); }
|
||||
function dmCount() {
|
||||
const n = dmValue().length;
|
||||
countEl.textContent = n ? n + " / " + dmMax + "자" : "비어 있음 — 메일 본문 글 + 끝 문구가 복사됩니다";
|
||||
countEl.classList.toggle("is-over", n > dmMax);
|
||||
}
|
||||
|
||||
let dirty = false;
|
||||
mail.on("text-change", function (d, o, source) { if (source !== "silent") { dirty = true; markNames(mail); } });
|
||||
dm.on("text-change", function (d, o, source) { if (source !== "silent") { dirty = true; markNames(dm); dmCount(); } });
|
||||
document.addEventListener("input", function (e) { if (e.target.form === form) dirty = true; });
|
||||
window.addEventListener("beforeunload", function (e) { if (dirty) { e.preventDefault(); e.returnValue = ""; } });
|
||||
|
||||
const cur = readJson("otr-current-data");
|
||||
setMail(cur.body);
|
||||
setDm(cur.dm_body);
|
||||
|
||||
document.getElementById("otr-dm-from-mail").addEventListener("click", function () {
|
||||
if (dmValue() && !confirm("지금 DM 문구를 메일 본문 글로 바꿀까요?")) return;
|
||||
setDm(mail.getText().replace(/\s+$/, ""));
|
||||
dirty = true;
|
||||
});
|
||||
document.getElementById("otr-default").addEventListener("click", function () {
|
||||
if (!confirm("제목·본문·보내는 이름·끝 문구·DM 문구를 기본 문구로 바꿀까요? ([저장]을 눌러야 적용)")) return;
|
||||
const d = readJson("otr-default-data");
|
||||
form.elements.subject.value = d.subject || "";
|
||||
form.elements.sender_name.value = d.sender_name || "";
|
||||
form.elements.footer.value = d.footer || "";
|
||||
form.elements.ad_label.checked = !!d.ad_label;
|
||||
setMail(d.body);
|
||||
setDm(d.dm_body);
|
||||
dirty = true;
|
||||
});
|
||||
form.addEventListener("submit", function (e) {
|
||||
if (!mail.getText().trim()) { e.preventDefault(); toast("메일 본문을 쓰세요.", true); mail.focus(); return; }
|
||||
if (dmValue().length > dmMax) { e.preventDefault(); toast("DM 문구가 " + dmMax + "자를 넘습니다 — 줄여 주세요.", true); dm.focus(); return; }
|
||||
document.getElementById("otr-body-input").value = mail.getSemanticHTML();
|
||||
document.getElementById("otr-dm-input").value = dmValue();
|
||||
dirty = false;
|
||||
});
|
||||
}
|
||||
// DM 문구 글자 수(인스타 DM 한 통 한도) — 비어 있으면 메일 본문으로 간다는 안내
|
||||
const dmBody = document.getElementById("otr-dm-body"), dmCountEl = document.getElementById("otr-dm-count");
|
||||
function dmCount() {
|
||||
if (!dmBody || !dmCountEl) return;
|
||||
const n = dmBody.value.length, max = Number(dmCountEl.dataset.max) || 1000;
|
||||
dmCountEl.textContent = n ? n + " / " + max + "자" : "비어 있음 — 메일 본문 + 끝 문구가 복사됩니다";
|
||||
dmCountEl.classList.toggle("is-over", n >= max);
|
||||
}
|
||||
if (dmBody) { dmBody.addEventListener("input", dmCount); dmCount(); }
|
||||
|
||||
// ── 리스트 화면 ──
|
||||
const root = document.getElementById("otr");
|
||||
|
||||
Vendored
+31
@@ -0,0 +1,31 @@
|
||||
Copyright (c) 2017-2024, Slab
|
||||
Copyright (c) 2014, Jason Chen
|
||||
Copyright (c) 2013, salesforce.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
# Quill 2.0.3
|
||||
|
||||
안내문 발송 설정 화면(메일 본문 서식 편집기·DM 편집기)에서 씁니다. 외부 CDN 없이 여기서 불러옵니다.
|
||||
|
||||
- 출처: npm `quill@2.0.3` (https://quilljs.com, https://github.com/slab/quill) — `dist/quill.js`, `dist/quill.snow.css` 원본 그대로
|
||||
- 라이선스: BSD 3-Clause (`LICENSE`)
|
||||
Vendored
+3
File diff suppressed because one or more lines are too long
@@ -0,0 +1,7 @@
|
||||
/*!
|
||||
* Quill Editor v2.0.3
|
||||
* https://quilljs.com
|
||||
* Copyright (c) 2017-2024, Slab
|
||||
* Copyright (c) 2014, Jason Chen
|
||||
* Copyright (c) 2013, salesforce.com
|
||||
*/
|
||||
+10
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user