Project

General

Profile

« Previous | Next » 

Revision 60180

[Users | Trunk]: Add copy event listener to trim selection text

View differences:

personal.jsp
30 30
                console.error('unable to copy text');
31 31
            }
32 32
        }
33
        $(document).ready(function () {
34
            document.addEventListener('copy', (event) => {
35
                const selection = document.getSelection();
36
                event.clipboardData.setData('text/plain', selection.toString().trim());
37
                event.preventDefault();
38
            });
39
        });
33 40
    </script>
34 41
    <link rel="stylesheet" style="text/css" href="./css/theme.css">
35 42
    <link rel="stylesheet" style="text/css" href="./css/custom.css">

Also available in: Unified diff