From 230284002eb98d0418d6520de1007180c5ab1c8c Mon Sep 17 00:00:00 2001 From: Konstantinos Triantafyllou Date: Wed, 23 Dec 2020 13:56:48 +0000 Subject: [PATCH] [Users | Trunk]: Add copy event listener to trim selection text --- src/main/webapp/css/aai-custom.css | 4 ---- src/main/webapp/personal.jsp | 7 +++++++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/webapp/css/aai-custom.css b/src/main/webapp/css/aai-custom.css index 814ee62..89ebf4d 100644 --- a/src/main/webapp/css/aai-custom.css +++ b/src/main/webapp/css/aai-custom.css @@ -69,8 +69,4 @@ a:hover, .uk-link:hover { display: -ms-flexbox; /* TWEENER - IE 10 */ display: -webkit-flex; /* NEW - Chrome */ display: flex; /* NEW, Spec - Opera 12.1, Firefox 20+ */ -} - -code { - user-select: all; } \ No newline at end of file diff --git a/src/main/webapp/personal.jsp b/src/main/webapp/personal.jsp index a6fa8e4..5484e9b 100644 --- a/src/main/webapp/personal.jsp +++ b/src/main/webapp/personal.jsp @@ -30,6 +30,13 @@ console.error('unable to copy text'); } } + $(document).ready(function () { + document.addEventListener('copy', (event) => { + const selection = document.getSelection(); + event.clipboardData.setData('text/plain', selection.toString().trim()); + event.preventDefault(); + }); + });