From d6c3a240b56bc33958ae08d4c6b20d6c46cfd992 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 15 May 2018 17:33:14 +0300 Subject: [PATCH] feature(key) add ability to copy path with help of Ctrl + p --- HELP.md | 1 + client/key/index.js | 11 +++++++++++ client/key/key.js | 1 + package.json | 1 + 4 files changed, 14 insertions(+) diff --git a/HELP.md b/HELP.md index 82237c52..44f711fd 100644 --- a/HELP.md +++ b/HELP.md @@ -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 diff --git a/client/key/index.js b/client/key/index.js index 6b82d4e8..cafd351e 100644 --- a/client/key/index.js +++ b/client/key/index.js @@ -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'); @@ -415,6 +416,16 @@ function KeyProto() { break; + case Key.P: + if (!ctrlMeta) + return; + + event.preventDefault(); + clipboard + .writeText(Info.dirPath) + .catch(CloudCmd.log); + + break; /** * обновляем страницу, * загружаем содержимое каталога diff --git a/client/key/key.js b/client/key/key.js index 81b2c3ed..197e521e 100644 --- a/client/key/key.js +++ b/client/key/key.js @@ -39,6 +39,7 @@ module.exports = { M : 77, O : 79, + P : 80, Q : 81, R : 82, S : 83, diff --git a/package.json b/package.json index 5dbfc669..d2b07d6b 100644 --- a/package.json +++ b/package.json @@ -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",