feat(grafity-CtrlZ): Added script for basic keyboard support in grafity

This commit is contained in:
ZAZiOs 2025-05-22 23:19:28 +03:00
parent 4b7d2b9b17
commit 6b33ccc812

View file

@ -6429,6 +6429,21 @@ tools.ToolWithStroke = ToolWithStroke = (function(superClass) {
module.exports = tools;
},{}]},{},[22])(22)
});
document.addEventListener('keydown', function (e) {
const redoBtn = document.querySelector(".lc-redo")
const undoBtn = document.querySelector(".lc-undo")
if (e.ctrlKey && undoBtn && redoBtn) {
if ((e.code === "KeyY") || (e.code === "KeyZ" && e.shiftKey)) {
e.preventDefault()
redoBtn.click()
}
else if (e.code === "KeyZ") {
e.preventDefault()
undoBtn.click()
}
}
})