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() => { ...@@ -608,10 +608,16 @@ onUiLoaded(async() => {
// Handle keydown events // Handle keydown events
function handleKeyDown(event) { 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 // before activating shortcut, ensure user is not actively typing in an input field
if(event.target.nodeName === 'TEXTAREA' || event.target.nodeName === 'INPUT') { if (event.target.nodeName === 'TEXTAREA' || event.target.nodeName === 'INPUT') {
event.preventDefault; return;
} else { }
const hotkeyActions = { const hotkeyActions = {
[hotkeysConfig.canvas_hotkey_reset]: resetZoom, [hotkeysConfig.canvas_hotkey_reset]: resetZoom,
...@@ -632,7 +638,6 @@ onUiLoaded(async() => { ...@@ -632,7 +638,6 @@ onUiLoaded(async() => {
event.preventDefault(); event.preventDefault();
} }
} }
}
// Get Mouse position // Get Mouse position
function getMousePosition(e) { function getMousePosition(e) {
...@@ -692,11 +697,18 @@ onUiLoaded(async() => { ...@@ -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. // 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) { 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 // before activating shortcut, ensure user is not actively typing in an input field
if(e.target.nodeName === 'TEXTAREA' || e.target.nodeName === 'INPUT') { if (e.target.nodeName === 'TEXTAREA' || e.target.nodeName === 'INPUT') {
event.preventDefault; return;
} else { }
if (e.code === hotkeysConfig.canvas_hotkey_move) {
if (!e.ctrlKey && !e.metaKey && isKeyDownHandlerAttached) { if (!e.ctrlKey && !e.metaKey && isKeyDownHandlerAttached) {
e.preventDefault(); e.preventDefault();
document.activeElement.blur(); document.activeElement.blur();
...@@ -704,7 +716,6 @@ onUiLoaded(async() => { ...@@ -704,7 +716,6 @@ onUiLoaded(async() => {
} }
} }
} }
}
function handleMoveKeyUp(e) { function handleMoveKeyUp(e) {
if (e.code === hotkeysConfig.canvas_hotkey_move) { 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