mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2024-11-22 08:13:22 +01:00
Allow Ctrl+Z to undo the removal of images/tasks
This commit is contained in:
parent
9ee17ec5f1
commit
03800a45e0
@ -298,7 +298,7 @@
|
||||
<button id="clear-all-previews" class="secondaryButton"><i class="fa-solid fa-trash-can icon"></i> Clear All</button>
|
||||
<button class="tertiaryButton" id="show-download-popup"><i class="fa-solid fa-download"></i> Download images</button>
|
||||
<div class="display-settings">
|
||||
<button id="undo" class="displayNone tertiaryButton">
|
||||
<button id="undo" class="displayNone primaryButton">
|
||||
Undo <i class="fa-solid fa-rotate-left icon"></i>
|
||||
<span class="simple-tooltip left">Undo last remove</span>
|
||||
</button>
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user