Skip to content

Commit

Permalink
Change undoredo to not ignore inputs when autoqueue in change mode
Browse files Browse the repository at this point in the history
  • Loading branch information
pythongosssss committed Jan 15, 2024
1 parent dec9193 commit 43baf3c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
16 changes: 10 additions & 6 deletions web/extensions/core/undoRedo.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ const undoRedo = async (e) => {
};

const bindInput = (activeEl) => {
if (activeEl?.tagName !== "CANVAS" && activeEl?.tagName !== "BODY") {
if (activeEl && activeEl.tagName !== "CANVAS" && activeEl.tagName !== "BODY") {
for (const evt of ["change", "input", "blur"]) {
if (`on${evt}` in activeEl) {
const listener = () => {
Expand All @@ -113,12 +113,16 @@ window.addEventListener(
"keydown",
(e) => {
requestAnimationFrame(async () => {
const activeEl = document.activeElement;
if (activeEl?.tagName === "INPUT" || activeEl?.type === "textarea") {
// Ignore events on inputs, they have their native history
return;
let activeEl;
// If we are auto queue in change mode then we do want to trigger on inputs
if (!app.ui.autoQueueEnabled || app.ui.autoQueueMode === "instant") {
activeEl = document.activeElement;
if (activeEl?.tagName === "INPUT" || activeEl?.type === "textarea") {
// Ignore events on inputs, they have their native history
return;
}
}

keyIgnored = e.key === "Control" || e.key === "Shift" || e.key === "Alt" || e.key === "Meta";
if (keyIgnored) return;

Expand Down
1 change: 1 addition & 0 deletions web/scripts/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,7 @@ export class ComfyUI {
!app.lastExecutionError
) {
app.queuePrompt(0, this.batchCount);
status.exec_info.queue_remaining += this.batchCount;
this.graphHasChanged = false;
}
this.lastQueueSize = status.exec_info.queue_remaining;
Expand Down

0 comments on commit 43baf3c

Please sign in to comment.