[cmd:paste] fix #2967 add an option commandsOptions.paste.moveConfirm

To bring up the confirmation dialog when moving items.
This commit is contained in:
nao-pon
2019-07-27 18:37:21 +09:00
parent d03f8dfe0e
commit 7ddac38111
5 changed files with 47 additions and 15 deletions
+39 -13
View File
@@ -312,7 +312,7 @@ elFinder.prototype.commands.paste = function() {
return dfrd;
},
parents, fparents;
parents, fparents, cutDfrd;
if (!cnt || !dst || dst.mime != 'directory') {
@@ -362,22 +362,48 @@ elFinder.prototype.commands.paste = function() {
}
});
if (dfrd.state() == 'rejected') {
if (dfrd.state() === 'rejected') {
return dfrd;
}
$.when(
copy(fcopy),
paste(fpaste)
)
.done(function(cr, pr) {
dfrd.resolve(pr && pr.undo? pr : void(0));
})
.fail(function() {
cutDfrd = $.Deferred();
if (cut && self.options.moveConfirm) {
fm.confirm({
title : 'moveFiles',
text : fm.i18n('confirmMove', dst.i18 || dst.name),
accept : {
label : 'btnYes',
callback : function() {
cutDfrd.resolve();
}
},
cancel : {
label : 'btnCancel',
callback : function() {
cutDfrd.reject();
}
}
});
} else {
cutDfrd.resolve();
}
cutDfrd.done(function() {
$.when(
copy(fcopy),
paste(fpaste)
)
.done(function(cr, pr) {
dfrd.resolve(pr && pr.undo? pr : void(0));
})
.fail(function() {
dfrd.reject();
})
.always(function() {
cut && fm.clipboard([]);
});
}).fail(function() {
dfrd.reject();
})
.always(function() {
cut && fm.clipboard([]);
});
return dfrd;
+3
View File
@@ -663,6 +663,9 @@ elFinder.prototype._options = {
// Maximum number of items that can be placed into the Trash at one time
toTrashMaxItems : 1000
},
paste : {
moveConfirm : false // Display confirmation dialog when moving items
},
help : {
// Tabs to show
view : ['about', 'shortcuts', 'help', 'integrations', 'debug'],
+1
View File
@@ -309,6 +309,7 @@
'confirmNonUTF8' : 'Character encoding of this file couldn\'t be detected. It need to temporarily convert to UTF-8 for editting.<br/>Please select character encoding of this file.', // from v2.1.19 added 28.11.2016
'confirmNotSave' : 'It has been modified.<br/>Losing work if you do not save changes.', // from v2.1 added 15.7.2015
'confirmTrash' : 'Are you sure you want to move items to trash bin?', //from v2.1.24 added 29.4.2017
'confirmMove' : 'Are you sure you want to move items to "$1"?', //from v2.1.50 added 27.7.2019
'apllyAll' : 'Apply to all',
'name' : 'Name',
'size' : 'Size',
+2 -1
View File
@@ -2,7 +2,7 @@
* English translation
* @author Troex Nevelin <troex@fury.scancode.ru>
* @author Naoki Sawada <hypweb+elfinder@gmail.com>
* @version 2019-02-18
* @version 2019-07-27
*/
// elfinder.en.js is integrated into elfinder.(full|min).js by jake build
if (typeof elFinder === 'function' && elFinder.prototype.i18) {
@@ -296,6 +296,7 @@ if (typeof elFinder === 'function' && elFinder.prototype.i18) {
'confirmNonUTF8' : 'Character encoding of this file couldn\'t be detected. It need to temporarily convert to UTF-8 for editting.<br/>Please select character encoding of this file.', // from v2.1.19 added 28.11.2016
'confirmNotSave' : 'It has been modified.<br/>Losing work if you do not save changes.', // from v2.1 added 15.7.2015
'confirmTrash' : 'Are you sure you want to move items to trash bin?', //from v2.1.24 added 29.4.2017
'confirmMove' : 'Are you sure you want to move items to "$1"?', //from v2.1.50 added 27.7.2019
'apllyAll' : 'Apply to all',
'name' : 'Name',
'size' : 'Size',
+2 -1
View File
@@ -2,7 +2,7 @@
* Japanese translation
* @author Tomoaki Yoshida <info@yoshida-studio.jp>
* @author Naoki Sawada <hypweb+elfinder@gmail.com>
* @version 2019-02-18
* @version 2019-07-27
*/
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
@@ -303,6 +303,7 @@
'confirmNonUTF8' : 'このファイルの文字エンコーディングを判別できませんでした。編集するには一時的に UTF-8 に変換する必要があります。<br/>文字エンコーディングを指定してください。', // from v2.1.19 added 28.11.2016
'confirmNotSave' : '変更されています。<br/>保存せずに閉じると編集内容が失われます。', // from v2.1 added 15.7.2015
'confirmTrash' : 'アイテムをごみ箱に移動してもよろしいですか?', //from v2.1.24 added 29.4.2017
'confirmMove' : 'アイテムを"$1"に移動してもよろしいですか?', //from v2.1.50 added 27.7.2019
'apllyAll' : '全てに適用します',
'name' : '名前',
'size' : 'サイズ',