1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-27 23:28:38 +02:00

Desktop: Simplified and improve command service, and added command palette

- Commands "enabled" state is now expressed using a "when-clause" like in VSCode
- A command palette has been added to the Tools menu
This commit is contained in:
Laurent Cozic
2020-10-18 21:52:10 +01:00
parent f529adac99
commit 3a57cfea02
78 changed files with 897 additions and 756 deletions

View File

@ -30,11 +30,11 @@ export default class JoplinCommands {
*
* // Create a new sub-notebook under the provided notebook
* // Note: internally, notebooks are called "folders".
* await joplin.commands.execute('newFolder', { parent_id: "SOME_FOLDER_ID" });
* await joplin.commands.execute('newFolder', "SOME_FOLDER_ID");
* ```
*/
async execute(commandName: string, props: any = null):Promise<any> {
return CommandService.instance().execute(commandName, props);
async execute(commandName: string, ...args:any[]):Promise<any> {
return CommandService.instance().execute(commandName, ...args);
}
/**
@ -65,8 +65,7 @@ export default class JoplinCommands {
execute: command.execute,
};
if ('isEnabled' in command) runtime.isEnabled = command.isEnabled;
if ('mapStateToProps' in command) runtime.mapStateToProps = command.mapStateToProps;
if ('enabledCondition' in command) runtime.enabledCondition = command.enabledCondition;
CommandService.instance().registerDeclaration(declaration);
CommandService.instance().registerRuntime(declaration.name, runtime);