Inline edit, URL-driven meta refresh, drag gap animation, copy-from-music
Music list tab:
- Title + artist are now contenteditable in-place. Typing updates state on
every input event; Enter blurs (no embedded newlines), and on Save the
current DOM text is re-synced into state.music[i].title/.artist before
the JSON POST so a quick-save right after typing doesn't drop the last
keystroke. While focused, the field is highlighted with the accent
outline and unclamped so long titles wrap. Empty cells show a muted
placeholder via :empty::before { content: attr(data-placeholder) }.
- Edit modal "save" now POSTs the new URL to /op/list/<pack>/video-meta
(new endpoint backed by yt-dlp --dump-json --no-playlist) and patches
state.music[i] with the returned title/channel/durationSec. If yt-dlp
is unavailable or the lookup fails, the modal asks the user whether to
apply just the URL change without metadata.
- Drag-and-drop UX: replaced the simple "highlight target" feedback with a
"gap opens above the target" animation. The hovered row gets a
.dropAbove class that animates margin-top to 64px via CSS transition,
visually carving out the slot the dragged item will land in. Insertion
math is now strictly "drop before the hover target" (with the
srcIdx<dstIdx → dstIdx-1 adjustment after the splice removal), matching
what the gap implies. Contenteditable spans no longer hijack drag start
— on focus the parent <li>.draggable is flipped off so the user can
freely select text, and back on at blur.
Image list tab:
- New "음악목록에서 가져오기" button. Copies state.music[*].url into
state.images, which (via the existing thumbUrl() helper) renders each
song's YouTube thumbnail as the image. Behind a confirm prompt because
it replaces the entire image list.
- Same drag gap animation (.dropAbove → margin-left 80px) applied to the
grid cards for consistency.
Server:
- youtube.ts: add fetchVideoMeta(url) using the same ensureYtDlp() path
(auto-installed binary under %appdata%/.mc_custom). Returns one
YtPlaylistEntry or null.
- routes/op.ts: POST /op/list/:packName/video-meta. 400 on missing URL,
503 NO_YTDLP if the auto-install failed, 500 on other yt-dlp errors,
200 { ok: true, entry } otherwise.
Smoke test (Rick Astley URL) returns
title=Rick Astley - Never Gonna..., channel=Rick Astley, durationSec=213.
This commit is contained in:
@@ -412,14 +412,37 @@ body.siteBody.centerLayout {
|
||||
padding: 8px 12px; background: var(--bg-card);
|
||||
border: 1px solid var(--border); border-radius: 8px;
|
||||
cursor: grab; user-select: none;
|
||||
transition: margin-top 0.18s ease, border-color 0.12s ease;
|
||||
}
|
||||
.trackRow.dragging { opacity: 0.5; }
|
||||
.trackRow.dragOver { border-color: var(--accent); }
|
||||
/* 드래그 중 hover 표시: 위쪽으로 64px 공간이 벌어지며 "여기 끼울 수 있다" 를 표현 */
|
||||
.trackRow.dropAbove { margin-top: 64px; border-color: var(--accent); }
|
||||
.rowNum { color: var(--text-muted); font-size: 14px; text-align: center; }
|
||||
.rowThumb { width: 80px; height: 45px; object-fit: cover; border-radius: 4px; background: #000; }
|
||||
.rowMeta { min-width: 0; }
|
||||
.rowTitle { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||
.rowSub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
|
||||
.rowTitle {
|
||||
font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
|
||||
outline: none; border-radius: 4px; padding: 2px 4px; margin: -2px -4px;
|
||||
}
|
||||
.rowSub {
|
||||
font-size: 12px; color: var(--text-muted); margin-top: 2px;
|
||||
outline: none; border-radius: 4px; padding: 2px 4px;
|
||||
}
|
||||
.rowTitle[contenteditable="true"]:hover,
|
||||
.rowSub[contenteditable="true"]:hover { background: rgba(255,255,255,0.04); }
|
||||
.rowTitle[contenteditable="true"]:focus,
|
||||
.rowSub[contenteditable="true"]:focus {
|
||||
background: var(--bg);
|
||||
box-shadow: 0 0 0 1px var(--accent);
|
||||
white-space: normal; cursor: text;
|
||||
}
|
||||
/* placeholder 효과: 비어 있을 때 회색 안내 텍스트 */
|
||||
.rowTitle[contenteditable="true"]:empty::before,
|
||||
.rowSub[contenteditable="true"]:empty::before {
|
||||
content: attr(data-placeholder);
|
||||
color: var(--text-muted);
|
||||
opacity: 0.6;
|
||||
}
|
||||
.rowDur { color: var(--text-muted); font-size: 13px; }
|
||||
|
||||
/* 사진 그리드 */
|
||||
@@ -432,9 +455,11 @@ body.siteBody.centerLayout {
|
||||
position: relative; aspect-ratio: 1 / 1; background: var(--bg-card);
|
||||
border: 1px solid var(--border); border-radius: 10px;
|
||||
overflow: hidden; cursor: grab; user-select: none;
|
||||
transition: margin-left 0.18s ease, border-color 0.12s ease;
|
||||
}
|
||||
.imageCard.dragging { opacity: 0.5; }
|
||||
.imageCard.dragOver { border-color: var(--accent); }
|
||||
/* 사진 그리드도 동일하게 "옆이 벌어진다" 표현 */
|
||||
.imageCard.dropAbove { margin-left: 80px; border-color: var(--accent); }
|
||||
.imageCard img { width: 100%; height: 100%; object-fit: cover; display: block; }
|
||||
.cardNum {
|
||||
position: absolute; top: 6px; left: 6px;
|
||||
|
||||
Reference in New Issue
Block a user