(element, doubleUndo = false)
| 351 | } |
| 352 | |
| 353 | function 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 | |
| 376 | function undoRemove() { |
| 377 | let data = undoBuffer.pop() |
no test coverage detected