feat(project): 설명 체크박스를 글머리 목록처럼(체크리스트) + 작업 창 스크롤바 정리
- ☑ = 체크리스트 켜기/끄기: 지금 줄(고른 줄들)을 <ul class="pj-checklist"> 로, 줄마다 체크박스. Enter 로 새 줄에도 체크박스, 빈 줄 Enter 는 목록 끝. 체크리스트 안에서 글머리·번호 버튼은 체크박스를 빼고 그 목록으로. 체크한 줄은 흐리게 + 취소선 - 서버 정리기: ul 의 class 는 pj-checklist 하나만 허용(태그별 허용 class 표) - 작업 창 스크롤 영역: 가로 스크롤 제거(설명란 음수 여백 때문에 생기던 것), 오른쪽 여백까지 넓혀 세로 스크롤바를 창 오른쪽 끝으로 - 도움말 8장 체크리스트 설명 갱신, 정적 파일 버전 20260926q Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -347,6 +347,8 @@ _DESC_ALLOWED_ATTRS: dict[str, frozenset[str]] = {
|
|||||||
"img": frozenset({"src", "alt", "width", "height"}),
|
"img": frozenset({"src", "alt", "width", "height"}),
|
||||||
"span": frozenset({"class", "data-email"}),
|
"span": frozenset({"class", "data-email"}),
|
||||||
"input": frozenset({"type", "checked"}),
|
"input": frozenset({"type", "checked"}),
|
||||||
|
# ul: 체크리스트(서식 도구 ☑ — 줄마다 체크박스) 표시용 class="pj-checklist" 하나만
|
||||||
|
"ul": frozenset({"class"}),
|
||||||
}
|
}
|
||||||
# URL 은 금지 목록이 아니라 허용 목록으로 검사한다. 금지 목록(javascript: 등)은
|
# URL 은 금지 목록이 아니라 허용 목록으로 검사한다. 금지 목록(javascript: 등)은
|
||||||
# "jav	ascript:" 처럼 중간에 탭/개행을 끼우면 통과하는데, 브라우저는 URL 을
|
# "jav	ascript:" 처럼 중간에 탭/개행을 끼우면 통과하는데, 브라우저는 URL 을
|
||||||
@@ -368,6 +370,8 @@ def inline_safe_content_type(content_type: Any) -> bool:
|
|||||||
return norm_str(content_type, lower=True).split(";", 1)[0].strip() in INLINE_SAFE_CONTENT_TYPES
|
return norm_str(content_type, lower=True).split(";", 1)[0].strip() in INLINE_SAFE_CONTENT_TYPES
|
||||||
# 멘션 칩: <span class="pj-mention" data-email="...">@이름</span>
|
# 멘션 칩: <span class="pj-mention" data-email="...">@이름</span>
|
||||||
_MENTION_CLASS = "pj-mention"
|
_MENTION_CLASS = "pj-mention"
|
||||||
|
# 태그별로 남길 수 있는 class 값(하나씩) — 그 밖의 class 는 버린다.
|
||||||
|
_DESC_ALLOWED_CLASS: dict[str, str] = {"span": _MENTION_CLASS, "ul": "pj-checklist"}
|
||||||
# script/style 은 태그 자체는 물론 그 안의 텍스트(코드)도 통째로 버린다 —
|
# script/style 은 태그 자체는 물론 그 안의 텍스트(코드)도 통째로 버린다 —
|
||||||
# 허용 태그 목록에 없어 태그는 이미 안 남지만, HTMLParser는 이 둘의 내용을
|
# 허용 태그 목록에 없어 태그는 이미 안 남지만, HTMLParser는 이 둘의 내용을
|
||||||
# 별도 데이터로 넘기므로 handle_data 에서 따로 걸러야 한다.
|
# 별도 데이터로 넘기므로 handle_data 에서 따로 걸러야 한다.
|
||||||
@@ -438,9 +442,9 @@ class _DescriptionSanitizer(HTMLParser):
|
|||||||
continue
|
continue
|
||||||
if name == "src" and not desc_url_is_safe(value, allow_data_image=True):
|
if name == "src" and not desc_url_is_safe(value, allow_data_image=True):
|
||||||
continue
|
continue
|
||||||
# class 는 멘션 칩 하나만 허용한다(임의 클래스로 화면 스타일을
|
# class 는 태그마다 정해진 값 하나만(멘션 칩·체크리스트) — 임의 클래스로
|
||||||
# 흔들 여지를 남기지 않는다).
|
# 화면 스타일을 흔들 여지를 남기지 않는다.
|
||||||
if name == "class" and value.strip() != _MENTION_CLASS:
|
if name == "class" and value.strip() != _DESC_ALLOWED_CLASS.get(tag):
|
||||||
continue
|
continue
|
||||||
kept.append(f'{name}="{_desc_escape_attr(value)}"')
|
kept.append(f'{name}="{_desc_escape_attr(value)}"')
|
||||||
attr_text = (" " + " ".join(kept)) if kept else ""
|
attr_text = (" " + " ".join(kept)) if kept else ""
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
{% extends "erp_base.html" %}
|
{% extends "erp_base.html" %}
|
||||||
|
|
||||||
{% block head_extra %}
|
{% block head_extra %}
|
||||||
<link rel="stylesheet" href="/static/project.css?v=20260926p" />
|
<link rel="stylesheet" href="/static/project.css?v=20260926q" />
|
||||||
<link rel="stylesheet" href="/static/project-help.css?v=20260926p" />
|
<link rel="stylesheet" href="/static/project-help.css?v=20260926q" />
|
||||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
@@ -275,7 +275,7 @@
|
|||||||
<h3>설명</h3>
|
<h3>설명</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li>서식 도구(왼쪽부터): <span class="pjh-ui"><span class="material-symbols-outlined">format_bold</span></span> 굵게 · <span class="pjh-ui"><span class="material-symbols-outlined">format_italic</span></span> 기울임 · <span class="pjh-ui"><span class="material-symbols-outlined">format_underlined</span></span> 밑줄 · <span class="pjh-ui"><span class="material-symbols-outlined">format_strikethrough</span></span> 취소선(<kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>X</kbd>) · <span class="pjh-ui"><span class="material-symbols-outlined">format_list_bulleted</span></span> 글머리 목록 · <span class="pjh-ui"><span class="material-symbols-outlined">format_list_numbered</span></span> 번호 목록 · <span class="pjh-ui"><span class="material-symbols-outlined">check_box</span></span> 체크박스 · <span class="pjh-ui"><span class="material-symbols-outlined">format_quote</span></span> 인용 · <span class="pjh-ui"><span class="material-symbols-outlined">link</span></span> 링크 · <span class="pjh-ui"><span class="material-symbols-outlined">format_clear</span></span> 서식 지우기 · <span class="pjh-ui"><span class="material-symbols-outlined">image</span></span> 이미지 넣기. 아이콘에 마우스를 올리면 이름이 나옵니다.</li>
|
<li>서식 도구(왼쪽부터): <span class="pjh-ui"><span class="material-symbols-outlined">format_bold</span></span> 굵게 · <span class="pjh-ui"><span class="material-symbols-outlined">format_italic</span></span> 기울임 · <span class="pjh-ui"><span class="material-symbols-outlined">format_underlined</span></span> 밑줄 · <span class="pjh-ui"><span class="material-symbols-outlined">format_strikethrough</span></span> 취소선(<kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>X</kbd>) · <span class="pjh-ui"><span class="material-symbols-outlined">format_list_bulleted</span></span> 글머리 목록 · <span class="pjh-ui"><span class="material-symbols-outlined">format_list_numbered</span></span> 번호 목록 · <span class="pjh-ui"><span class="material-symbols-outlined">check_box</span></span> 체크박스 · <span class="pjh-ui"><span class="material-symbols-outlined">format_quote</span></span> 인용 · <span class="pjh-ui"><span class="material-symbols-outlined">link</span></span> 링크 · <span class="pjh-ui"><span class="material-symbols-outlined">format_clear</span></span> 서식 지우기 · <span class="pjh-ui"><span class="material-symbols-outlined">image</span></span> 이미지 넣기. 아이콘에 마우스를 올리면 이름이 나옵니다.</li>
|
||||||
<li><b>체크박스</b> — 커서 자리에 체크박스가 들어갑니다. 누를 때마다 체크/해제되고, <b>저장</b>하면 체크 상태도 그대로 남습니다. 글머리 목록과 함께 쓰면 할 일 목록처럼 쓸 수 있어요.</li>
|
<li><b>체크박스(체크리스트)</b> — 글머리 목록처럼 씁니다. <span class="pjh-ui"><span class="material-symbols-outlined">check_box</span></span>를 누르면 지금 줄(또는 고른 줄들)이 체크리스트가 되어 줄마다 체크박스가 붙습니다. <kbd>Enter</kbd>로 새 줄을 만들면 체크박스도 함께 생기고, 빈 줄에서 <kbd>Enter</kbd>를 누르면 목록이 끝납니다. 체크박스를 누르면 체크되고 그 줄은 흐리게 취소선이 그어집니다. 다시 <span class="pjh-ui"><span class="material-symbols-outlined">check_box</span></span>를 누르면 평범한 글로, 글머리·번호 버튼을 누르면 그 목록으로 바뀝니다. 체크 상태는 <b>저장</b>하면 그대로 남습니다.</li>
|
||||||
<li><b>이미지</b> — 캡처한 그림을 <kbd>Ctrl</kbd>+<kbd>V</kbd>로 바로 붙여 넣을 수 있습니다. 그림을 누르면 모서리를 끌어 크기를 바꾸거나 지울 수 있습니다.</li>
|
<li><b>이미지</b> — 캡처한 그림을 <kbd>Ctrl</kbd>+<kbd>V</kbd>로 바로 붙여 넣을 수 있습니다. 그림을 누르면 모서리를 끌어 크기를 바꾸거나 지울 수 있습니다.</li>
|
||||||
<li><b>링크</b> — 웹 주소를 붙여 넣으면 자동으로 링크가 되고, 누르면 새 탭에서 열립니다.</li>
|
<li><b>링크</b> — 웹 주소를 붙여 넣으면 자동으로 링크가 되고, 누르면 새 탭에서 열립니다.</li>
|
||||||
<li><b>@태그</b> — <kbd>@</kbd>를 누르면 사람 목록이 뜹니다. 고른 사람의 수신함에 이 작업이 쌓입니다.</li>
|
<li><b>@태그</b> — <kbd>@</kbd>를 누르면 사람 목록이 뜹니다. 고른 사람의 수신함에 이 작업이 쌓입니다.</li>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{% extends "erp_base.html" %}
|
{% extends "erp_base.html" %}
|
||||||
|
|
||||||
{% block head_extra %}
|
{% block head_extra %}
|
||||||
<link rel="stylesheet" href="/static/project.css?v=20260926p" />
|
<link rel="stylesheet" href="/static/project.css?v=20260926q" />
|
||||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
@@ -101,5 +101,5 @@
|
|||||||
{% include "project/_side_modals.html" %}
|
{% include "project/_side_modals.html" %}
|
||||||
{% include "project/_member_tasks_modal.html" %}
|
{% include "project/_member_tasks_modal.html" %}
|
||||||
|
|
||||||
<script src="/static/project.js?v=20260926p" defer></script>
|
<script src="/static/project.js?v=20260926q" defer></script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{% extends "erp_base.html" %}
|
{% extends "erp_base.html" %}
|
||||||
|
|
||||||
{% block head_extra %}
|
{% block head_extra %}
|
||||||
<link rel="stylesheet" href="/static/project.css?v=20260926p" />
|
<link rel="stylesheet" href="/static/project.css?v=20260926q" />
|
||||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
@@ -100,5 +100,5 @@
|
|||||||
"today": {{ today | tojson }}
|
"today": {{ today | tojson }}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<script src="/static/project.js?v=20260926p" defer></script>
|
<script src="/static/project.js?v=20260926q" defer></script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{% extends "erp_base.html" %}
|
{% extends "erp_base.html" %}
|
||||||
|
|
||||||
{% block head_extra %}
|
{% block head_extra %}
|
||||||
<link rel="stylesheet" href="/static/project.css?v=20260926p" />
|
<link rel="stylesheet" href="/static/project.css?v=20260926q" />
|
||||||
<!-- 구글 머티리얼 심볼(담당자 아이콘 등) — self-host -->
|
<!-- 구글 머티리얼 심볼(담당자 아이콘 등) — self-host -->
|
||||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||||
<!-- 타임라인 vis-timeline — self-host -->
|
<!-- 타임라인 vis-timeline — self-host -->
|
||||||
@@ -472,5 +472,5 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script src="/static/vendor/vis-timeline/vis-timeline-graph2d.min.js"></script>
|
<script src="/static/vendor/vis-timeline/vis-timeline-graph2d.min.js"></script>
|
||||||
<script src="/static/project.js?v=20260926p" defer></script>
|
<script src="/static/project.js?v=20260926q" defer></script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{% extends "erp_base.html" %}
|
{% extends "erp_base.html" %}
|
||||||
|
|
||||||
{% block head_extra %}
|
{% block head_extra %}
|
||||||
<link rel="stylesheet" href="/static/project.css?v=20260926p" />
|
<link rel="stylesheet" href="/static/project.css?v=20260926q" />
|
||||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
@@ -70,5 +70,5 @@
|
|||||||
{% include "project/_side_modals.html" %}
|
{% include "project/_side_modals.html" %}
|
||||||
{% include "project/_member_tasks_modal.html" %}
|
{% include "project/_member_tasks_modal.html" %}
|
||||||
|
|
||||||
<script src="/static/project.js?v=20260926p" defer></script>
|
<script src="/static/project.js?v=20260926q" defer></script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
+11
-1
@@ -501,7 +501,14 @@
|
|||||||
.pj-task-panel-resizer:hover, .pj-task-panel-resizer.is-dragging { background: var(--pj-accent-tint); }
|
.pj-task-panel-resizer:hover, .pj-task-panel-resizer.is-dragging { background: var(--pj-accent-tint); }
|
||||||
|
|
||||||
.pj-task-modal-card > .pj-t-title-input { flex: none; }
|
.pj-task-modal-card > .pj-t-title-input { flex: none; }
|
||||||
.pj-task-modal-card .pj-modal-body { flex: 1 1 auto; min-height: 0; }
|
/* 작업 창 스크롤 영역 — 오른쪽 여백(카드 padding 22px)까지 넓혀 세로 스크롤바를 창 오른쪽 끝에
|
||||||
|
붙이고, 가로 스크롤은 막는다. 왼쪽도 8px 넓혀 두어 설명란(좌우 음수 여백 8px)의 옅은 바탕이
|
||||||
|
잘리지 않는다. 안쪽 padding 으로 되돌려 내용 위치는 그대로다. */
|
||||||
|
.pj-task-modal-card .pj-modal-body {
|
||||||
|
flex: 1 1 auto; min-height: 0;
|
||||||
|
overflow-x: hidden; overflow-y: auto;
|
||||||
|
margin: 0 -22px 0 -8px; padding: 0 22px 0 8px;
|
||||||
|
}
|
||||||
.pj-task-modal-card .pj-modal-actions { flex: none; }
|
.pj-task-modal-card .pj-modal-actions { flex: none; }
|
||||||
/* 위에서 아래로 쭉 쌓는 단일 칼럼 — 메타 → 설명 → 하위업무 →
|
/* 위에서 아래로 쭉 쌓는 단일 칼럼 — 메타 → 설명 → 하위업무 →
|
||||||
(첨부파일|연결된 프로젝트 2열) → 댓글(팝업 너비 전체) 순서. 각 구간은
|
(첨부파일|연결된 프로젝트 2열) → 댓글(팝업 너비 전체) 순서. 각 구간은
|
||||||
@@ -999,6 +1006,9 @@ label.pj-desc-fmtbtn {
|
|||||||
display: inline-flex; align-items: center; justify-content: center; margin: 0;
|
display: inline-flex; align-items: center; justify-content: center; margin: 0;
|
||||||
line-height: normal; font-size: 13px; font-weight: 400; color: #444;
|
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; }
|
||||||
/* 설명란 체크박스(서식 도구 ☑) — 누르면 체크/해제, 체크 여부는 저장된다 */
|
/* 설명란 체크박스(서식 도구 ☑) — 누르면 체크/해제, 체크 여부는 저장된다 */
|
||||||
.pj-desc-editor input[type="checkbox"] {
|
.pj-desc-editor input[type="checkbox"] {
|
||||||
width: 15px; height: 15px; margin: 0 4px 0 1px; vertical-align: -2px; cursor: pointer;
|
width: 15px; height: 15px; margin: 0 4px 0 1px; vertical-align: -2px; cursor: pointer;
|
||||||
|
|||||||
+115
-4
@@ -4977,6 +4977,101 @@
|
|||||||
// 크롬/엣지는 여전히 지원하고, 이미 같은 파일의 이미지 삽입에서도 쓰고
|
// 크롬/엣지는 여전히 지원하고, 이미 같은 파일의 이미지 삽입에서도 쓰고
|
||||||
// 있어(insertHTML) 일관된 패턴이다. 버튼 mousedown 에서 preventDefault
|
// 있어(insertHTML) 일관된 패턴이다. 버튼 mousedown 에서 preventDefault
|
||||||
// 안 하면 클릭 순간 에디터가 포커스를 잃어 선택 범위가 풀린다.
|
// 안 하면 클릭 순간 에디터가 포커스를 잃어 선택 범위가 풀린다.
|
||||||
|
// ── 체크리스트(서식 도구 ☑) — 글머리 목록처럼 줄마다 체크박스.
|
||||||
|
// <ul class="pj-checklist"><li><input type="checkbox">할 일</li>…</ul>
|
||||||
|
// (서버 정리기는 ul 의 class 로 pj-checklist 하나만, input 은 체크박스·checked 만 남긴다)
|
||||||
|
function selNode() {
|
||||||
|
const sel = window.getSelection();
|
||||||
|
if (!sel || !sel.rangeCount) return null;
|
||||||
|
const n = sel.getRangeAt(0).startContainer;
|
||||||
|
return n.nodeType === 1 ? n : n.parentElement;
|
||||||
|
}
|
||||||
|
function closestIn(n, selector) {
|
||||||
|
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;
|
||||||
|
const items = Array.prototype.filter.call(listEl.children, function (li) {
|
||||||
|
return li.tagName === "LI" && r && r.intersectsNode(li);
|
||||||
|
});
|
||||||
|
if (!items.length) { const li = closestIn(selNode(), "li"); if (li) items.push(li); }
|
||||||
|
return items;
|
||||||
|
}
|
||||||
|
// 체크박스가 하나도 없는 체크리스트는 평범한 목록으로, 줄마다 체크박스가 있는 ul 은 체크리스트로
|
||||||
|
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");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function toggleChecklist() {
|
||||||
|
const cur = closestIn(selNode(), "ul.pj-checklist");
|
||||||
|
if (cur) {
|
||||||
|
// 끄기 — 고른 줄의 체크박스를 빼고 목록에서 뺀다(글머리 버튼을 다시 누른 것과 같음)
|
||||||
|
selectedItems(cur).forEach(function (li) { const cb = leadingBox(li); if (cb) cb.remove(); });
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
normalizeChecklists();
|
||||||
|
}
|
||||||
|
// 체크리스트 줄에서 Enter — 새 줄에도 체크박스(체크 안 된 채). 빈 줄에서 Enter 는 목록 끝.
|
||||||
|
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 }));
|
||||||
|
}, 0);
|
||||||
|
});
|
||||||
|
|
||||||
const fmtbar = el("pj-desc-fmtbar");
|
const fmtbar = el("pj-desc-fmtbar");
|
||||||
if (fmtbar) {
|
if (fmtbar) {
|
||||||
fmtbar.addEventListener("mousedown", function (e) { e.preventDefault(); });
|
fmtbar.addEventListener("mousedown", function (e) { e.preventDefault(); });
|
||||||
@@ -4990,12 +5085,23 @@
|
|||||||
arg = prompt("연결할 주소(URL)를 입력하세요", "https://");
|
arg = prompt("연결할 주소(URL)를 입력하세요", "https://");
|
||||||
if (!arg) return;
|
if (!arg) return;
|
||||||
}
|
}
|
||||||
// 체크박스 — 커서 자리에 체크박스 하나 + 공백. 누르면 체크/해제(아래 클릭 처리).
|
// 체크리스트 — 글머리 목록처럼 켜고 끈다(줄마다 체크박스).
|
||||||
if (cmd === "insertCheckbox") {
|
if (cmd === "insertCheckbox") {
|
||||||
try { document.execCommand("insertHTML", false, '<input type="checkbox"> '); } catch (_) {}
|
toggleChecklist();
|
||||||
box.dispatchEvent(new Event("input", { bubbles: true }));
|
box.dispatchEvent(new Event("input", { bubbles: true }));
|
||||||
|
updateFmtState();
|
||||||
return;
|
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(); });
|
||||||
|
cl.classList.remove("pj-checklist");
|
||||||
|
if (!cl.className) cl.removeAttribute("class");
|
||||||
|
if (cmd === "insertUnorderedList") { box.dispatchEvent(new Event("input", { bubbles: true })); updateFmtState(); return; }
|
||||||
|
}
|
||||||
|
}
|
||||||
try { document.execCommand(cmd, false, arg); } catch (_) {}
|
try { document.execCommand(cmd, false, arg); } catch (_) {}
|
||||||
if (cmd === "createLink") normalizeEditorLinks(box);
|
if (cmd === "createLink") normalizeEditorLinks(box);
|
||||||
updateFmtState();
|
updateFmtState();
|
||||||
@@ -5003,9 +5109,14 @@
|
|||||||
function updateFmtState() {
|
function updateFmtState() {
|
||||||
fmtbar.querySelectorAll(".pj-desc-fmtbtn[data-cmd]").forEach(function (btn) {
|
fmtbar.querySelectorAll(".pj-desc-fmtbtn[data-cmd]").forEach(function (btn) {
|
||||||
const cmd = btn.dataset.cmd;
|
const cmd = btn.dataset.cmd;
|
||||||
if (cmd === "createLink" || cmd === "removeFormat" || cmd === "insertCheckbox") return;
|
if (cmd === "createLink" || cmd === "removeFormat") return;
|
||||||
|
const inChecklist = !!closestIn(selNode(), "ul.pj-checklist");
|
||||||
let active = false;
|
let active = false;
|
||||||
try { active = document.queryCommandState(cmd); } catch (_) { active = false; }
|
if (cmd === "insertCheckbox") active = inChecklist;
|
||||||
|
else {
|
||||||
|
try { active = document.queryCommandState(cmd); } catch (_) { active = false; }
|
||||||
|
if (cmd === "insertUnorderedList" && inChecklist) active = false;
|
||||||
|
}
|
||||||
btn.classList.toggle("is-active", active);
|
btn.classList.toggle("is-active", active);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user