mirror of
https://github.com/sd-webui/stable-diffusion-webui.git
synced 2024-12-14 14:52:31 +03:00
fix #313
This commit is contained in:
parent
3ce28c2e76
commit
3a376392b3
@ -33,3 +33,5 @@ def js_copy_to_clipboard(from_id):
|
||||
def js_painterro_launch(to_id):
|
||||
return w(f"Painterro.init('{to_id}')")
|
||||
|
||||
def js_img2img_submit(prompt_row_id):
|
||||
return w(f"clickFirstVisibleButton('{prompt_row_id}')")
|
||||
|
@ -280,7 +280,10 @@ def draw_gradio_ui(opt, img2img=lambda x: x, txt2img=lambda x: x, txt2img_defaul
|
||||
img2img_embeddings],
|
||||
[output_img2img_gallery, output_img2img_seed, output_img2img_params, output_img2img_stats])
|
||||
img2img_btn_editor.click(*img2img_submit_params())
|
||||
img2img_prompt.submit(*img2img_submit_params())
|
||||
|
||||
# GENERATE ON ENTER
|
||||
img2img_prompt.submit(None, None, None,
|
||||
_js=js_img2img_submit("prompt_row"))
|
||||
|
||||
img2img_painterro_btn.click(None, [img2img_image_editor], [img2img_image_editor, img2img_image_mask], _js=js_painterro_launch('img2img_editor'))
|
||||
|
||||
|
@ -131,6 +131,22 @@ window.SD = (() => {
|
||||
clearImageInput (imageEditor) {
|
||||
imageEditor?.querySelector('.modify-upload button:last-child')?.click();
|
||||
}
|
||||
clickFirstVisibleButton(rowId) {
|
||||
const generateButtons = this.el.get(`#${rowId}`).querySelectorAll('.gr-button-primary');
|
||||
|
||||
if (!generateButtons) return;
|
||||
|
||||
for (let i = 0, arr = [...generateButtons]; i < arr.length; i++) {
|
||||
const cs = window.getComputedStyle(arr[i]);
|
||||
|
||||
if (cs.display !== 'none' && cs.visibility !== 'hidden') {
|
||||
console.log(arr[i]);
|
||||
|
||||
arr[i].click();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
static error (e) {
|
||||
console.error(e);
|
||||
if (typeof e === 'string') {
|
||||
|
Loading…
Reference in New Issue
Block a user