mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
feature(cloudcmd) only user menu on f2
This commit is contained in:
parent
a61eb22b62
commit
a8e679bf03
7 changed files with 4 additions and 51 deletions
3
HELP.md
3
HELP.md
|
|
@ -164,7 +164,7 @@ Hot keys
|
||||||
|Key |Operation
|
|Key |Operation
|
||||||
|:----------------------|:--------------------------------------------
|
|:----------------------|:--------------------------------------------
|
||||||
| `F1` | help
|
| `F1` | help
|
||||||
| `F2` | rename or show `user menu`
|
| `F2` | show `user menu`
|
||||||
| `F3` | view, change directory
|
| `F3` | view, change directory
|
||||||
| `Shift + F3` | view as markdown
|
| `Shift + F3` | view as markdown
|
||||||
| `F4` | edit
|
| `F4` | edit
|
||||||
|
|
@ -466,7 +466,6 @@ Some config options can be overridden with environment variables, such as:
|
||||||
|
|
||||||
### User Menu
|
### User Menu
|
||||||
|
|
||||||
You can enable `user menu` with help of a flag `--user-menu` (bear in mind that file rename using `F2` will be disabled, but you can use `Shift` + `F6` or `F2` + `F2`).
|
|
||||||
When you press `F2` Cloud Commander will read a file `.cloudcmd.menu.js` by walking up parent directories, if can't read it will try to read `~/.cloudcmd.menu.js`.
|
When you press `F2` Cloud Commander will read a file `.cloudcmd.menu.js` by walking up parent directories, if can't read it will try to read `~/.cloudcmd.menu.js`.
|
||||||
|
|
||||||
Let's consider example `user menu` works file:
|
Let's consider example `user menu` works file:
|
||||||
|
|
|
||||||
|
|
@ -195,10 +195,7 @@ function KeyProto() {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Key.F2:
|
case Key.F2:
|
||||||
if (CloudCmd.config('userMenu'))
|
CloudCmd.UserMenu.show();
|
||||||
return CloudCmd.UserMenu.show();
|
|
||||||
|
|
||||||
DOM.renameCurrent(current);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Key.F3:
|
case Key.F3:
|
||||||
|
|
|
||||||
|
|
@ -142,10 +142,7 @@ module.exports.initKeysPanel = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
function initF2() {
|
function initF2() {
|
||||||
if (CloudCmd.config('userMenu'))
|
CloudCmd.UserMenu.show();
|
||||||
return CloudCmd.UserMenu.show();
|
|
||||||
|
|
||||||
return DOM.renameCurrent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const getPanel = (side) => {
|
const getPanel = (side) => {
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@
|
||||||
<div class="fm">{{ fm }}</div>
|
<div class="fm">{{ fm }}</div>
|
||||||
<div id="js-keyspanel" class="keyspanel">
|
<div id="js-keyspanel" class="keyspanel">
|
||||||
<button id=f1 class="cmd-button reduce-text icon-help" title="Help" >F1</button>
|
<button id=f1 class="cmd-button reduce-text icon-help" title="Help" >F1</button>
|
||||||
<button id=f2 class="cmd-button reduce-text icon-rename" title="Rename" >F2</button>
|
|
||||||
<button id=f2 class="cmd-button reduce-text icon-user-menu" title="User Menu" >F2</button>
|
<button id=f2 class="cmd-button reduce-text icon-user-menu" title="User Menu" >F2</button>
|
||||||
<button id=f3 class="cmd-button reduce-text icon-view" title="View" >F3</button>
|
<button id=f3 class="cmd-button reduce-text icon-view" title="View" >F3</button>
|
||||||
<button id=f4 class="cmd-button reduce-text icon-edit " title="Edit" >F4</button>
|
<button id=f4 class="cmd-button reduce-text icon-edit " title="Edit" >F4</button>
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,6 @@
|
||||||
"importListen": false,
|
"importListen": false,
|
||||||
"log": true,
|
"log": true,
|
||||||
"dropbox": false,
|
"dropbox": false,
|
||||||
"dropboxToken": "",
|
"dropboxToken": ""
|
||||||
"userMenu": false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,6 @@ function indexProcessing(config, options) {
|
||||||
const noConfig = !config('configDialog');
|
const noConfig = !config('configDialog');
|
||||||
const noConsole = !config('console');
|
const noConsole = !config('console');
|
||||||
const noTerminal = !config('terminal');
|
const noTerminal = !config('terminal');
|
||||||
const noUserMenu = !config('userMenu');
|
|
||||||
const {panel} = options;
|
const {panel} = options;
|
||||||
|
|
||||||
let {data} = options;
|
let {data} = options;
|
||||||
|
|
@ -140,13 +139,6 @@ function indexProcessing(config, options) {
|
||||||
data = data
|
data = data
|
||||||
.replace('icon-terminal', 'icon-terminal none');
|
.replace('icon-terminal', 'icon-terminal none');
|
||||||
|
|
||||||
if (noUserMenu)
|
|
||||||
data = data
|
|
||||||
.replace('icon-user-menu', 'icon-user-menu none');
|
|
||||||
else
|
|
||||||
data = data
|
|
||||||
.replace('icon-rename', 'icon-rename none');
|
|
||||||
|
|
||||||
const left = rendy(Template.panel, {
|
const left = rendy(Template.panel, {
|
||||||
side : 'left',
|
side : 'left',
|
||||||
content : panel,
|
content : panel,
|
||||||
|
|
|
||||||
|
|
@ -40,36 +40,6 @@ test('cloudcmd: route: buttons: no console', async (t) => {
|
||||||
t.end();
|
t.end();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('cloudcmd: route: buttons: user menu: disabled', async (t) => {
|
|
||||||
const options = {
|
|
||||||
config: {
|
|
||||||
userMenu: false,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const {body} = await request.get('/', {
|
|
||||||
options,
|
|
||||||
});
|
|
||||||
|
|
||||||
t.ok(/icon-user-menu none/.test(body), 'should hide console');
|
|
||||||
t.end();
|
|
||||||
});
|
|
||||||
|
|
||||||
test('cloudcmd: route: buttons: user menu: enabled', async (t) => {
|
|
||||||
const options = {
|
|
||||||
config: {
|
|
||||||
userMenu: true,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const {body} = await request.get('/', {
|
|
||||||
options,
|
|
||||||
});
|
|
||||||
|
|
||||||
t.ok(/icon-rename none/.test(body), 'should hide console');
|
|
||||||
t.end();
|
|
||||||
});
|
|
||||||
|
|
||||||
test('cloudcmd: route: buttons: console', async (t) => {
|
test('cloudcmd: route: buttons: console', async (t) => {
|
||||||
const config = {
|
const config = {
|
||||||
console: true,
|
console: true,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue