MCPcopy Index your code
hub / github.com/easydiffusion/easydiffusion / undoableRemove

Function undoableRemove

ui/media/js/main.js:353–374  ·  view source on GitHub ↗
(element, doubleUndo = false)

Source from the content-addressed store, hash-verified

351}
352
353function undoableRemove(element, doubleUndo = false) {
354 let data = {
355 element: element,
356 parent: element.parentNode,
357 prev: element.previousSibling,
358 next: element.nextSibling,
359 doubleUndo: doubleUndo,
360 }
361 undoBuffer.push(data)
362 if (undoBuffer.length > UNDO_LIMIT) {
363 // Remove item from memory and also remove it from the data structures
364 let item = undoBuffer.shift()
365 htmlTaskMap.delete(item.element)
366 item.element.querySelectorAll("[data-imagecounter]").forEach((img) => {
367 delete imageRequest[img.dataset["imagecounter"]]
368 })
369 }
370 element.remove()
371 if (undoBuffer.length != 0) {
372 undoButton.classList.remove("displayNone")
373 }
374}
375
376function undoRemove() {
377 let data = undoBuffer.pop()

Callers 2

showImagesFunction · 0.85
removeTaskFunction · 0.85

Calls 3

pushMethod · 0.80
shiftMethod · 0.80
deleteMethod · 0.80

Tested by

no test coverage detected