From 4171d61db15b520b91616be17afaefdeeda944f2 Mon Sep 17 00:00:00 2001 From: king Date: Wed, 4 Nov 2026 21:24:18 +0900 Subject: [PATCH] =?UTF-8?q?feat(=EC=B9=B4=ED=8E=9824):=20=EC=86=8C?= =?UTF-8?q?=EC=8A=A4=20=ED=8E=B8=EC=A7=91=EA=B8=B0=20=EC=9D=B4=EB=AF=B8?= =?UTF-8?q?=EC=A7=80=20=ED=8C=8C=EC=9D=BC=EB=AA=85=20=EB=B2=88=ED=98=B8=20?= =?UTF-8?q?=EB=8B=A8=EC=B6=95=ED=82=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit img 태그 안에서 커서 바로 뒤가 .jpg/.gif/.png 일 때 Ctrl+위/아래로 파일명 번호를 바꾼다(없음 → _2 → _3 …, 내리면 _2 다음은 원래 이름). Co-Authored-By: Claude Opus 5.5 --- app/modules/cafe24/CLAUDE.md | 1 + .../cafe24/templates/cafe24/_editor.html | 2 +- .../cafe24/templates/cafe24/products.html | 24 +++++++++++++++++++ app/static/cafe24.css | 1 - 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/app/modules/cafe24/CLAUDE.md b/app/modules/cafe24/CLAUDE.md index 5795848..582d1e6 100644 --- a/app/modules/cafe24/CLAUDE.md +++ b/app/modules/cafe24/CLAUDE.md @@ -10,6 +10,7 @@ - 카페24 관리자에 들어가지 않고 상품 상세페이지(description HTML) 조회·편집·즉시적용·예약적용·버전 이력. - 3분할 화면(목록 | HTML 편집기 | 상품 정보 패널). - HTML 편집기에서 `` 태그에 마우스를 올리면 태그를 오렌지색으로 칠하고 화면 오른쪽에 폭 500px·창 높이로 파일명과 미리보기(상대 경로는 `CAFE24_SHOP_URL` 루트 기준, 색칠 한도 `HL_LIMIT` 초과 소스는 미동작). +- HTML 편집기 `` 안에서 커서 바로 뒤가 `.jpg`/`.gif`/`.png` 일 때 Ctrl+↑/↓ 로 파일명 번호 변경(없음 → `_2` → `_3` …, 내리면 `_2` 다음은 원래 이름, `_2`~`_99` 만 번호로 인식). - 정보 패널(`routes_product_info.py`, `_side.html`)에서 상품명·판매가·공급가·소비자가, 대표이미지, 옵션(생성/이름·썸네일·표시방식 수정/삭제)·품목(자체코드·추가금액·진열·판매) 수정. - 대표이미지는 `POST /admin/products/{no}/images` 에 base64 data URI + `image_upload_type=A`. NNEditor 업로드 경로를 PUT `detail_image` 에 넣는 방식은 적용 안 됨. diff --git a/app/modules/cafe24/templates/cafe24/_editor.html b/app/modules/cafe24/templates/cafe24/_editor.html index 29d0104..4374a6d 100644 --- a/app/modules/cafe24/templates/cafe24/_editor.html +++ b/app/modules/cafe24/templates/cafe24/_editor.html @@ -122,7 +122,7 @@
- 단축키: 주석토글[Ctrl+/] · 줄 복사[Alt+Shift+↑↓] · 줄 이동[Alt+↑↓] · 줄 삭제[Shift+Del] + 단축키: 주석토글[Ctrl+/] · 줄 복사[Alt+Shift+↑↓] · 줄 이동[Alt+↑↓] · 줄 삭제[Shift+Del] · 이미지 번호[Ctrl+↑↓] diff --git a/app/modules/cafe24/templates/cafe24/products.html b/app/modules/cafe24/templates/cafe24/products.html index 7874396..d80a355 100644 --- a/app/modules/cafe24/templates/cafe24/products.html +++ b/app/modules/cafe24/templates/cafe24/products.html @@ -368,6 +368,26 @@ applyEdit(from, to, "", lineFrom + col, lineFrom + col); } + /* Ctrl+↑/↓ — 안에서 커서 바로 뒤가 .jpg/.gif/.png 이면 파일명 번호를 바꾼다. + a.jpg → a_2.jpg → a_3.jpg …, 내릴 때는 _2 다음이 원래 이름. 커서는 확장자 앞에 그대로 둔다. + _2~_99 만 번호로 본다(product_2024.jpg 의 2024 는 번호가 아니다). + 조건이 안 맞으면 false — 브라우저 기본 동작을 막지 않는다. */ + function stepImgSuffix(up) { + var at = ta.selectionStart, value = ta.value; + if (at !== ta.selectionEnd || !/^\.(jpg|gif|png)/i.test(value.slice(at, at + 4))) return false; + var head = value.slice(value.lastIndexOf("<", at - 1), at); + if (!/^]*$/i.test(head)) return false; + + var m = head.match(/_([2-9]|[1-9]\d)$/); + var n = m ? Number(m[1]) : 1; + if (up ? n >= 99 : !m) return true; // 더 갈 곳이 없다 + var next = up ? n + 1 : n - 1; + var text = next < 2 ? "" : "_" + next; + var from = at - (m ? m[0].length : 0); + applyEdit(from, at, text, from + text.length, from + text.length); + return true; + } + /* 이미지 미리보기 — 맨 위 textarea 를 판정에서 잠깐 빼고 색칠 층의 를 찾는다. 글자 폭을 계산하지 않아 한글·탭·여러 줄 태그에서도 위치가 어긋나지 않는다. shortcut: HL_LIMIT 초과 소스는 색칠을 안 해 미리보기도 안 뜬다, 그런 상품이 나오면 글자 위치 계산으로 교체. */ @@ -408,6 +428,10 @@ else moveLines(isDown); return; } + if (e.ctrlKey && !e.altKey && !e.metaKey && !e.shiftKey && (isUp || isDown) && stepImgSuffix(isUp)) { + e.preventDefault(); + return; + } // Shift+Delete — 줄 삭제. (윈도우 기본 동작인 "잘라내기"를 대신한다) if (e.shiftKey && !e.ctrlKey && !e.altKey && !e.metaKey && (e.key === "Delete" || e.code === "Delete")) { diff --git a/app/static/cafe24.css b/app/static/cafe24.css index 4c23554..17ac2ed 100644 --- a/app/static/cafe24.css +++ b/app/static/cafe24.css @@ -278,7 +278,6 @@ .cf24-shortcuts { font-size: var(--text-caption, 12px); color: #79a6dd; - white-space: nowrap; } /* 편집 폼과 코드 칸은 **줄어들지 않는다.** 아래 「예약 적용」·「버전 이력」을 펼치면