Allow Ctrl+Z to undo the removal of images/tasks

This commit is contained in:
cmdr2
2023-03-28 17:13:37 +05:30
parent 9ee17ec5f1
commit 03800a45e0
2 changed files with 10 additions and 1 deletions

View File

@ -278,6 +278,9 @@ function undoableRemove(element, doubleUndo=false) {
function undoRemove() {
let data = undoBuffer.pop()
if (!data) {
return
}
if (data.next == null) {
data.parent.appendChild(data.element)
} else {
@ -294,6 +297,12 @@ function undoRemove() {
undoButton.addEventListener('click', () => { undoRemove() })
document.addEventListener('keydown', function(e) {
if (e.ctrlKey && e.key === 'z' && e.target == document.body) {
undoRemove()
}
})
function showImages(reqBody, res, outputContainer, livePreview) {
let imageItemElements = outputContainer.querySelectorAll('.imgItem')
if(typeof res != 'object') return