diff --git a/HELP.md b/HELP.md index 56b75fbf..965bddd4 100644 --- a/HELP.md +++ b/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 diff --git a/css/style.css b/css/style.css index a92de36e..7d68f826 100644 --- a/css/style.css +++ b/css/style.css @@ -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); } diff --git a/lib/client/buffer.js b/lib/client/buffer.js index 0f029e1b..d469b13c 100644 --- a/lib/client/buffer.js +++ b/lib/client/buffer.js @@ -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(); }); }; } diff --git a/lib/client/key.js b/lib/client/key.js index 7fed3a50..dc1861bb 100644 --- a/lib/client/key.js +++ b/lib/client/key.js @@ -437,6 +437,11 @@ var CloudCmd, Util, DOM; Buffer.paste(); break; + case Key.Z: + if (ctrl) + Buffer.clear(); + break; + /* чистим хранилище */ case Key.D: if (ctrl) {