зеркало из https://github.com/nextcloud/spreed.git
Destroy previous Clipboard object before creating it again
As a new Clipboard object needs to be created again when its corresponding button is rerendered the previous object is now explicitly destroyed to ensure proper lifecycle management. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
Родитель
b21fb210b7
Коммит
2c3994e78d
|
@ -298,12 +298,17 @@
|
|||
* Clipboard
|
||||
*/
|
||||
initClipboard: function() {
|
||||
if (this._clipboard) {
|
||||
this._clipboard.destroy();
|
||||
delete this._clipboard;
|
||||
}
|
||||
|
||||
if (this.ui.clipboardButton.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
var clipboard = new Clipboard(this.ui.clipboardButton[0]);
|
||||
clipboard.on('success', function(e) {
|
||||
this._clipboard = new Clipboard(this.ui.clipboardButton[0]);
|
||||
this._clipboard.on('success', function(e) {
|
||||
var $input = $(e.trigger);
|
||||
$input.tooltip('hide')
|
||||
.attr('data-original-title', t('core', 'Link copied!'))
|
||||
|
@ -316,7 +321,7 @@
|
|||
.tooltip('fixTitle');
|
||||
}, 3000);
|
||||
});
|
||||
clipboard.on('error', function (e) {
|
||||
this._clipboard.on('error', function (e) {
|
||||
var $input = $(e.trigger);
|
||||
var actionMsg = '';
|
||||
if (/iPhone|iPad/i.test(navigator.userAgent)) {
|
||||
|
|
|
@ -271,12 +271,17 @@
|
|||
* Clipboard
|
||||
*/
|
||||
initClipboard: function() {
|
||||
if (this._clipboard) {
|
||||
this._clipboard.destroy();
|
||||
delete this._clipboard;
|
||||
}
|
||||
|
||||
if (this.ui.clipboardButton.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
var clipboard = new Clipboard(this.ui.clipboardButton[0]);
|
||||
clipboard.on('success', function(e) {
|
||||
this._clipboard = new Clipboard(this.ui.clipboardButton[0]);
|
||||
this._clipboard.on('success', function(e) {
|
||||
var $input = $(e.trigger);
|
||||
$input.tooltip('hide')
|
||||
.attr('data-original-title', t('core', 'Link copied!'))
|
||||
|
@ -289,7 +294,7 @@
|
|||
.tooltip('fixTitle');
|
||||
}, 3000);
|
||||
});
|
||||
clipboard.on('error', function (e) {
|
||||
this._clipboard.on('error', function (e) {
|
||||
var $input = $(e.trigger);
|
||||
var actionMsg = '';
|
||||
if (/iPhone|iPad/i.test(navigator.userAgent)) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче