mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
feature(buffer) move -> cut
This commit is contained in:
parent
b5a1bac0cd
commit
638c0bab6f
4 changed files with 16 additions and 16 deletions
2
HELP.md
2
HELP.md
|
|
@ -203,7 +203,7 @@ Right mouse click button shows context menu with items:
|
|||
- Edit
|
||||
- Rename
|
||||
- Copy
|
||||
- Move
|
||||
- Cut
|
||||
- Paste
|
||||
- Delete
|
||||
- Zip file
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ var Util, DOM;
|
|||
Info = DOM.CurrentInfo,
|
||||
|
||||
COPY = 'copy',
|
||||
MOVE = 'move';
|
||||
CUT = 'cut';
|
||||
|
||||
function getNames() {
|
||||
var name = Info.name,
|
||||
|
|
@ -26,20 +26,20 @@ var Util, DOM;
|
|||
names = getNames(),
|
||||
from = Info.dirPath;
|
||||
|
||||
Storage.remove(MOVE)
|
||||
Storage.remove(CUT)
|
||||
.set(COPY, {
|
||||
from : from,
|
||||
names: names
|
||||
});
|
||||
};
|
||||
|
||||
this.move = function() {
|
||||
this.cut = function() {
|
||||
var Storage = DOM.Storage,
|
||||
names = getNames(),
|
||||
from = Info.dirPath;
|
||||
|
||||
Storage.remove(COPY)
|
||||
.set(MOVE, {
|
||||
.set(CUT, {
|
||||
from : from,
|
||||
names: names
|
||||
});
|
||||
|
|
@ -47,30 +47,30 @@ var Util, DOM;
|
|||
|
||||
this.paste = function() {
|
||||
var copy = Storage.get.bind(Storage, COPY),
|
||||
move = Storage.get.bind(Storage, MOVE);
|
||||
cut = Storage.get.bind(Storage, CUT);
|
||||
|
||||
Util.exec.parallel([copy, move], function(error, cp, mv) {
|
||||
Util.exec.parallel([copy, cut], function(error, cp, ct) {
|
||||
var data = {},
|
||||
msg = 'Path is same!',
|
||||
path = Info.dirPath;
|
||||
|
||||
if (!error && !cp && !mv)
|
||||
if (!error && !cp && !ct)
|
||||
error = 'No files selected!';
|
||||
|
||||
if (error) {
|
||||
DOM.Dialog.alert(error);
|
||||
} else if (cp) {
|
||||
data = Util.parseJSON(cp);
|
||||
data.to = path;
|
||||
data = Util.parseJSON(cp);
|
||||
data.to = path;
|
||||
|
||||
if (data.from === path)
|
||||
Dialog.alert(msg);
|
||||
else
|
||||
DOM.copyFiles(data);
|
||||
|
||||
} else if (mv) {
|
||||
data = Util.parseJSON(mv);
|
||||
data.to = path;
|
||||
} else if (ct) {
|
||||
data = Util.parseJSON(ct);
|
||||
data.to = path;
|
||||
|
||||
if (data.from === path)
|
||||
Dialog.alert(msg);
|
||||
|
|
@ -79,7 +79,7 @@ var Util, DOM;
|
|||
}
|
||||
|
||||
Storage.remove(COPY)
|
||||
.remove(MOVE);
|
||||
.remove(CUT);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -429,7 +429,7 @@ var CloudCmd, Util, DOM;
|
|||
|
||||
case Key.X:
|
||||
if (ctrl)
|
||||
Buffer.move();
|
||||
Buffer.cut();
|
||||
break;
|
||||
|
||||
case Key.V:
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ var CloudCmd, Util, DOM, CloudFunc, MenuIO;
|
|||
setTimeout(DOM.renameCurrent, 100);
|
||||
},
|
||||
'Copy' : Buffer.copy,
|
||||
'Move' : Buffer.move,
|
||||
'Cut' : Buffer.cut,
|
||||
'Paste' : Buffer.paste,
|
||||
'Delete' : DOM.promptDelete,
|
||||
'Zip file' : DOM.zipFile,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue