Project

General

Profile

« Previous | Next » 

Revision 60180

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

View differences:

modules/dnet-openaire-users/trunk/src/main/webapp/css/aai-custom.css
69 69
    display: -ms-flexbox;      /* TWEENER - IE 10 */
70 70
    display: -webkit-flex;     /* NEW - Chrome */
71 71
    display: flex;             /* NEW, Spec - Opera 12.1, Firefox 20+ */
72
}
73

  
74
code {
75
    user-select: all;
76 72
}
modules/dnet-openaire-users/trunk/src/main/webapp/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