mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
add more keyboard support on the web server (#391)
add ability to submit prompts with the "enter" key add ability to cancel generations with the "escape" key
This commit is contained in:
parent
dd2aedacaf
commit
7670ecc63f
@ -154,6 +154,12 @@ async function generateSubmit(form) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
window.onload = () => {
|
window.onload = () => {
|
||||||
|
document.querySelector("#prompt").addEventListener("keydown", (e) => {
|
||||||
|
if (e.key === "Enter" && !e.shiftKey) {
|
||||||
|
const form = e.target.form;
|
||||||
|
generateSubmit(form);
|
||||||
|
}
|
||||||
|
});
|
||||||
document.querySelector("#generate-form").addEventListener('submit', (e) => {
|
document.querySelector("#generate-form").addEventListener('submit', (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
const form = e.target;
|
const form = e.target;
|
||||||
@ -180,6 +186,12 @@ window.onload = () => {
|
|||||||
console.error(e);
|
console.error(e);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
document.documentElement.addEventListener('keydown', (e) => {
|
||||||
|
if (e.key === "Escape")
|
||||||
|
fetch('/cancel').catch(err => {
|
||||||
|
console.error(err);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
if (!config.gfpgan_model_exists) {
|
if (!config.gfpgan_model_exists) {
|
||||||
document.querySelector("#gfpgan").style.display = 'none';
|
document.querySelector("#gfpgan").style.display = 'none';
|
||||||
|
Loading…
Reference in New Issue
Block a user