Skip to content

Commit

Permalink
feature(key) add ability to copy path with help of Ctrl + p
Browse files Browse the repository at this point in the history
  • Loading branch information
coderaiser committed May 15, 2018
1 parent f98027e commit d6c3a24
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions HELP.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ Hot keys
| `Ctrl + с` | copy to buffer
| `Ctrl + v` | paste from buffer
| `Ctrl + z` | clear buffer
| `Ctrl + p` | copy path
| `Ctrl + r` | refresh
| `Ctrl + d` | clear local storage
| `Ctrl + a` | select all files in a panel
Expand Down
11 changes: 11 additions & 0 deletions client/key/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
const Info = DOM.CurrentInfo;

const exec = require('execon');
const clipboard = require('@cloudcmd/clipboard');

const Events = require('../dom/events');
const Buffer = require('../dom/buffer');
Expand Down Expand Up @@ -415,6 +416,16 @@ function KeyProto() {

break;

case Key.P:
if (!ctrlMeta)
return;

event.preventDefault();
clipboard
.writeText(Info.dirPath)
.catch(CloudCmd.log);

break;
/**
* обновляем страницу,
* загружаем содержимое каталога
Expand Down
1 change: 1 addition & 0 deletions client/key/key.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ module.exports = {
M : 77,

O : 79,
P : 80,
Q : 81,
R : 82,
S : 83,
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@
"writejson": "^1.1.0"
},
"devDependencies": {
"@cloudcmd/clipboard": "^1.0.0",
"babel-cli": "^6.18.0",
"babel-loader": "^7.0.0",
"babel-plugin-transform-object-assign": "^6.22.0",
Expand Down

0 comments on commit d6c3a24

Please sign in to comment.