GUACAMOLE-55: Move clipboard functionality to a new guacClipboard directive.

This commit is contained in:
Michael Jumper
2016-06-21 23:55:05 -07:00
parent 3b94ac8571
commit 0eed6c32ae
3 changed files with 70 additions and 1 deletions

View File

@@ -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.<String, 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;
}]);

View File

@@ -54,7 +54,7 @@
<h3>{{'CLIENT.SECTION_HEADER_CLIPBOARD' | translate}}</h3>
<div class="content">
<p class="description">{{'CLIENT.HELP_CLIPBOARD' | translate}}</p>
<textarea ng-model="client.clipboardData" rows="10" cols="40" id="clipboard"></textarea>
<guac-clipboard data="client.clipboardData"></guac-clipboard>
</div>
</div>

View File

@@ -0,0 +1 @@
<textarea ng-model="data" rows="10" cols="40" class="clipboard"></textarea>