feat: 템플릿 태그와 병합 가져오기 및 에디터 제거 추가
This commit is contained in:
@@ -473,6 +473,25 @@ function duplicateItemToPool() {
|
||||
toast.success('아이템 추가 완료')
|
||||
}
|
||||
|
||||
function canRemoveEditorItem(itemId) {
|
||||
return canEdit.value && itemsById.value[itemId]?.origin === 'custom'
|
||||
}
|
||||
|
||||
function deleteEditorItem(itemId) {
|
||||
if (!canRemoveEditorItem(itemId)) return
|
||||
const targetItem = itemsById.value[itemId]
|
||||
detachItemById(itemId)
|
||||
if (typeof targetItem?.src === 'string' && targetItem.src.startsWith('blob:')) {
|
||||
URL.revokeObjectURL(targetItem.src)
|
||||
}
|
||||
const nextItems = { ...itemsById.value }
|
||||
delete nextItems[itemId]
|
||||
itemsById.value = nextItems
|
||||
if (selectedItemId.value === itemId) selectedItemId.value = ''
|
||||
if (itemContextMenu.value.itemId === itemId) closeItemContextMenu()
|
||||
toast.success('커스텀 이미지를 현재 티어표에서 제거했어요.')
|
||||
}
|
||||
|
||||
function handleGlobalContextMenu(event) {
|
||||
const target = event?.target
|
||||
if (target?.closest?.('[data-item-context-menu]')) {
|
||||
@@ -1684,6 +1703,16 @@ onUnmounted(() => {
|
||||
>
|
||||
×
|
||||
</button>
|
||||
<button
|
||||
v-if="canRemoveEditorItem(id) && !isExporting"
|
||||
class="cellDeleteBtn"
|
||||
type="button"
|
||||
title="커스텀 이미지 제거"
|
||||
@pointerdown.stop
|
||||
@click.stop="deleteEditorItem(id)"
|
||||
>
|
||||
삭제
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1760,6 +1789,16 @@ onUnmounted(() => {
|
||||
draggable="false"
|
||||
/>
|
||||
<div class="poolItem__label">{{ itemsById[id]?.label || id }}</div>
|
||||
<button
|
||||
v-if="canRemoveEditorItem(id)"
|
||||
class="poolItem__deleteBtn"
|
||||
type="button"
|
||||
title="커스텀 이미지 제거"
|
||||
@pointerdown.stop
|
||||
@click.stop="deleteEditorItem(id)"
|
||||
>
|
||||
삭제
|
||||
</button>
|
||||
<div v-if="!canEdit" class="poolItem__state">미배치</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1777,6 +1816,9 @@ onUnmounted(() => {
|
||||
<button class="itemContextMenu__action" type="button" @click="duplicateItemToPool">
|
||||
아이템 복제
|
||||
</button>
|
||||
<button v-if="canRemoveEditorItem(itemContextMenu.itemId)" class="itemContextMenu__action itemContextMenu__action--danger" type="button" @click="deleteEditorItem(itemContextMenu.itemId)">
|
||||
이 커스텀 이미지 제거
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -3024,6 +3066,7 @@ onUnmounted(() => {
|
||||
cursor: copy;
|
||||
}
|
||||
.poolItem {
|
||||
position: relative;
|
||||
min-width: 0;
|
||||
display: grid;
|
||||
grid-template-columns: 1fr;
|
||||
@@ -3070,6 +3113,23 @@ onUnmounted(() => {
|
||||
text-transform: uppercase;
|
||||
color: var(--theme-text-soft);
|
||||
}
|
||||
.poolItem__deleteBtn,
|
||||
.cellDeleteBtn {
|
||||
position: absolute;
|
||||
right: 8px;
|
||||
bottom: 8px;
|
||||
border: 0;
|
||||
border-radius: 999px;
|
||||
padding: 6px 9px;
|
||||
background: rgba(11, 18, 32, 0.84);
|
||||
color: #fff;
|
||||
font-size: 10px;
|
||||
font-weight: 800;
|
||||
cursor: pointer;
|
||||
}
|
||||
.cellDeleteBtn {
|
||||
bottom: 34px;
|
||||
}
|
||||
.poolItem--hidden {
|
||||
display: none;
|
||||
}
|
||||
@@ -3101,6 +3161,9 @@ onUnmounted(() => {
|
||||
.itemContextMenu__action:hover {
|
||||
background: var(--theme-pill-bg);
|
||||
}
|
||||
.itemContextMenu__action--danger {
|
||||
color: #fca5a5;
|
||||
}
|
||||
|
||||
.hidden {
|
||||
display: none;
|
||||
|
||||
Reference in New Issue
Block a user