Add file name copy functionality to Lora modal

This commit is contained in:
Will Miao
2025-03-03 11:48:44 +08:00
parent 446d13d832
commit db5d479c0e
2 changed files with 41 additions and 1 deletions

View File

@@ -149,7 +149,10 @@ export function showLoraModal(lora) {
</div>
<div class="info-item">
<label>File Name</label>
<span id="file-name">${lora.file_name || 'N/A'}</span>
<div class="file-name-wrapper" onclick="copyFileName('${lora.file_name}')">
<span id="file-name">${lora.file_name || 'N/A'}</span>
<i class="fas fa-copy" title="Copy file name"></i>
</div>
</div>
<div class="info-item">
<label>Location</label>
@@ -206,6 +209,17 @@ export function showLoraModal(lora) {
setupShowcaseScroll(); // Add this line
}
// 添加复制文件名的函数
window.copyFileName = async function(fileName) {
try {
await navigator.clipboard.writeText(fileName);
showToast('File name copied', 'success');
} catch (err) {
console.error('Copy failed:', err);
showToast('Copy failed', 'error');
}
};
function setupEditableFields() {
const editableFields = document.querySelectorAll('.editable-field [contenteditable]');