Force save share link password if click outside
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> Signed-off-by: npmbuildbot[bot] <npmbuildbot[bot]@users.noreply.github.com>
This commit is contained in:
parent
a8405bf175
commit
d22cd504c3
3 changed files with 25 additions and 1 deletions
BIN
core/js/dist/share_backend.js
vendored
BIN
core/js/dist/share_backend.js
vendored
Binary file not shown.
BIN
core/js/dist/share_backend.js.map
vendored
BIN
core/js/dist/share_backend.js.map
vendored
Binary file not shown.
|
@ -42,6 +42,9 @@
|
||||||
/** @type {boolean} **/
|
/** @type {boolean} **/
|
||||||
showPending: false,
|
showPending: false,
|
||||||
|
|
||||||
|
/** @type {boolean} **/
|
||||||
|
hasPasswordChanged: false,
|
||||||
|
|
||||||
/** @type {string} **/
|
/** @type {string} **/
|
||||||
password: '',
|
password: '',
|
||||||
|
|
||||||
|
@ -323,6 +326,7 @@
|
||||||
password: '',
|
password: '',
|
||||||
cid: shareId
|
cid: shareId
|
||||||
});
|
});
|
||||||
|
this.hasPasswordChanged = false
|
||||||
} else {
|
} else {
|
||||||
if (!OC.Util.isIE()) {
|
if (!OC.Util.isIE()) {
|
||||||
$li.find('.linkPassText').focus();
|
$li.find('.linkPassText').focus();
|
||||||
|
@ -331,8 +335,13 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
onPasswordKeyUp: function(event) {
|
onPasswordKeyUp: function(event) {
|
||||||
if(event.keyCode === 13) {
|
var $element = $(event.target);
|
||||||
|
var $li = $element.closest('li[data-share-id]');
|
||||||
|
var shareId = $li.data('share-id');
|
||||||
|
if (event.keyCode === 13) {
|
||||||
this.onPasswordEntered(event);
|
this.onPasswordEntered(event);
|
||||||
|
} else {
|
||||||
|
this.hasPasswordChanged = shareId
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -367,6 +376,8 @@
|
||||||
$loading
|
$loading
|
||||||
.removeClass('hidden')
|
.removeClass('hidden')
|
||||||
.addClass('inlineblock');
|
.addClass('inlineblock');
|
||||||
|
|
||||||
|
this.hasPasswordChanged = false
|
||||||
|
|
||||||
this.model.saveLinkShare({
|
this.model.saveLinkShare({
|
||||||
password: password,
|
password: password,
|
||||||
|
@ -656,6 +667,10 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.$el.on('beforeHide', function() {
|
||||||
|
this.onMenuhide()
|
||||||
|
}.bind(this));
|
||||||
|
|
||||||
this.$el.html(linkShareTemplate({
|
this.$el.html(linkShareTemplate({
|
||||||
linkShares: linkShares,
|
linkShares: linkShares,
|
||||||
shareAllowed: true,
|
shareAllowed: true,
|
||||||
|
@ -694,6 +709,15 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onMenuhide: function() {
|
||||||
|
if (this.hasPasswordChanged) {
|
||||||
|
var shareId = this.hasPasswordChanged
|
||||||
|
var target = this.$el.find('li[data-share-id=' + shareId + '] #linkPassText-' + shareId);
|
||||||
|
console.debug('Force saving password for share number ', shareId)
|
||||||
|
this.onPasswordEntered({ target: target })
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns {Function} from Handlebars
|
* @returns {Function} from Handlebars
|
||||||
* @private
|
* @private
|
||||||
|
|
Loading…
Reference in a new issue