diff --git a/app/modules/cafe24/CLAUDE.md b/app/modules/cafe24/CLAUDE.md
index 38e06b5..5795848 100644
--- a/app/modules/cafe24/CLAUDE.md
+++ b/app/modules/cafe24/CLAUDE.md
@@ -9,7 +9,7 @@
- 카페24 관리자에 들어가지 않고 상품 상세페이지(description HTML) 조회·편집·즉시적용·예약적용·버전 이력.
- 3분할 화면(목록 | HTML 편집기 | 상품 정보 패널).
-- HTML 편집기에서 `
` 태그에 마우스를 올리면 화면 오른쪽에 폭 500px·창 높이로 미리보기(상대 경로는 `CAFE24_SHOP_URL` 루트 기준, 색칠 한도 `HL_LIMIT` 초과 소스는 미동작).
+- HTML 편집기에서 `
` 태그에 마우스를 올리면 태그를 오렌지색으로 칠하고 화면 오른쪽에 폭 500px·창 높이로 파일명과 미리보기(상대 경로는 `CAFE24_SHOP_URL` 루트 기준, 색칠 한도 `HL_LIMIT` 초과 소스는 미동작).
- 정보 패널(`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/products.html b/app/modules/cafe24/templates/cafe24/products.html
index 9f4bbd0..7874396 100644
--- a/app/modules/cafe24/templates/cafe24/products.html
+++ b/app/modules/cafe24/templates/cafe24/products.html
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
-
+
{% endblock %}
{% block content %}
@@ -124,7 +124,7 @@
{# 소스의
위에 마우스를 올리면 화면 오른쪽에 뜨는 미리보기 — setupCodeEditor 가 켜고 끈다. #}
-
![이미지를 불러올 수 없습니다]()
+![이미지를 불러올 수 없습니다]()
{% endblock %}
{% block scripts %}
@@ -186,10 +186,20 @@
catch (err) { return ""; }
}
+ function imgFileName(url) {
+ var name = new URL(url).pathname.split("/").pop();
+ // URL 이 한글 파일명을 %XX 로 바꿔 놓으므로 되돌린다.
+ try { return decodeURIComponent(name); }
+ catch (err) { return name; }
+ }
+
function showImgPreview(url) {
var box = document.getElementById("cf24-img-preview");
- var img = box.firstElementChild;
- if (url && img.getAttribute("src") !== url) img.src = url;
+ var img = box.lastElementChild;
+ if (url && img.getAttribute("src") !== url) {
+ img.src = url;
+ box.firstElementChild.textContent = imgFileName(url);
+ }
box.hidden = !url;
}
@@ -361,14 +371,23 @@
/* 이미지 미리보기 — 맨 위 textarea 를 판정에서 잠깐 빼고 색칠 층의
를 찾는다.
글자 폭을 계산하지 않아 한글·탭·여러 줄 태그에서도 위치가 어긋나지 않는다.
shortcut: HL_LIMIT 초과 소스는 색칠을 안 해 미리보기도 안 뜬다, 그런 상품이 나오면 글자 위치 계산으로 교체. */
+ var hoverTag = null;
+
+ function setHoverTag(tag) {
+ if (tag === hoverTag) return;
+ if (hoverTag) hoverTag.classList.remove("cf24-t-img-on");
+ if (tag) tag.classList.add("cf24-t-img-on");
+ hoverTag = tag;
+ showImgPreview(tag ? imgPreviewUrl(tag.textContent) : "");
+ }
+
ta.addEventListener("mousemove", function (e) {
ta.style.pointerEvents = "none";
var el = document.elementFromPoint(e.clientX, e.clientY);
ta.style.pointerEvents = "";
- var tag = el && el.closest(".cf24-t-img");
- showImgPreview(tag ? imgPreviewUrl(tag.textContent) : "");
+ setHoverTag(el && el.closest(".cf24-t-img"));
});
- ta.addEventListener("mouseleave", function () { showImgPreview(""); });
+ ta.addEventListener("mouseleave", function () { setHoverTag(null); });
ta.addEventListener("scroll", sync);
ta.addEventListener("input", function () { dirty = true; refresh(); });
diff --git a/app/static/cafe24.css b/app/static/cafe24.css
index fd161f9..4c23554 100644
--- a/app/static/cafe24.css
+++ b/app/static/cafe24.css
@@ -469,6 +469,7 @@
/* 색칠 층 안에서
태그만 마우스 판정을 받는다(미리보기용). 평소에는 위의 textarea 가 가린다. */
.cf24-t-img { pointer-events: auto; }
+.cf24-t-img-on { background: #ffa500; }
/* 마우스를 통과시킨다 — 미리보기가 소스를 덮어도 hover 가 끊기지 않게. */
.cf24-img-preview {
@@ -483,10 +484,23 @@
pointer-events: none;
}
+/* 한 줄 고정 높이 — 아래 이미지 높이가 이 값을 뺀 만큼이다. */
+.cf24-img-preview-name {
+ box-sizing: border-box;
+ height: 40px;
+ padding: 0 12px;
+ font-size: 16px;
+ font-weight: 700;
+ line-height: 40px;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+
.cf24-img-preview img {
display: block;
width: 100%;
- height: 100vh;
+ height: calc(100vh - 40px);
object-fit: contain;
}