diff --git a/app/modules/project/store.py b/app/modules/project/store.py
index 0fef6b5..27d96fd 100644
--- a/app/modules/project/store.py
+++ b/app/modules/project/store.py
@@ -349,6 +349,8 @@ _DESC_ALLOWED_ATTRS: dict[str, frozenset[str]] = {
"input": frozenset({"type", "checked"}),
# ul: 체크리스트(서식 도구 ☑ — 줄마다 체크박스) 표시용 class="pj-checklist" 하나만
"ul": frozenset({"class"}),
+ # li: 체크리스트 줄의 체크 여부 — data-checked="true" 만(체크박스는 CSS 가 글머리처럼 그린다)
+ "li": frozenset({"data-checked"}),
}
# URL 은 금지 목록이 아니라 허용 목록으로 검사한다. 금지 목록(javascript: 등)은
# "jav ascript:" 처럼 중간에 탭/개행을 끼우면 통과하는데, 브라우저는 URL 을
@@ -446,6 +448,8 @@ class _DescriptionSanitizer(HTMLParser):
# 화면 스타일을 흔들 여지를 남기지 않는다.
if name == "class" and value.strip() != _DESC_ALLOWED_CLASS.get(tag):
continue
+ if name == "data-checked" and value.strip() != "true":
+ continue
kept.append(f'{name}="{_desc_escape_attr(value)}"')
attr_text = (" " + " ".join(kept)) if kept else ""
self.out.append(f"<{tag}{attr_text}>")
diff --git a/app/modules/project/templates/project/help.html b/app/modules/project/templates/project/help.html
index 6f05227..7ec66fb 100644
--- a/app/modules/project/templates/project/help.html
+++ b/app/modules/project/templates/project/help.html
@@ -1,8 +1,8 @@
{% extends "erp_base.html" %}
{% block head_extra %}
-
-
+
+
{% endblock %}
diff --git a/app/modules/project/templates/project/inbox.html b/app/modules/project/templates/project/inbox.html
index bf07b2c..e4e4b12 100644
--- a/app/modules/project/templates/project/inbox.html
+++ b/app/modules/project/templates/project/inbox.html
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
-
+
{% endblock %}
@@ -101,5 +101,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 39ade9f..27dd890 100644
--- a/app/modules/project/templates/project/mytasks.html
+++ b/app/modules/project/templates/project/mytasks.html
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
-
+
{% endblock %}
@@ -100,5 +100,5 @@
"today": {{ today | tojson }}
}
-
+
{% endblock %}
diff --git a/app/modules/project/templates/project/project.html b/app/modules/project/templates/project/project.html
index c9a4a6f..bea836e 100644
--- a/app/modules/project/templates/project/project.html
+++ b/app/modules/project/templates/project/project.html
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
-
+
@@ -472,5 +472,5 @@
-
+
{% endblock %}
diff --git a/app/modules/project/templates/project/trash.html b/app/modules/project/templates/project/trash.html
index 732d828..f0d35c4 100644
--- a/app/modules/project/templates/project/trash.html
+++ b/app/modules/project/templates/project/trash.html
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
-
+
{% endblock %}
@@ -70,5 +70,5 @@
{% include "project/_side_modals.html" %}
{% include "project/_member_tasks_modal.html" %}
-
+
{% endblock %}
diff --git a/app/static/project.css b/app/static/project.css
index 7192228..a03692f 100644
--- a/app/static/project.css
+++ b/app/static/project.css
@@ -989,7 +989,12 @@
.pj-desc-toolbar { display: flex; align-items: center; gap: 8px; margin: -6px 0 6px; }
.pj-desc-toolbar .pj-muted-sm { font-size: 11px; color: #9aa1a9; }
/* 간단 워드프로세서 서식 도구 모음 */
-.pj-desc-fmtbar { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; margin-bottom: 6px; }
+/* 서식 도구 — 설명이 길어 작업 창을 아래로 스크롤해도 설명란을 보는 동안은 위에 붙어 있다
+ (sticky 기준 = 작업 창 스크롤 영역, 붙어 있는 범위 = 설명 구간 .pj-desc-block 안). */
+.pj-desc-fmtbar {
+ display: flex; align-items: center; gap: 2px; flex-wrap: wrap; margin-bottom: 6px;
+ position: sticky; top: 0; z-index: 4; background: #fff; padding: 4px 0;
+}
.pj-desc-fmtbtn {
min-width: 26px; height: 26px; padding: 0 6px; border: 1px solid transparent; border-radius: 6px;
background: transparent; color: #444; font-size: 13px; font-family: inherit; cursor: pointer;
@@ -1006,9 +1011,20 @@ label.pj-desc-fmtbtn {
display: inline-flex; align-items: center; justify-content: center; margin: 0;
line-height: normal; font-size: 13px; font-weight: 400; color: #444;
}
-/* 체크리스트(서식 도구 ☑) — 글머리 기호 대신 줄마다 체크박스. 체크한 줄은 흐리게 + 취소선 */
-.pj-desc-editor ul.pj-checklist { list-style: none; padding-left: 2px; }
-.pj-desc-editor ul.pj-checklist > li:has(> input[type="checkbox"]:checked) { color: #9aa1a9; text-decoration: line-through; }
+/* 체크리스트(서식 도구 ☑) — 글머리 기호 자리에 체크박스를 그린다(li::before, 글자 밖이라
+ 왼쪽에 글자가 들어갈 수 없다). 글자보다 왼쪽(체크박스)을 누르면 체크/해제(JS mousedown).
+ 체크한 줄(data-checked="true")은 흐리게 + 취소선. */
+.pj-desc-editor ul.pj-checklist { list-style: none; padding-left: 24px; }
+.pj-desc-editor ul.pj-checklist > li { position: relative; }
+.pj-desc-editor ul.pj-checklist > li::before {
+ content: ""; position: absolute; left: -22px; top: .28em; width: 14px; height: 14px;
+ box-sizing: border-box; border: 1.5px solid #8f959d; border-radius: 3px; background: #fff; cursor: pointer;
+}
+.pj-desc-editor ul.pj-checklist > li[data-checked="true"]::before {
+ border-color: var(--pj-accent); background: var(--pj-accent) center / 10px 10px no-repeat
+ url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 6.3l2.6 2.6L10 3.4' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
+}
+.pj-desc-editor ul.pj-checklist > li[data-checked="true"] { color: #9aa1a9; text-decoration: line-through; }
/* 설명란 체크박스(서식 도구 ☑) — 누르면 체크/해제, 체크 여부는 저장된다 */
.pj-desc-editor input[type="checkbox"] {
width: 15px; height: 15px; margin: 0 4px 0 1px; vertical-align: -2px; cursor: pointer;
diff --git a/app/static/project.js b/app/static/project.js
index 3b5a420..3c1dbd8 100644
--- a/app/static/project.js
+++ b/app/static/project.js
@@ -4977,9 +4977,12 @@
// 크롬/엣지는 여전히 지원하고, 이미 같은 파일의 이미지 삽입에서도 쓰고
// 있어(insertHTML) 일관된 패턴이다. 버튼 mousedown 에서 preventDefault
// 안 하면 클릭 순간 에디터가 포커스를 잃어 선택 범위가 풀린다.
- // ── 체크리스트(서식 도구 ☑) — 글머리 목록처럼 줄마다 체크박스.
- //
- // (서버 정리기는 ul 의 class 로 pj-checklist 하나만, input 은 체크박스·checked 만 남긴다)
+ // ── 체크리스트(서식 도구 ☑) — 글머리 기호처럼 줄마다 체크박스.
+ //
+ // 체크박스는 글자 속 요소가 아니라 글머리 기호 자리에 CSS 가 그린다(li::before) — 그래서
+ // 체크박스 왼쪽에 글자가 들어갈 수 없고, Enter(새 줄)·빈 줄 Enter(목록 끝)·Backspace 는
+ // 브라우저의 글머리 목록 동작 그대로다. 체크 여부는 li 의 data-checked 로 저장
+ // (서버 정리기는 ul 의 class="pj-checklist", li 의 data-checked="true" 만 남긴다).
function selNode() {
const sel = window.getSelection();
if (!sel || !sel.rangeCount) return null;
@@ -4990,25 +4993,6 @@
const x = n && n.closest ? n.closest(selector) : null;
return x && box.contains(x) ? x : null;
}
- // 줄(li) 맨 앞의 체크박스(앞의 빈 글자는 건너뜀)
- function leadingBox(li) {
- for (let c = li.firstChild; c; c = c.nextSibling) {
- if (c.nodeType === 3 && !c.nodeValue.replace(/[\s\u00a0\u200b]/g, "")) continue;
- return (c.nodeType === 1 && c.tagName === "INPUT" && c.type === "checkbox") ? c : null;
- }
- return null;
- }
- function caretAfter(node) {
- const r = document.createRange();
- r.setStartAfter(node); r.collapse(true);
- const sel = window.getSelection();
- sel.removeAllRanges(); sel.addRange(r);
- }
- function ensureBox(li) {
- let cb = leadingBox(li);
- if (!cb) { cb = document.createElement("input"); cb.type = "checkbox"; li.insertBefore(cb, li.firstChild); }
- return cb;
- }
function selectedItems(listEl) {
const sel = window.getSelection();
const r = sel && sel.rangeCount ? sel.getRangeAt(0) : null;
@@ -5018,59 +5002,64 @@
if (!items.length) { const li = closestIn(selNode(), "li"); if (li) items.push(li); }
return items;
}
- // 체크박스가 하나도 없는 체크리스트는 평범한 목록으로, 줄마다 체크박스가 있는 ul 은 체크리스트로
+ // 예전 방식(줄 맨 앞 )으로 저장된 체크리스트를 새 방식으로 바꾸고,
+ // 체크리스트 밖으로 나간 줄의 data-checked 는 지운다(빈 목록의 class 도).
function normalizeChecklists() {
- box.querySelectorAll("ul").forEach(function (ul) {
- const lis = Array.prototype.filter.call(ul.children, function (x) { return x.tagName === "LI"; });
- const withBox = lis.filter(function (li) { return leadingBox(li); }).length;
- if (ul.classList.contains("pj-checklist") && !withBox) ul.classList.remove("pj-checklist");
- else if (lis.length && withBox === lis.length) ul.classList.add("pj-checklist");
- if (!ul.className) ul.removeAttribute("class");
+ box.querySelectorAll("ul.pj-checklist > li").forEach(function (li) {
+ const first = li.firstElementChild;
+ if (first && first.tagName === "INPUT" && first.type === "checkbox" &&
+ !(li.firstChild.nodeType === 3 && li.firstChild.nodeValue.replace(/[\s\u00a0\u200b]/g, ""))) {
+ if (first.hasAttribute("checked")) li.setAttribute("data-checked", "true");
+ first.remove();
+ const t = li.firstChild;
+ if (t && t.nodeType === 3) t.nodeValue = t.nodeValue.replace(/^[\s\u00a0]+/, "");
+ }
+ });
+ box.querySelectorAll("[data-checked]").forEach(function (x) {
+ if (!(x.tagName === "LI" && x.parentElement && x.parentElement.classList.contains("pj-checklist"))) {
+ x.removeAttribute("data-checked");
+ }
+ });
+ box.querySelectorAll("ul.pj-checklist").forEach(function (ul) {
+ if (!ul.querySelector(":scope > li")) { ul.classList.remove("pj-checklist"); if (!ul.className) ul.removeAttribute("class"); }
});
}
function toggleChecklist() {
const cur = closestIn(selNode(), "ul.pj-checklist");
if (cur) {
- // 끄기 — 고른 줄의 체크박스를 빼고 목록에서 뺀다(글머리 버튼을 다시 누른 것과 같음)
- selectedItems(cur).forEach(function (li) { const cb = leadingBox(li); if (cb) cb.remove(); });
+ // 끄기 — 고른 줄을 목록에서 뺀다(글머리 버튼을 다시 누른 것과 같음)
+ selectedItems(cur).forEach(function (li) { li.removeAttribute("data-checked"); });
try { document.execCommand("insertUnorderedList"); } catch (_) {}
} else {
- // 켜기 — 목록이 아니면 먼저 글머리 목록으로 만든 뒤(번호 목록이면 글머리로 바뀜),
- // 그 목록의 줄마다 체크박스
+ // 켜기 — 목록이 아니면 먼저 글머리 목록으로(번호 목록이면 글머리로 바뀜), 그 목록을 체크리스트로
if (!closestIn(selNode(), "ul")) { try { document.execCommand("insertUnorderedList"); } catch (_) {} }
const ul = closestIn(selNode(), "ul");
- if (ul) {
- ul.classList.add("pj-checklist");
- Array.prototype.forEach.call(ul.children, function (li) { if (li.tagName === "LI") ensureBox(li); });
- const li = closestIn(selNode(), "li");
- if (li && !li.textContent.replace(/[\s\u00a0\u200b]/g, "")) caretAfter(leadingBox(li));
- }
+ if (ul) ul.classList.add("pj-checklist");
}
normalizeChecklists();
}
- // 체크리스트 줄에서 Enter — 새 줄에도 체크박스(체크 안 된 채). 빈 줄에서 Enter 는 목록 끝.
+ // 체크리스트 줄에서 Enter — 브라우저가 새 줄(li)을 만들 때 윗줄의 체크 표시까지
+ // 복사하므로, 새 줄은 체크 안 된 채로 시작하게 지운다.
box.addEventListener("keydown", function (e) {
if (e.key !== "Enter" || e.shiftKey || e.isComposing) return;
const li = closestIn(selNode(), "ul.pj-checklist > li");
if (!li) return;
- if (!li.textContent.replace(/[\s\u00a0\u200b]/g, "")) {
- e.preventDefault();
- const cb = leadingBox(li);
- if (cb) cb.remove();
- try { document.execCommand("insertUnorderedList"); } catch (_) {}
- normalizeChecklists();
- box.dispatchEvent(new Event("input", { bubbles: true }));
- return;
- }
setTimeout(function () {
const nli = closestIn(selNode(), "ul.pj-checklist > li");
- if (!nli || nli === li) return;
- let cb = leadingBox(nli);
- if (!cb) { cb = ensureBox(nli); caretAfter(cb); }
- else if (cb.hasAttribute("checked")) { cb.removeAttribute("checked"); cb.checked = false; }
- box.dispatchEvent(new Event("input", { bubbles: true }));
+ if (nli && nli !== li) nli.removeAttribute("data-checked");
+ normalizeChecklists();
}, 0);
});
+ // 체크박스(글머리 자리) 누르기 — 줄의 글자보다 왼쪽을 누르면 체크/해제.
+ box.addEventListener("mousedown", function (e) {
+ const li = e.target && e.target.closest ? e.target.closest("ul.pj-checklist > li") : null;
+ if (!li || !box.contains(li)) return;
+ if (e.clientX >= li.getBoundingClientRect().left) return;
+ e.preventDefault(); // 글자 커서가 옮겨가지 않게
+ if (li.getAttribute("data-checked") === "true") li.removeAttribute("data-checked");
+ else li.setAttribute("data-checked", "true");
+ box.dispatchEvent(new Event("input", { bubbles: true }));
+ });
const fmtbar = el("pj-desc-fmtbar");
if (fmtbar) {
@@ -5092,11 +5081,11 @@
updateFmtState();
return;
}
- // 체크리스트 안에서 글머리/번호 버튼 — 체크박스를 빼고 그 목록으로 바꾼다.
+ // 체크리스트 안에서 글머리/번호 버튼 — 체크 표시를 빼고 그 목록으로 바꾼다.
if (cmd === "insertUnorderedList" || cmd === "insertOrderedList") {
const cl = closestIn(selNode(), "ul.pj-checklist");
if (cl) {
- Array.prototype.forEach.call(cl.children, function (li) { const cb = li.tagName === "LI" && leadingBox(li); if (cb) cb.remove(); });
+ Array.prototype.forEach.call(cl.children, function (li) { if (li.tagName === "LI") li.removeAttribute("data-checked"); });
cl.classList.remove("pj-checklist");
if (!cl.className) cl.removeAttribute("class");
if (cmd === "insertUnorderedList") { box.dispatchEvent(new Event("input", { bubbles: true })); updateFmtState(); return; }
@@ -5359,10 +5348,10 @@
return {
setTaskId: setTaskId,
setHtml: function (html) {
- // (체크박스는 checked 속성이 그대로 화면 상태가 된다 — 새 HTML 이라 따로 맞출 필요 없음)
selectImg(null); lastRange = null;
box.innerHTML = html || "";
normalizeEditorLinks(box);
+ normalizeChecklists(); // 예전 방식() 체크리스트 → 글머리식
},
getHtml: function () { return box.innerHTML; },
isUploading: function () { return pendingUploads > 0; },