From 2c15f3d21ffb2bbb2c304daf892efb34be1f32a7 Mon Sep 17 00:00:00 2001 From: Alex Leitner Date: Wed, 22 Feb 2023 18:47:29 +0000 Subject: [PATCH] GUACAMOLE-1740: Don't display clipboard contents in the clipboard editor until it is focused on. --- .../app/clipboard/directives/guacClipboard.js | 22 +++++++++++++++++-- .../src/app/clipboard/styles/clipboard.css | 13 +++++++++-- .../clipboard/templates/guacClipboard.html | 5 ++++- .../main/frontend/src/translations/en.json | 1 + .../main/frontend/src/translations/ja.json | 3 ++- 5 files changed, 38 insertions(+), 6 deletions(-) diff --git a/guacamole/src/main/frontend/src/app/clipboard/directives/guacClipboard.js b/guacamole/src/main/frontend/src/app/clipboard/directives/guacClipboard.js index f89494c4c..789756bd8 100644 --- a/guacamole/src/main/frontend/src/app/clipboard/directives/guacClipboard.js +++ b/guacamole/src/main/frontend/src/app/clipboard/directives/guacClipboard.js @@ -49,11 +49,29 @@ angular.module('clipboard').directive('guacClipboard', ['$injector', /** * The DOM element which will contain the clipboard contents within the - * user interface provided by this directive. + * user interface provided by this directive. We populate the clipboard + * editor via this DOM element rather than updating a model so that we + * are prepared for future support of rich text contents. * * @type Element */ - var element = $element[0]; + var element = $element[0].querySelectorAll('.clipboard.active')[0]; + + /** + * When isActive is set to true then the Clipboard data will be + * displayed in the Clipboard Editor. When false, the Clipboard Editor + * will not be displayed with Clipboard data. + * + * @type Boolean + */ + $scope.isActive = false; + + /** + * Updates clipboard editor to be active. + */ + $scope.setActive = function setActive() { + $scope.isActive = true; + }; /** * Rereads the contents of the clipboard field, updating the diff --git a/guacamole/src/main/frontend/src/app/clipboard/styles/clipboard.css b/guacamole/src/main/frontend/src/app/clipboard/styles/clipboard.css index 91fb328bb..d71287ac7 100644 --- a/guacamole/src/main/frontend/src/app/clipboard/styles/clipboard.css +++ b/guacamole/src/main/frontend/src/app/clipboard/styles/clipboard.css @@ -31,8 +31,6 @@ width: 100%; height: 2in; white-space: pre; - font-size: 1em; - overflow: auto; padding: 0.25em; } @@ -59,3 +57,14 @@ white-space: pre; overflow: hidden; } + +.active { + overflow: auto; + font-size: 1em; +} + +.inactive { + overflow: hidden; + font-size: 0.9em; + opacity: 0.5; +} diff --git a/guacamole/src/main/frontend/src/app/clipboard/templates/guacClipboard.html b/guacamole/src/main/frontend/src/app/clipboard/templates/guacClipboard.html index b860f0319..4e1ebda8e 100644 --- a/guacamole/src/main/frontend/src/app/clipboard/templates/guacClipboard.html +++ b/guacamole/src/main/frontend/src/app/clipboard/templates/guacClipboard.html @@ -1 +1,4 @@ - +
+ + +
diff --git a/guacamole/src/main/frontend/src/translations/en.json b/guacamole/src/main/frontend/src/translations/en.json index d93861927..450a455bb 100644 --- a/guacamole/src/main/frontend/src/translations/en.json +++ b/guacamole/src/main/frontend/src/translations/en.json @@ -162,6 +162,7 @@ "TEXT_USER_LEFT" : "{USERNAME} has left the connection.", "TEXT_RECONNECT_COUNTDOWN" : "Reconnecting in {REMAINING} {REMAINING, plural, one{second} other{seconds}}...", "TEXT_FILE_TRANSFER_PROGRESS" : "{PROGRESS} {UNIT, select, b{B} kb{KB} mb{MB} gb{GB} other{}}", + "TEXT_CLIPBOARD_AWAITING_FOCUS" : "Click to view clipboard data...", "URL_OSK_LAYOUT" : "layouts/en-us-qwerty.json" diff --git a/guacamole/src/main/frontend/src/translations/ja.json b/guacamole/src/main/frontend/src/translations/ja.json index a26d589d0..e4c2ad0c4 100644 --- a/guacamole/src/main/frontend/src/translations/ja.json +++ b/guacamole/src/main/frontend/src/translations/ja.json @@ -132,7 +132,8 @@ "TEXT_CLIENT_STATUS_DISCONNECTED" : "切断されました。", "TEXT_CLIENT_STATUS_UNSTABLE" : "Guacamoleサーバへのネットワーク接続が不安定です。", "TEXT_CLIENT_STATUS_WAITING" : "Guacamoleサーバに接続しました。応答を待っています", - "TEXT_RECONNECT_COUNTDOWN" : "再接続しています... {REMAINING} {REMAINING, plural, one{second} other{seconds}}..." + "TEXT_RECONNECT_COUNTDOWN" : "再接続しています... {REMAINING} {REMAINING, plural, one{second} other{seconds}}...", + "TEXT_CLIPBOARD_AWAITING_FOCUS" : "クリックをしてコピー/カットされたテキストが表示されます..." },