mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Merge branch 'clipboard_js' of https://github.com/mtanda/grafana into mtanda-clipboard_js
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
define(['angular',
|
||||
'lodash',
|
||||
'jquery',
|
||||
'require',
|
||||
'app/core/config',
|
||||
],
|
||||
function (angular, _, require, config) {
|
||||
function (angular, _, $, require, config) {
|
||||
'use strict';
|
||||
|
||||
var module = angular.module('grafana.controllers');
|
||||
@@ -88,11 +89,15 @@ function (angular, _, require, config) {
|
||||
|
||||
module.directive('clipboardButton',function() {
|
||||
return function(scope, elem) {
|
||||
require(['vendor/zero_clipboard'], function(ZeroClipboard) {
|
||||
ZeroClipboard.config({
|
||||
swfPath: config.appSubUrl + '/public/vendor/zero_clipboard.swf'
|
||||
});
|
||||
new ZeroClipboard(elem[0]);
|
||||
require(['vendor/clipboard/dist/clipboard'], function(Clipboard) {
|
||||
$.fn.modal.Constructor.prototype.enforceFocus = function() {}; // see https://github.com/zenorocha/clipboard.js/issues/155
|
||||
scope.clipboard = new Clipboard(elem[0]);
|
||||
});
|
||||
|
||||
scope.$on('$destroy', function() {
|
||||
if (scope.clipboard) {
|
||||
scope.clipboard.destroy();
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user