diff --git a/app/modules/cupang/templates/cupang/index.html b/app/modules/cupang/templates/cupang/index.html index 34b51f2..71ee8b4 100644 --- a/app/modules/cupang/templates/cupang/index.html +++ b/app/modules/cupang/templates/cupang/index.html @@ -249,7 +249,7 @@ {% endblock %} {% block scripts %} - + - + {% endif %} {% endblock %} diff --git a/app/modules/project/CLAUDE.md b/app/modules/project/CLAUDE.md index a276f98..509277a 100644 --- a/app/modules/project/CLAUDE.md +++ b/app/modules/project/CLAUDE.md @@ -80,6 +80,10 @@ - **업무를 옮기면 드라이브 파일도 이동**(2026-10-20): 섹션·프로젝트·상위 업무가 바뀌면(`api_update_task`·`move-parent`·`move-project`, `_drive_path_changed`) 백그라운드 `_relocate_drive_files` 가 업무+하위 전체(`db.task_subtree_ids`)의 설명 링크 파일을 새 폴더로(`GoogleDriveFiles.move_to` — appProperties `dbxTaskId` 가 그 업무인 파일만). 제목 변경은 안 옮김, 예전 폴더는 남김. - 그 밖의 업무 창 자리 → 예전처럼 첨부(`POST …/attachments`, `uploadTaskFiles`). - 설명란 서식 도구에 글자 색·크기(서버는 span style 의 color·font-size 만 허용, `desc_inline_style`). 주소 붙여넣기 시 자동 링크. 설명란 링크 = 굵게·기울임·밑줄 + 한 글자처럼(2026-10-19 — `normalizeEditorLinks` 가 `contenteditable=false`, 링크 바로 뒤 Backspace·앞 Delete = 링크 통째로 `execCommand delete`(Ctrl+Z 가능), 저장 HTML 에선 `getHtml` 이 잠금 표시를 뺀다). 설명란 이미지 더블클릭 = 별도 창 이미지 보기(확대·축소·끌어 이동). + **링크 서식 = 크기·굵기만**(2026-10-30) — 잠긴 링크라 execCommand 가 안에 안 들어가, 고른 범위에 걸친 링크는 링크 안쪽 `` 하나로(`setLinkStyle`): + 크기 = 글자 크기 도구 그대로, 굵기 = 굵게 버튼·Ctrl+B(`boldWithLinks` — 링크 기본이 굵게라 "보통" = `font-weight: 400`, 서버 `desc_inline_style` 은 400 만 받음). + 글자와 같이 고르면 execCommand 가 글자에 만든 굵기를 따름(잠긴 링크가 끼면 queryCommandState 가 틀려 글자 노드 계산값으로). 링크 서식 변경은 Ctrl+Z 안 됨. + 테스트 `tests/js/board_drive.browser.test.js` 6), `tests/test_project_icons_desc_style.py`. - 설명란·댓글에서 @로 멤버 태그(`task_mentions`, 마이그레이션 006) → 수신함에 그 작업이 쌓임. 댓글 `@아이디` 는 아이콘+이름 칩. - 댓글·답글 입력칸은 Enter 등록·Shift+Enter 줄바꿈(textarea). - 댓글 답글·이모티콘 반응(마이그레이션 012 `task_comments.parent_id`·`task_comment_reactions`, 미적용 시 버튼 숨김·API 503). 반응 = 댓글 쓴 사람에게 알림(`type=reaction`). diff --git a/app/modules/project/store.py b/app/modules/project/store.py index a8727c1..a4d6d81 100644 --- a/app/modules/project/store.py +++ b/app/modules/project/store.py @@ -973,6 +973,9 @@ def desc_inline_style(value: str) -> str: kept.append(f"color: {val}") elif prop == "font-size" and val in DESC_FONT_SIZES and not any(k.startswith("font-size:") for k in kept): kept.append(f"font-size: {val}") + # 링크 굵기 "보통"(2026-10-30) — 링크 기본이 굵게라 보통으로 되돌릴 때만 쓴다(굵게는 값 없음) + elif prop == "font-weight" and val in ("400", "normal") and not any(k.startswith("font-weight:") for k in kept): + kept.append("font-weight: 400") return "; ".join(kept) diff --git a/app/modules/project/templates/project/goal_meeting.html b/app/modules/project/templates/project/goal_meeting.html index a043d13..c46bf6f 100644 --- a/app/modules/project/templates/project/goal_meeting.html +++ b/app/modules/project/templates/project/goal_meeting.html @@ -289,5 +289,5 @@ - + {% endblock %} diff --git a/app/modules/project/templates/project/goals.html b/app/modules/project/templates/project/goals.html index 608fab8..06ddbac 100644 --- a/app/modules/project/templates/project/goals.html +++ b/app/modules/project/templates/project/goals.html @@ -207,5 +207,5 @@ {% include "project/_member_tasks_modal.html" %} - + {% endblock %} diff --git a/app/modules/project/templates/project/inbox.html b/app/modules/project/templates/project/inbox.html index 6179ce6..3e4bbc7 100644 --- a/app/modules/project/templates/project/inbox.html +++ b/app/modules/project/templates/project/inbox.html @@ -106,5 +106,5 @@ {% include "project/_side_modals.html" %} {% include "project/_member_tasks_modal.html" %} - + {% endblock %} diff --git a/app/modules/project/templates/project/mytasks.html b/app/modules/project/templates/project/mytasks.html index ecabbae..7e20853 100644 --- a/app/modules/project/templates/project/mytasks.html +++ b/app/modules/project/templates/project/mytasks.html @@ -100,5 +100,5 @@ "today": {{ today | tojson }} } - + {% endblock %} diff --git a/app/modules/project/templates/project/notifier.html b/app/modules/project/templates/project/notifier.html index 270c787..2f58768 100644 --- a/app/modules/project/templates/project/notifier.html +++ b/app/modules/project/templates/project/notifier.html @@ -108,5 +108,5 @@ }); })(); - + {% endblock %} diff --git a/app/modules/project/templates/project/project.html b/app/modules/project/templates/project/project.html index 81a844f..de951d3 100644 --- a/app/modules/project/templates/project/project.html +++ b/app/modules/project/templates/project/project.html @@ -476,5 +476,5 @@ - + {% endblock %} diff --git a/app/modules/project/templates/project/trash.html b/app/modules/project/templates/project/trash.html index b3912de..a8fa30b 100644 --- a/app/modules/project/templates/project/trash.html +++ b/app/modules/project/templates/project/trash.html @@ -70,5 +70,5 @@ {% include "project/_side_modals.html" %} {% include "project/_member_tasks_modal.html" %} - + {% endblock %} diff --git a/app/static/project.js b/app/static/project.js index 1eb3638..3fc51d1 100644 --- a/app/static/project.js +++ b/app/static/project.js @@ -8877,6 +8877,7 @@ openStylePop(btn, cmd); return; } + if (cmd === "bold") { boldWithLinks(); updateFmtState(); return; } // 체크리스트 — 글머리 목록처럼 켜고 끈다(줄마다 체크박스). if (cmd === "insertCheckbox") { toggleChecklist(); @@ -8943,12 +8944,59 @@ const sel = window.getSelection(); if (range) { sel.removeAllRanges(); sel.addRange(range); } if (!sel.rangeCount || sel.isCollapsed) { showToast("바꿀 글자를 먼저 선택하세요.", "info"); return; } + const links = kind === "size" ? linksIn(sel.getRangeAt(0)) : []; try { document.execCommand("styleWithCSS", false, false); } catch (_) {} try { if (kind === "color") document.execCommand("foreColor", false, value || RESET_COLOR); else document.execCommand("fontSize", false, "7"); } catch (_) {} fontsToSpans(kind, value); + links.forEach(function (a) { setLinkStyle(a, "font-size", value); }); + box.dispatchEvent(new Event("input", { bubbles: true })); + } + // ── 링크 서식(2026-10-30) — 링크는 한 글자처럼 잠겨(contenteditable=false) execCommand 굵게·크기가 안에 안 들어간다. + // 고른 범위에 걸친 링크는 링크 안쪽 하나로 크기·굵기만 바꾼다(링크는 그대로 한 덩어리). + // 굵기: 링크 기본(CSS)이 굵게라 "보통"은 font-weight: 400, 굵게는 그 값을 뺀다(서버 desc_inline_style 이 400 만 받는다). + function linksIn(range) { + return Array.prototype.filter.call(box.querySelectorAll("a"), function (a) { return range.intersectsNode(a); }); + } + function setLinkStyle(a, prop, value) { + let sp = a.childNodes.length === 1 && a.firstChild.nodeName === "SPAN" && !a.firstChild.className ? a.firstChild : null; + if (!sp) { + sp = document.createElement("span"); + while (a.firstChild) sp.appendChild(a.firstChild); + a.appendChild(sp); + } + stripInside(sp, prop); + if (value) sp.style.setProperty(prop, value); else sp.style.removeProperty(prop); + if (!sp.getAttribute("style")) sp.replaceWith.apply(sp, Array.prototype.slice.call(sp.childNodes)); + } + function linkIsBold(a) { + const sp = a.querySelector("span[style]") || a; + return parseInt(getComputedStyle(sp).fontWeight, 10) >= 600; + } + // 굵게(도구 버튼·Ctrl+B) — 글자는 execCommand, 고른 링크는 같은 결과로(글자가 없으면 링크끼리 켜고 끄기) + function boldWithLinks() { + const sel = window.getSelection(); + const range = sel.rangeCount ? sel.getRangeAt(0).cloneRange() : null; + const links = range && !range.collapsed ? linksIn(range) : []; + const allBold = links.every(linkIsBold); + // 고른 범위의 링크 밖 글자(execCommand 뒤에도 같은 글자 노드가 로 옮겨질 뿐이라 굵기를 다시 잴 수 있다) + const texts = []; + if (links.length) { + const walker = document.createTreeWalker(box, NodeFilter.SHOW_TEXT); + for (let n = walker.nextNode(); n; n = walker.nextNode()) { + if (n.nodeValue.trim() && range.intersectsNode(n) && !n.parentElement.closest("a")) texts.push(n); + } + } + try { document.execCommand("bold"); } catch (_) {} + if (!links.length) return; + // 글자가 있으면 execCommand 가 실제로 만든 굵기를 따른다 — 잠긴 링크가 끼면 queryCommandState·선택 범위가 틀어진다 + const now = texts.filter(function (n) { return n.isConnected && box.contains(n); }); + const bold = now.length + ? now.every(function (n) { return parseInt(getComputedStyle(n.parentElement).fontWeight, 10) >= 600; }) + : !allBold; + links.forEach(function (a) { setLinkStyle(a, "font-weight", bold ? "" : "400"); }); box.dispatchEvent(new Event("input", { bubbles: true })); } function openStylePop(btn, cmd) { @@ -9004,6 +9052,12 @@ try { document.execCommand("strikeThrough"); } catch (_) {} updateFmtState(); } + // Ctrl+B — 도구 버튼과 같이 고른 링크도 굵게/보통(브라우저 기본 굵게는 잠긴 링크에 안 들어간다) + if ((e.ctrlKey || e.metaKey) && !e.shiftKey && !e.altKey && (e.key === "b" || e.key === "B")) { + e.preventDefault(); + boldWithLinks(); + updateFmtState(); + } }); } diff --git a/tests/js/board_drive.browser.test.js b/tests/js/board_drive.browser.test.js index 892a9b3..d1e435d 100644 --- a/tests/js/board_drive.browser.test.js +++ b/tests/js/board_drive.browser.test.js @@ -183,6 +183,46 @@ async function dropFile(page, selector, name) { await page.waitForTimeout(1600); const saved = puts.filter(p => p.id === 102 && p.body.description != null).pop(); check("저장 HTML 에 잠금 표시(contenteditable) 없음", !!saved && !saved.body.description.includes("contenteditable"), saved); + + // ── 6) 링크 서식(2026-10-30) — 링크만 고르고 크기·굵기 바꾸기(잠긴 링크라 예전엔 안 바뀌었다), 글자와 같이 고르면 같은 굵기 + function selectLink(i, withBefore) { + return page.evaluate((a) => { + const box = document.getElementById("pj-t-desc"); box.focus(); + const link = box.querySelectorAll("a")[a.i], r = document.createRange(); + if (a.withBefore) r.setStart(link.previousSibling, 0); else r.setStartBefore(link); + r.setEndAfter(link); + const s = getSelection(); s.removeAllRanges(); s.addRange(r); + }, { i: i, withBefore: withBefore }); + } + const linkSt = (i) => page.evaluate((n) => { + const a = document.querySelectorAll("#pj-t-desc a")[n], t = a.querySelector("span[style]") || a, cs = getComputedStyle(t); + return { size: cs.fontSize, w: +cs.fontWeight, ce: a.getAttribute("contenteditable"), html: a.innerHTML }; + }, i); + await selectLink(0, false); + await page.click('.pj-desc-fmtbtn[data-cmd="textSize"]'); + await page.click('.pj-desc-stylepop button[data-v="18px"]'); + let ls = await linkSt(0); + check("링크만 골라 크기 크게(18px), 링크는 그대로 잠김", ls.size === "18px" && ls.ce === "false" && ls.html.includes("링크 글자"), ls); + await selectLink(0, false); + await page.click('.pj-desc-fmtbtn[data-cmd="bold"]'); + ls = await linkSt(0); + check("링크 굵게 버튼 → 보통(기본이 굵게라 끔), 크기는 그대로", ls.w === 400 && ls.size === "18px", ls); + await selectLink(0, false); + await page.keyboard.press("Control+b"); + ls = await linkSt(0); + check("Ctrl+B → 다시 굵게", ls.w >= 700 && ls.size === "18px", ls); + await selectLink(0, true); // "앞 " 글자 + 링크 — 글자가 굵게 되면 링크도 굵게(그대로) + await page.click('.pj-desc-fmtbtn[data-cmd="bold"]'); + const mix = await page.evaluate(() => { + const a = document.querySelector("#pj-t-desc a"), t = a.querySelector("span[style]") || a; + // 글자 굵기는 실제 계산값으로(잠긴 링크가 낀 선택에선 queryCommandState 가 틀린다) + const head = a.previousSibling && a.previousSibling.nodeType === 3 ? a.parentElement : a.previousElementSibling; + return { link: +getComputedStyle(t).fontWeight, text: +getComputedStyle(head).fontWeight >= 700 }; + }); + check("글자와 같이 고르면 링크도 글자와 같은 굵기", (mix.link >= 700) === mix.text, mix); + await page.waitForTimeout(1600); + const saved2 = puts.filter(p => p.id === 102 && p.body.description != null).pop(); + check("링크 서식 저장 — 링크 안쪽 span 의 font-size", !!saved2 && /]*>링크 글자<\/span><\/a>/.test(saved2.body.description), saved2 && saved2.body.description); } finally { await browser.close(); server.close(); } console.log(fails.length ? "\n" + fails.length + " FAILED" : "\nALL PASS"); process.exit(fails.length ? 1 : 0); diff --git a/tests/test_project_icons_desc_style.py b/tests/test_project_icons_desc_style.py index 03767c8..9fcfa8e 100644 --- a/tests/test_project_icons_desc_style.py +++ b/tests/test_project_icons_desc_style.py @@ -23,6 +23,13 @@ class DescStyleTests(unittest.TestCase): out = self.clean('ab') self.assertEqual(out, 'ab') + def test_link_inner_size_and_normal_weight_kept(self): + # 링크 서식(2026-10-30) — 링크 안쪽 span 의 크기·굵기 "보통"(400)만, 다른 굵기는 버림 + out = self.clean('l' + 'ab') + self.assertEqual(out, 'l' + 'ab') + def test_other_declarations_and_sizes_dropped(self): out = self.clean('a') self.assertEqual(out, "a")