diff --git a/static/js/components/ContextMenu/LoraContextMenu.js b/static/js/components/ContextMenu/LoraContextMenu.js index 7991d3b7..ed155ab5 100644 --- a/static/js/components/ContextMenu/LoraContextMenu.js +++ b/static/js/components/ContextMenu/LoraContextMenu.js @@ -3,7 +3,7 @@ import { refreshSingleLoraMetadata, saveModelMetadata } from '../../api/loraApi. import { showToast, getNSFWLevelName, copyToClipboard, sendLoraToWorkflow } from '../../utils/uiHelpers.js'; import { NSFW_LEVELS } from '../../utils/constants.js'; import { getStorageItem } from '../../utils/storageHelpers.js'; -import { showExcludeModal } from '../../utils/modalUtils.js'; +import { showExcludeModal, showDeleteModal } from '../../utils/modalUtils.js'; export class LoraContextMenu extends BaseContextMenu { constructor() { @@ -50,7 +50,8 @@ export class LoraContextMenu extends BaseContextMenu { this.currentCard.querySelector('.fa-image')?.click(); break; case 'delete': - this.currentCard.querySelector('.fa-trash')?.click(); + // Call showDeleteModal directly instead of clicking the trash button + showDeleteModal(this.currentCard.dataset.filepath); break; case 'move': moveManager.showMoveModal(this.currentCard.dataset.filepath); diff --git a/static/js/components/LoraCard.js b/static/js/components/LoraCard.js index 63e48b59..bba68a54 100644 --- a/static/js/components/LoraCard.js +++ b/static/js/components/LoraCard.js @@ -57,9 +57,9 @@ function handleLoraCardEvent(event) { return; } - if (event.target.closest('.fa-trash')) { + if (event.target.closest('.fa-copy')) { event.stopPropagation(); - showDeleteModal(card.dataset.filepath); + copyLoraSyntax(card); return; } @@ -182,6 +182,15 @@ async function sendLoraToComfyUI(card, replaceMode) { sendLoraToWorkflow(loraSyntax, replaceMode, 'lora'); } +// Add function to copy lora syntax +function copyLoraSyntax(card) { + const usageTips = JSON.parse(card.dataset.usage_tips || '{}'); + const strength = usageTips.strength || 1; + const loraSyntax = ``; + + copyToClipboard(loraSyntax, 'LoRA syntax copied to clipboard'); +} + export function createLoraCard(lora) { const card = document.createElement('div'); card.className = 'lora-card'; @@ -273,8 +282,8 @@ export function createLoraCard(lora) { - +