From 6b33ccc812ea8c34dbe6313c39f54597a5e31c60 Mon Sep 17 00:00:00 2001 From: ZAZiOs Date: Thu, 22 May 2025 23:19:28 +0300 Subject: [PATCH] feat(grafity-CtrlZ): Added script for basic keyboard support in grafity --- Web/static/js/vnd_literallycanvas.js | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/Web/static/js/vnd_literallycanvas.js b/Web/static/js/vnd_literallycanvas.js index bc53231e..281c7e1c 100644 --- a/Web/static/js/vnd_literallycanvas.js +++ b/Web/static/js/vnd_literallycanvas.js @@ -6429,6 +6429,21 @@ tools.ToolWithStroke = ToolWithStroke = (function(superClass) { module.exports = tools; - },{}]},{},[22])(22) -}); \ No newline at end of file +}); + +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() + } + } +}) \ No newline at end of file