mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-24 22:52:12 -03:00
Add auto-focus to preset value and keydown event listeners for notes and preset actions
This commit is contained in:
@@ -266,6 +266,8 @@ function setupEditableFields() {
|
|||||||
presetValue.type = 'number';
|
presetValue.type = 'number';
|
||||||
presetValue.step = 1;
|
presetValue.step = 1;
|
||||||
}
|
}
|
||||||
|
// Add auto-focus
|
||||||
|
setTimeout(() => presetValue.focus(), 0);
|
||||||
} else {
|
} else {
|
||||||
presetValue.style.display = 'none';
|
presetValue.style.display = 'none';
|
||||||
}
|
}
|
||||||
@@ -299,6 +301,33 @@ function setupEditableFields() {
|
|||||||
presetValue.value = '';
|
presetValue.value = '';
|
||||||
presetValue.style.display = 'none';
|
presetValue.style.display = 'none';
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Add keydown event listeners for notes
|
||||||
|
const notesContent = document.querySelector('.notes-content');
|
||||||
|
if (notesContent) {
|
||||||
|
notesContent.addEventListener('keydown', async function(e) {
|
||||||
|
if (e.key === 'Enter') {
|
||||||
|
if (e.shiftKey) {
|
||||||
|
// Allow shift+enter for new line
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
e.preventDefault();
|
||||||
|
const filePath = document.querySelector('.modal-content')
|
||||||
|
.querySelector('.file-path').textContent +
|
||||||
|
document.querySelector('.modal-content')
|
||||||
|
.querySelector('#file-name').textContent + '.safetensors';
|
||||||
|
await saveNotes(filePath);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add keydown event for preset value
|
||||||
|
presetValue.addEventListener('keydown', function(e) {
|
||||||
|
if (e.key === 'Enter') {
|
||||||
|
e.preventDefault();
|
||||||
|
addPresetBtn.click();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
window.saveNotes = async function(filePath) {
|
window.saveNotes = async function(filePath) {
|
||||||
|
|||||||
Reference in New Issue
Block a user