From 0eed6c32aeee5661f80e56d59affc12690acde75 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Tue, 21 Jun 2016 23:55:05 -0700 Subject: [PATCH] GUACAMOLE-55: Move clipboard functionality to a new guacClipboard directive. --- .../app/client/directives/guacClipboard.js | 68 +++++++++++++++++++ .../webapp/app/client/templates/client.html | 2 +- .../app/client/templates/guacClipboard.html | 1 + 3 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 guacamole/src/main/webapp/app/client/directives/guacClipboard.js create mode 100644 guacamole/src/main/webapp/app/client/templates/guacClipboard.html diff --git a/guacamole/src/main/webapp/app/client/directives/guacClipboard.js b/guacamole/src/main/webapp/app/client/directives/guacClipboard.js new file mode 100644 index 000000000..c656b9ade --- /dev/null +++ b/guacamole/src/main/webapp/app/client/directives/guacClipboard.js @@ -0,0 +1,68 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * A directive which exposes the current clipboard contents, if possible, + * allowing the user to edit those contents. If the current clipboard contents + * cannot be directly accessed, the user can at least directly copy/paste data + * within the field provided by this directive. The contents of this clipboard + * directive, whether retrieved from the local or manipulated manually by the + * user, are exposed via the "data" attribute. + */ +angular.module('client').directive('guacClipboard', [function guacClipboard() { + + /** + * Configuration object for the guacClipboard directive. + * + * @type Object. + */ + var config = { + restrict : 'E', + replace : true, + templateUrl : 'app/client/templates/guacClipboard.html' + }; + + // Scope properties exposed by the guacClipboard directive + config.scope = { + + /** + * The data to display within the field provided by this directive. If + * the local clipboard can be accessed by JavaScript, this will be set + * automatically as the local clipboard changes. Failing that, this + * will be set when the user manually modifies the contents of the + * field. Changes to this value will be rendered within the field and, + * if possible, will be pushed to the local clipboard. + * + * @type String + */ + data : '=' + + }; + + // guacClipboard directive controller + config.controller = ['$scope', '$injector', '$element', + function guacClipboardController($scope, $injector, $element) { + + // STUB + + }]; + + return config; + +}]); diff --git a/guacamole/src/main/webapp/app/client/templates/client.html b/guacamole/src/main/webapp/app/client/templates/client.html index f56b50632..8a4e7fea2 100644 --- a/guacamole/src/main/webapp/app/client/templates/client.html +++ b/guacamole/src/main/webapp/app/client/templates/client.html @@ -54,7 +54,7 @@

{{'CLIENT.SECTION_HEADER_CLIPBOARD' | translate}}

{{'CLIENT.HELP_CLIPBOARD' | translate}}

- +
diff --git a/guacamole/src/main/webapp/app/client/templates/guacClipboard.html b/guacamole/src/main/webapp/app/client/templates/guacClipboard.html new file mode 100644 index 000000000..8b56ac83c --- /dev/null +++ b/guacamole/src/main/webapp/app/client/templates/guacClipboard.html @@ -0,0 +1 @@ +