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

fixing the copy/paste function, correct code

parent 8a07c59b
Loading
Loading
Loading
Loading
+39 −28
Original line number Diff line number Diff line
@@ -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 {
                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 {
                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) {