mirror of
https://github.com/openvk/openvk
synced 2025-06-06 22:47:01 +03:00
feat(graffiti: CtrlZ): Added script for basic keyboard support in graffiti (#1314)
Добавил поддержку CTRL+Z для отмены действия и CTRL+SHIFT+Z или CTRL+Y для повтора действия в редакторе граффити.
This commit is contained in:
parent
0649a75d56
commit
dd19163e27
1 changed files with 17 additions and 2 deletions
|
@ -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()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue