mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-26 01:09:46 +00:00
Fix regression in legacy search (#698)
- Resolves https://github.com/Comfy-Org/ComfyUI_frontend/issues/2828 - Issue caused by earlier instantiation of `input` object
This commit is contained in:
@@ -6061,12 +6061,6 @@ export class LGraphCanvas implements ConnectionColorContext {
|
|||||||
const canvas = graphcanvas.canvas
|
const canvas = graphcanvas.canvas
|
||||||
const root_document = canvas.ownerDocument || document
|
const root_document = canvas.ownerDocument || document
|
||||||
|
|
||||||
const input = Object.assign(document.createElement("input"), {
|
|
||||||
autofocus: true,
|
|
||||||
type: "text",
|
|
||||||
className: "value rounded",
|
|
||||||
} satisfies Partial<HTMLInputElement>)
|
|
||||||
|
|
||||||
const div = document.createElement("div")
|
const div = document.createElement("div")
|
||||||
const dialog = Object.assign(div, {
|
const dialog = Object.assign(div, {
|
||||||
close(this: typeof div) {
|
close(this: typeof div) {
|
||||||
@@ -6076,14 +6070,12 @@ export class LGraphCanvas implements ConnectionColorContext {
|
|||||||
root_document.body.style.overflow = ""
|
root_document.body.style.overflow = ""
|
||||||
|
|
||||||
// important, if canvas loses focus keys wont be captured
|
// important, if canvas loses focus keys wont be captured
|
||||||
setTimeout(canvas.focus, 20)
|
setTimeout(() => canvas.focus(), 20)
|
||||||
dialog.remove()
|
dialog.remove()
|
||||||
},
|
},
|
||||||
} satisfies Partial<HTMLDivElement> & ICloseable)
|
} satisfies Partial<HTMLDivElement> & ICloseable)
|
||||||
dialog.className = "litegraph litesearchbox graphdialog rounded"
|
dialog.className = "litegraph litesearchbox graphdialog rounded"
|
||||||
dialog.innerHTML = "<span class='name'>Search</span> "
|
dialog.innerHTML = "<span class='name'>Search</span> <input autofocus type='text' class='value rounded'/>"
|
||||||
dialog.append(input)
|
|
||||||
|
|
||||||
if (options.do_type_filter) {
|
if (options.do_type_filter) {
|
||||||
dialog.innerHTML += "<select class='slot_in_type_filter'><option value=''></option></select>"
|
dialog.innerHTML += "<select class='slot_in_type_filter'><option value=''></option></select>"
|
||||||
dialog.innerHTML += "<select class='slot_out_type_filter'><option value=''></option></select>"
|
dialog.innerHTML += "<select class='slot_out_type_filter'><option value=''></option></select>"
|
||||||
@@ -6163,6 +6155,11 @@ export class LGraphCanvas implements ConnectionColorContext {
|
|||||||
let timeout: ReturnType<typeof setTimeout> | null = null
|
let timeout: ReturnType<typeof setTimeout> | null = null
|
||||||
let selected: ChildNode | null = null
|
let selected: ChildNode | null = null
|
||||||
|
|
||||||
|
const maybeInput = dialog.querySelector("input")
|
||||||
|
if (!maybeInput) throw new TypeError("Could not create search input box.")
|
||||||
|
|
||||||
|
const input = maybeInput
|
||||||
|
|
||||||
if (input) {
|
if (input) {
|
||||||
input.addEventListener("blur", function () {
|
input.addEventListener("blur", function () {
|
||||||
this.focus()
|
this.focus()
|
||||||
|
|||||||
Reference in New Issue
Block a user