Commit 8519d52e authored by Danil Boldyrev's avatar Danil Boldyrev

fixing the copy/paste function, correct code

parent 8a07c59b
......@@ -608,10 +608,16 @@ onUiLoaded(async() => {
// Handle keydown events
function handleKeyDown(event) {
// Disable key locks to make pasting from the buffer work correctly
if ((event.ctrlKey && event.code === 'KeyV') || event.code === "F5") {
return;
}
// before activating shortcut, ensure user is not actively typing in an input field
if(event.target.nodeName === 'TEXTAREA' || event.target.nodeName === 'INPUT') {
event.preventDefault;
} else {
if (event.target.nodeName === 'TEXTAREA' || event.target.nodeName === 'INPUT') {
return;
}
const hotkeyActions = {
[hotkeysConfig.canvas_hotkey_reset]: resetZoom,
......@@ -632,7 +638,6 @@ onUiLoaded(async() => {
event.preventDefault();
}
}
}
// Get Mouse position
function getMousePosition(e) {
......@@ -692,11 +697,18 @@ onUiLoaded(async() => {
// Handle the move event for pan functionality. Updates the panX and panY variables and applies the new transform to the target element.
function handleMoveKeyDown(e) {
if (e.code === hotkeysConfig.canvas_hotkey_move) {
// Disable key locks to make pasting from the buffer work correctly
if ((e.ctrlKey && e.code === 'KeyV') || e.code === "F5") {
return;
}
// before activating shortcut, ensure user is not actively typing in an input field
if(e.target.nodeName === 'TEXTAREA' || e.target.nodeName === 'INPUT') {
event.preventDefault;
} else {
if (e.target.nodeName === 'TEXTAREA' || e.target.nodeName === 'INPUT') {
return;
}
if (e.code === hotkeysConfig.canvas_hotkey_move) {
if (!e.ctrlKey && !e.metaKey && isKeyDownHandlerAttached) {
e.preventDefault();
document.activeElement.blur();
......@@ -704,7 +716,6 @@ onUiLoaded(async() => {
}
}
}
}
function handleMoveKeyUp(e) {
if (e.code === hotkeysConfig.canvas_hotkey_move) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment