mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2026-11-20 21:57:05 +08:00
Fix to contextMenuFilter.js
This commit is contained in:
parent
2e3aa47f61
commit
e1557ea69b
@ -1,14 +1,14 @@
|
||||
import {app} from "../../scripts/app.js";
|
||||
import { LiteGraph } from "../../lib/litegraph.core.js";
|
||||
|
||||
// Adds filtering to combo context menus
|
||||
|
||||
const ext = {
|
||||
name: "Comfy.ContextMenuFilter",
|
||||
init() {
|
||||
const ctxMenu = LiteGraph.ContextMenu;
|
||||
|
||||
LiteGraph.ContextMenu = function (values, options) {
|
||||
const ctx = ctxMenu.call(this, values, options);
|
||||
class FilterContextMenu extends LiteGraph.ContextMenu {
|
||||
constructor(values, options){
|
||||
super(values, options);
|
||||
|
||||
// If we are a dark menu (only used for combo boxes) then add a filter input
|
||||
if (options?.className === "dark" && values?.length > 10) {
|
||||
@ -137,12 +137,11 @@ const ext = {
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
return ctx;
|
||||
};
|
||||
|
||||
LiteGraph.ContextMenu.prototype = ctxMenu.prototype;
|
||||
},
|
||||
}
|
||||
}
|
||||
LiteGraph.ContextMenu = FilterContextMenu;
|
||||
window.ContextMenu = FilterContextMenu;
|
||||
}
|
||||
}
|
||||
|
||||
app.registerExtension(ext);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user