feat(project): 설명 편집 서식 도구에 취소선·체크박스 추가
- 취소선: 서식 도구 S 버튼 + Ctrl+Shift+X (execCommand strikeThrough) - 체크박스: ☑ 버튼으로 커서 자리에 넣고, 누를 때마다 checked 속성을 직접 바꿔 저장·다시 열기에도 체크 상태 유지 - 서버 설명 정리기: s/strike/del 허용, input 은 type="checkbox" 만(checked 외 속성 없음, 다른 종류는 태그째 버림) - 도움말 8장 서식 도구 설명 갱신, 정적 파일 버전 20260926m Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -333,8 +333,12 @@ def build_subject_project_done(*, project_name: str) -> str:
|
||||
_DESC_ALLOWED_TAGS: frozenset[str] = frozenset({
|
||||
"p", "br", "b", "strong", "i", "em", "u", "a", "img",
|
||||
"ul", "ol", "li", "blockquote", "code", "pre", "span", "div",
|
||||
# 취소선(서식 도구 "S" — 브라우저에 따라 strike/s/del 로 만든다)
|
||||
"s", "strike", "del",
|
||||
# 체크박스(서식 도구 "☑") — type="checkbox" 만, 속성은 checked 뿐(아래 _emit_start)
|
||||
"input",
|
||||
})
|
||||
_DESC_VOID_TAGS: frozenset[str] = frozenset({"br", "img"})
|
||||
_DESC_VOID_TAGS: frozenset[str] = frozenset({"br", "img", "input"})
|
||||
# a: target/rel 은 "새 탭에서 열기"용. 화면(설명란)에서 링크를 클릭하면
|
||||
# 새 탭으로 여는데, 저장했다 다시 열었을 때도 같은 동작이어야 해서 허용한다.
|
||||
# span: 멘션 칩(@이름) 전용 — class="pj-mention" + data-email 만 남긴다.
|
||||
@@ -342,6 +346,7 @@ _DESC_ALLOWED_ATTRS: dict[str, frozenset[str]] = {
|
||||
"a": frozenset({"href", "target", "rel"}),
|
||||
"img": frozenset({"src", "alt", "width", "height"}),
|
||||
"span": frozenset({"class", "data-email"}),
|
||||
"input": frozenset({"type", "checked"}),
|
||||
}
|
||||
# URL 은 금지 목록이 아니라 허용 목록으로 검사한다. 금지 목록(javascript: 등)은
|
||||
# "jav	ascript:" 처럼 중간에 탭/개행을 끼우면 통과하는데, 브라우저는 URL 을
|
||||
@@ -411,6 +416,14 @@ class _DescriptionSanitizer(HTMLParser):
|
||||
return
|
||||
if tag not in _DESC_ALLOWED_TAGS:
|
||||
return
|
||||
# input 은 체크박스만 — 다른 종류(text·file·hidden 등)는 태그째 버리고,
|
||||
# 체크 여부 말고는 아무 속성도 남기지 않는다.
|
||||
if tag == "input":
|
||||
if (dict(attrs).get("type") or "").strip().lower() != "checkbox":
|
||||
return
|
||||
checked = any(name == "checked" for name, _ in attrs)
|
||||
self.out.append('<input type="checkbox" checked>' if checked else '<input type="checkbox">')
|
||||
return
|
||||
allowed = _DESC_ALLOWED_ATTRS.get(tag, frozenset())
|
||||
# span 은 멘션 칩일 때만 속성을 갖는다 — class 가 pj-mention 이 아니면
|
||||
# data-email 까지 통째로 버린다(평범한 span 으로만 남는다).
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20260926l" />
|
||||
<link rel="stylesheet" href="/static/project-help.css?v=20260926l" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20260926m" />
|
||||
<link rel="stylesheet" href="/static/project-help.css?v=20260926m" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
|
||||
@@ -274,7 +274,8 @@
|
||||
</ul>
|
||||
<h3>설명</h3>
|
||||
<ul>
|
||||
<li>서식 도구: <span class="pjh-ui">B</span> 굵게 · <span class="pjh-ui">I</span> 기울임 · <span class="pjh-ui">U</span> 밑줄 · 글머리 목록 · 번호 목록 · 인용 · 링크 · <span class="pjh-ui">×서식</span>(서식 지우기) · 이미지 넣기</li>
|
||||
<li>서식 도구: <span class="pjh-ui">B</span> 굵게 · <span class="pjh-ui">I</span> 기울임 · <span class="pjh-ui">U</span> 밑줄 · <span class="pjh-ui"><s>S</s></span> 취소선(<kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>X</kbd>) · 글머리 목록 · 번호 목록 · <span class="pjh-ui"><span class="material-symbols-outlined">check_box</span></span> 체크박스 · 인용 · 링크 · <span class="pjh-ui">×서식</span>(서식 지우기) · 이미지 넣기</li>
|
||||
<li><b>체크박스</b> — 커서 자리에 체크박스가 들어갑니다. 누를 때마다 체크/해제되고, <b>저장</b>하면 체크 상태도 그대로 남습니다. 글머리 목록과 함께 쓰면 할 일 목록처럼 쓸 수 있어요.</li>
|
||||
<li><b>이미지</b> — 캡처한 그림을 <kbd>Ctrl</kbd>+<kbd>V</kbd>로 바로 붙여 넣을 수 있습니다. 그림을 누르면 모서리를 끌어 크기를 바꾸거나 지울 수 있습니다.</li>
|
||||
<li><b>링크</b> — 웹 주소를 붙여 넣으면 자동으로 링크가 되고, 누르면 새 탭에서 열립니다.</li>
|
||||
<li><b>@태그</b> — <kbd>@</kbd>를 누르면 사람 목록이 뜹니다. 고른 사람의 수신함에 이 작업이 쌓입니다.</li>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20260926l" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20260926m" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
|
||||
@@ -101,5 +101,5 @@
|
||||
{% include "project/_side_modals.html" %}
|
||||
{% include "project/_member_tasks_modal.html" %}
|
||||
|
||||
<script src="/static/project.js?v=20260926l" defer></script>
|
||||
<script src="/static/project.js?v=20260926m" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20260926l" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20260926m" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
|
||||
@@ -100,5 +100,5 @@
|
||||
"today": {{ today | tojson }}
|
||||
}
|
||||
</script>
|
||||
<script src="/static/project.js?v=20260926l" defer></script>
|
||||
<script src="/static/project.js?v=20260926m" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20260926l" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20260926m" />
|
||||
<!-- 구글 머티리얼 심볼(담당자 아이콘 등) — self-host -->
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
<!-- 타임라인 vis-timeline — self-host -->
|
||||
@@ -326,9 +326,11 @@
|
||||
<button type="button" class="pj-desc-fmtbtn" data-cmd="bold" title="굵게 (Ctrl+B)"><b>B</b></button>
|
||||
<button type="button" class="pj-desc-fmtbtn" data-cmd="italic" title="기울임 (Ctrl+I)"><i>I</i></button>
|
||||
<button type="button" class="pj-desc-fmtbtn" data-cmd="underline" title="밑줄 (Ctrl+U)"><u>U</u></button>
|
||||
<button type="button" class="pj-desc-fmtbtn" data-cmd="strikeThrough" title="취소선 (Ctrl+Shift+X)"><s>S</s></button>
|
||||
<span class="pj-desc-fmtsep"></span>
|
||||
<button type="button" class="pj-desc-fmtbtn" data-cmd="insertUnorderedList" title="글머리 기호 목록">☰•</button>
|
||||
<button type="button" class="pj-desc-fmtbtn" data-cmd="insertOrderedList" title="번호 매기기 목록">☰1</button>
|
||||
<button type="button" class="pj-desc-fmtbtn" data-cmd="insertCheckbox" title="체크박스 넣기"><span class="material-symbols-outlined">check_box</span></button>
|
||||
<button type="button" class="pj-desc-fmtbtn" data-cmd="formatBlock" data-arg="blockquote" title="인용구">❝</button>
|
||||
<span class="pj-desc-fmtsep"></span>
|
||||
<button type="button" class="pj-desc-fmtbtn" data-cmd="createLink" title="링크 삽입">🔗</button>
|
||||
@@ -468,5 +470,5 @@
|
||||
</script>
|
||||
|
||||
<script src="/static/vendor/vis-timeline/vis-timeline-graph2d.min.js"></script>
|
||||
<script src="/static/project.js?v=20260926l" defer></script>
|
||||
<script src="/static/project.js?v=20260926m" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20260926l" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20260926m" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
|
||||
@@ -70,5 +70,5 @@
|
||||
{% include "project/_side_modals.html" %}
|
||||
{% include "project/_member_tasks_modal.html" %}
|
||||
|
||||
<script src="/static/project.js?v=20260926l" defer></script>
|
||||
<script src="/static/project.js?v=20260926m" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user