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

Plugins: Allow custom commands to return a result

This commit is contained in:
Laurent Cozic
2020-10-21 01:43:06 +01:00
parent 60a6f714bc
commit 5d39860707
4 changed files with 70 additions and 24 deletions

View File

@ -1,4 +1,4 @@
import CommandService, { CommandDeclaration, CommandRuntime } from 'lib/services/CommandService';
import CommandService, { CommandContext, CommandDeclaration, CommandRuntime } from 'lib/services/CommandService';
import { Command } from './types';
/**
@ -62,7 +62,9 @@ export default class JoplinCommands {
if ('iconName' in command) declaration.iconName = command.iconName;
const runtime:CommandRuntime = {
execute: command.execute,
execute: (_context:CommandContext, ...args:any[]) => {
return command.execute(...args);
},
};
if ('enabledCondition' in command) runtime.enabledCondition = command.enabledCondition;