MCPcopy Create free account
hub / github.com/easydiffusion/easydiffusion / processKey

Method processKey

ui/media/js/searchable-models.js:228–320  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

226 }
227
228 processKey(e) {
229 switch (e.key) {
230 case "Escape":
231 e.preventDefault()
232 this.resetSelection()
233 break
234 case "Enter":
235 e.preventDefault()
236 if (this.validEntrySelected()) {
237 if (this.modelList.style.display != "block") {
238 this.showModelList()
239 } else {
240 this.saveCurrentSelection(
241 this.highlightedModelEntry,
242 this.highlightedModelEntry.innerText,
243 this.highlightedModelEntry.dataset.path
244 )
245 this.hideModelList()
246 this.showAllEntries()
247 }
248 this.modelFilter.focus()
249 } else {
250 this.resetSelection()
251 }
252 break
253 case "ArrowUp":
254 e.preventDefault()
255 if (this.validEntrySelected()) {
256 this.selectPreviousFile()
257 }
258 break
259 case "ArrowDown":
260 e.preventDefault()
261 if (this.validEntrySelected()) {
262 this.selectNextFile()
263 }
264 break
265 case "ArrowLeft":
266 if (this.modelList.style.display != "block") {
267 e.preventDefault()
268 }
269 break
270 case "ArrowRight":
271 if (this.modelList.style.display != "block") {
272 e.preventDefault()
273 }
274 break
275 case "PageUp":
276 e.preventDefault()
277 if (this.validEntrySelected()) {
278 this.selectPreviousFile()
279 this.selectPreviousFile()
280 this.selectPreviousFile()
281 this.selectPreviousFile()
282 this.selectPreviousFile()
283 this.selectPreviousFile()
284 this.selectPreviousFile()
285 this.selectPreviousFile()

Callers

nothing calls this directly

Calls 10

resetSelectionMethod · 0.95
validEntrySelectedMethod · 0.95
showModelListMethod · 0.95
saveCurrentSelectionMethod · 0.95
hideModelListMethod · 0.95
showAllEntriesMethod · 0.95
selectPreviousFileMethod · 0.95
selectNextFileMethod · 0.95
selectFirstFileMethod · 0.95
selectLastFileMethod · 0.95

Tested by

no test coverage detected