diff --git a/static/js/components/LoraCard.js b/static/js/components/LoraCard.js index 59c4b6f5..f59df52b 100644 --- a/static/js/components/LoraCard.js +++ b/static/js/components/LoraCard.js @@ -266,6 +266,8 @@ function setupEditableFields() { presetValue.type = 'number'; presetValue.step = 1; } + // Add auto-focus + setTimeout(() => presetValue.focus(), 0); } else { presetValue.style.display = 'none'; } @@ -299,6 +301,33 @@ function setupEditableFields() { presetValue.value = ''; 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) {