1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-07-13 00:10:37 +02:00

Desktop: Make sure all commands appear in keymap editor

This commit is contained in:
Laurent Cozic
2020-10-31 12:25:12 +00:00
parent 86c471afcd
commit 4502414934
6 changed files with 78 additions and 39 deletions

View File

@ -144,8 +144,17 @@ export default class CommandService extends BaseService {
return output;
}
public commandNames() {
return Object.keys(this.commands_);
public commandNames(publicOnly:boolean = false) {
if (publicOnly) {
const output = [];
for (const name in this.commands_) {
if (!this.isPublic(name)) continue;
output.push(name);
}
return output;
} else {
return Object.keys(this.commands_);
}
}
public commandByName(name:string, options:CommandByNameOptions = null):Command {
@ -230,6 +239,10 @@ export default class CommandService extends BaseService {
return stateToWhenClauseContext(this.store_.getState());
}
public isPublic(commandName:string) {
return !!this.label(commandName);
}
// When looping on commands and checking their enabled state, the whenClauseContext
// should be specified (created using currentWhenClauseContext) to avoid having
// to re-create it on each call.