mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 09:14:35 +02:00
feat(ui): right-click send-to-control for prompt/params transfer
Right-clicking the "Send to Images" button now offers two entries:
one copies the prompt only, the other copies all generation parameters
except the image itself. Available in gallery, txt2img, img2img, and
extras. Keeps the results toolbar compact.
- extend ParamBinding with skip_image and only_prompt flags
- create prompt/params variants in all four output panels
- register per-tab context menu entries scoped to #{tab}_tabitem
- match menu selectors via e.target.closest for nested-icon clicks
- document the right-click surface in the "➠ Control" locale hint
This commit is contained in:
@@ -67,8 +67,9 @@ const contextMenuInit = () => {
|
||||
if (oldMenu) oldMenu.remove();
|
||||
menuSpecs.forEach((v, k) => {
|
||||
const items = v.filter((item) => item.primary);
|
||||
if (items.length > 0 && e.composedPath()[0].matches(k)) {
|
||||
showContextMenu(e, e.composedPath()[0], items);
|
||||
const matched = e.target.closest(k);
|
||||
if (items.length > 0 && matched) {
|
||||
showContextMenu(e, matched, items);
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
@@ -78,8 +79,9 @@ const contextMenuInit = () => {
|
||||
if (oldMenu) oldMenu.remove();
|
||||
menuSpecs.forEach((v, k) => {
|
||||
const items = v.filter((item) => !item.primary);
|
||||
if (items.length > 0 && e.composedPath()[0].matches(k)) {
|
||||
showContextMenu(e, e.composedPath()[0], items);
|
||||
const matched = e.target.closest(k);
|
||||
if (items.length > 0 && matched) {
|
||||
showContextMenu(e, matched, items);
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
@@ -161,5 +163,13 @@ async function initContextMenu() {
|
||||
appendContextMenuOption(id, 'Refine & HiRes pass', () => reprocessClick(`${tab}`, 'reprocess_refine'), true);
|
||||
appendContextMenuOption(id, 'Detailer pass', () => reprocessClick(`${tab}`, 'reprocess_detail'), true);
|
||||
}
|
||||
// Right-click send-to-control button for prompt/params-only transfer.
|
||||
// Scoped per tab because #control_tab and its paired #control_tab_prompt /
|
||||
// #control_tab_params elements are duplicated across output panels.
|
||||
for (const tab of ['gallery', 'txt2img', 'img2img', 'extras']) {
|
||||
id = `#${tab}_tabitem #control_tab`;
|
||||
appendContextMenuOption(id, 'Transfer only prompt to Images tab', () => document.querySelector(`#image_buttons_${tab} #control_tab_prompt`)?.click());
|
||||
appendContextMenuOption(id, 'Transfer all parameters to Images tab', () => document.querySelector(`#image_buttons_${tab} #control_tab_params`)?.click());
|
||||
}
|
||||
addContextMenuEventListener();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user