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:
2026-09-26 14:16:29 +09:00
parent b7569f508c
commit 84f291bc76
8 changed files with 62 additions and 13 deletions
+14 -1
View File
@@ -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&#x09;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 으로만 남는다).