mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
feature(buffer) add cut and clear
This commit is contained in:
parent
9ac9839b95
commit
0e8e94324b
4 changed files with 46 additions and 2 deletions
1
HELP.md
1
HELP.md
|
|
@ -114,6 +114,7 @@ Hot keys
|
|||
| `Ctrl + x` | cut to buffer
|
||||
| `Ctrl + с` | copy to buffer
|
||||
| `Ctrl + v` | paste from buffer
|
||||
| `Ctrl + z` | clear buffer
|
||||
| `Ctrl + r` | refresh
|
||||
| `Ctrl + d` | clear local storage
|
||||
| `Alt + q` | disable key bindings
|
||||
|
|
|
|||
|
|
@ -188,6 +188,10 @@ body {
|
|||
transition: ease 0.05s;
|
||||
}
|
||||
|
||||
.cut-file {
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.selected-file, .selected-file .name > a {
|
||||
color: rgb(254,159,224);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ var Util, DOM;
|
|||
Dialog = DOM.Dialog,
|
||||
Info = DOM.CurrentInfo,
|
||||
|
||||
CLASS = 'cut-file',
|
||||
|
||||
COPY = 'copy',
|
||||
CUT = 'cut';
|
||||
|
||||
|
|
@ -21,6 +23,30 @@ var Util, DOM;
|
|||
return n ? names : [name];
|
||||
}
|
||||
|
||||
function cut() {
|
||||
var files = DOM.getSelectedFiles(),
|
||||
n = files.length;
|
||||
|
||||
if (!n)
|
||||
files = [Info.element];
|
||||
|
||||
files.forEach(function(element) {
|
||||
DOM.addClass(element, CLASS);
|
||||
});
|
||||
}
|
||||
|
||||
function clear() {
|
||||
var files = DOM.getSelectedFiles(),
|
||||
n = files.length;
|
||||
|
||||
if (!n)
|
||||
files = [Info.element];
|
||||
|
||||
files.forEach(function(element) {
|
||||
DOM.removeClass(element, CLASS);
|
||||
});
|
||||
}
|
||||
|
||||
this.copy = function() {
|
||||
var Storage = DOM.Storage,
|
||||
names = getNames(),
|
||||
|
|
@ -38,6 +64,8 @@ var Util, DOM;
|
|||
names = getNames(),
|
||||
from = Info.dirPath;
|
||||
|
||||
cut();
|
||||
|
||||
Storage.remove(COPY)
|
||||
.set(CUT, {
|
||||
from : from,
|
||||
|
|
@ -45,6 +73,13 @@ var Util, DOM;
|
|||
});
|
||||
};
|
||||
|
||||
this.clear = function() {
|
||||
Storage.remove(COPY)
|
||||
.remove(CUT);
|
||||
|
||||
clear();
|
||||
};
|
||||
|
||||
this.paste = function() {
|
||||
var copy = Storage.get.bind(Storage, COPY),
|
||||
cut = Storage.get.bind(Storage, CUT);
|
||||
|
|
@ -78,8 +113,7 @@ var Util, DOM;
|
|||
DOM.moveFiles(data);
|
||||
}
|
||||
|
||||
Storage.remove(COPY)
|
||||
.remove(CUT);
|
||||
clear();
|
||||
});
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -437,6 +437,11 @@ var CloudCmd, Util, DOM;
|
|||
Buffer.paste();
|
||||
break;
|
||||
|
||||
case Key.Z:
|
||||
if (ctrl)
|
||||
Buffer.clear();
|
||||
break;
|
||||
|
||||
/* чистим хранилище */
|
||||
case Key.D:
|
||||
if (ctrl) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue