Skip to content

Commit da9edc6

Browse files
committed
fixes
1 parent f206684 commit da9edc6

File tree

1 file changed

+10
-22
lines changed

1 file changed

+10
-22
lines changed

js/activity.js

100644100755
Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3069,6 +3069,7 @@ class Activity {
30693069
const KEYCODE_DOWN = 40;
30703070
const DEL = 46;
30713071
const V = 86;
3072+
const Z = 90;
30723073
// Shortcuts for creating new notes
30733074
const KEYCODE_D = 68; // do
30743075
const KEYCODE_R = 82; // re
@@ -3172,6 +3173,15 @@ class Activity {
31723173
docById("paste").style.visibility = "visible";
31733174
this.update = true;
31743175
break;
3176+
case Z:
3177+
if (this.blocks && this.blocks.trashStacks && this.blocks.trashStacks.length > 0) {
3178+
const lastBlockId = this.blocks.trashStacks[this.blocks.trashStacks.length - 1];
3179+
this._restoreTrashById(lastBlockId)
3180+
console.log("button clicked", lastBlockId)
3181+
} else {
3182+
this.textMsg(_("Trash can is empty."), 3000)}
3183+
console.log("block is empty")
3184+
break;
31753185
}
31763186
} else if (event.shiftKey && !disableKeys) {
31773187
const solfnotes_ = _("ti la sol fa mi re do").split(" ");
@@ -3918,28 +3928,6 @@ class Activity {
39183928
trashList.appendChild(trashView);
39193929
}
39203930
};
3921-
function HandleShortcutKey(event) {
3922-
if ((event.ctrlKey || event.metaKey) && event.key === "z") {
3923-
console.log("button clicked");
3924-
event.preventDefault();
3925-
console.log("button clicked event.ctrlKey ${ event.key ");
3926-
if (
3927-
activity.blocks &&
3928-
activity.blocks.trashStacks &&
3929-
activity.blocks.trashStacks.length > 0
3930-
) {
3931-
// Restore the last trashed item
3932-
const lastBlockId = activity.blocks.trashStacks[activity.blocks.trashStacks.length - 1];
3933-
activity._restoreTrashById(lastBlockId);
3934-
console.log(lastBlockId);
3935-
3936-
} else {
3937-
activity.textMsg(_("Trash can is empty."), 3000);
3938-
}
3939-
}
3940-
}
3941-
3942-
document.addEventListener("keydown", HandleShortcutKey);
39433931

39443932
/*
39453933
* Open aux menu

0 commit comments

Comments
 (0)