feat(graffiti: CtrlZ): Added script for basic keyboard support in graffiti (#1314)

Добавил поддержку CTRL+Z для отмены действия и CTRL+SHIFT+Z или CTRL+Y
для повтора действия в редакторе граффити.
This commit is contained in:
ZAZiOs 2025-06-01 17:06:32 +03:00 committed by GitHub
parent 0649a75d56
commit dd19163e27
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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()
}
}
})