mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-17 21:26:22 -04:00
Fixed: Copy to clipboard not working with calendar feed (#3495)
* Replace flash clipboard implementation with document.execute("copy")
Fixes #3486
* Replace flash clipboard implementation with document.execCommand("copy")
Resolves Radarr/Radarr#3486
This commit is contained in:
committed by
Leonardo Galli
parent
c79578e99f
commit
da012eb6b5
@@ -1,6 +1,5 @@
|
||||
var Marionette = require('marionette');
|
||||
var StatusModel = require('../System/StatusModel');
|
||||
require('../Mixins/CopyToClipboard');
|
||||
require('../Mixins/TagInput');
|
||||
|
||||
module.exports = Marionette.Layout.extend({
|
||||
@@ -18,16 +17,21 @@ module.exports = Marionette.Layout.extend({
|
||||
events : {
|
||||
'click .x-includeUnmonitored' : '_updateUrl',
|
||||
'click .x-premiersOnly' : '_updateUrl',
|
||||
'click .x-ical-copy' : '_copyIcalToClipboard',
|
||||
'itemAdded .x-tags' : '_updateUrl',
|
||||
'itemRemoved .x-tags' : '_updateUrl'
|
||||
},
|
||||
|
||||
onShow : function() {
|
||||
this._updateUrl();
|
||||
this.ui.icalCopy.copyToClipboard(this.ui.icalUrl);
|
||||
this.ui.tags.tagInput({ allowNew: false });
|
||||
},
|
||||
|
||||
_copyIcalToClipboard: function () {
|
||||
this.ui.icalUrl.select();
|
||||
document.execCommand("copy");
|
||||
},
|
||||
|
||||
_updateUrl : function() {
|
||||
var icalUrl = window.location.host + StatusModel.get('urlBase') + '/feed/calendar/Radarr.ics?';
|
||||
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
var $ = require('jquery');
|
||||
var StatusModel = require('../System/StatusModel');
|
||||
var ZeroClipboard = require('zero.clipboard');
|
||||
var Messenger = require('../Shared/Messenger');
|
||||
|
||||
$.fn.copyToClipboard = function(input) {
|
||||
|
||||
ZeroClipboard.config({
|
||||
swfPath : StatusModel.get('urlBase') + '/Content/zero.clipboard.swf'
|
||||
});
|
||||
|
||||
var client = new ZeroClipboard(this);
|
||||
|
||||
client.on('ready', function(e) {
|
||||
client.on('copy', function(e) {
|
||||
e.clipboardData.setData("text/plain", input.val());
|
||||
});
|
||||
client.on('aftercopy', function() {
|
||||
Messenger.show({ message : 'Copied text to clipboard' });
|
||||
});
|
||||
});
|
||||
};
|
||||
@@ -4,8 +4,6 @@ var CommandController = require('../../Commands/CommandController');
|
||||
var AsModelBoundView = require('../../Mixins/AsModelBoundView');
|
||||
var AsValidatedView = require('../../Mixins/AsValidatedView');
|
||||
|
||||
require('../../Mixins/CopyToClipboard');
|
||||
|
||||
var view = Marionette.ItemView.extend({
|
||||
template : 'Settings/General/GeneralViewTemplate',
|
||||
|
||||
@@ -14,6 +12,7 @@ var view = Marionette.ItemView.extend({
|
||||
'change .x-proxy' : '_setProxyOptionsVisibility',
|
||||
'change .x-ssl' : '_setSslOptionsVisibility',
|
||||
'click .x-reset-api-key' : '_resetApiKey',
|
||||
'click .x-copy-api-key' : '_copyApiKeyToClipboard',
|
||||
'change .x-update-mechanism' : '_setScriptGroupVisibility'
|
||||
},
|
||||
|
||||
@@ -57,11 +56,12 @@ var view = Marionette.ItemView.extend({
|
||||
command : {
|
||||
name : 'resetApiKey'
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
onShow : function() {
|
||||
this.ui.copyApiKey.copyToClipboard(this.ui.apiKeyInput);
|
||||
|
||||
_copyApiKeyToClipboard : function() {
|
||||
this.ui.apiKeyInput.select();
|
||||
document.execCommand("copy");
|
||||
},
|
||||
|
||||
_setAuthOptionsVisibility : function() {
|
||||
|
||||
@@ -29,7 +29,6 @@ require.config({
|
||||
'messenger' : 'JsLibraries/messenger',
|
||||
'jquery' : 'JsLibraries/jquery',
|
||||
'typeahead' : 'JsLibraries/typeahead',
|
||||
'zero.clipboard' : 'JsLibraries/zero.clipboard',
|
||||
'libs' : 'JsLibraries/'
|
||||
},
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ require('jquery.knob');
|
||||
require('jquery.easypiechart');
|
||||
require('jquery.dotdotdot');
|
||||
require('typeahead');
|
||||
require('zero.clipboard');
|
||||
|
||||
/*Bootstrap*/
|
||||
require('bootstrap');
|
||||
|
||||
Reference in New Issue
Block a user