mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-30 10:36:35 +02:00
17 lines
753 B
TypeScript
17 lines
753 B
TypeScript
|
import { AppState } from '../../../utils/types';
|
||
|
import ToolbarButtonUtils from '@joplin/lib/services/commands/ToolbarButtonUtils';
|
||
|
import CommandService from '@joplin/lib/services/CommandService';
|
||
|
import selectedCommandNamesFromState from './selectedCommandNamesFromState';
|
||
|
import stateToWhenClauseContext from '../../../services/commands/stateToWhenClauseContext';
|
||
|
|
||
|
const toolbarButtonUtils = new ToolbarButtonUtils(CommandService.instance());
|
||
|
|
||
|
const toolbarButtonsFromState = (state: AppState) => {
|
||
|
const whenClauseContext = stateToWhenClauseContext(state);
|
||
|
|
||
|
const commandNames = selectedCommandNamesFromState(state);
|
||
|
return toolbarButtonUtils.commandsToToolbarButtons(commandNames, whenClauseContext);
|
||
|
};
|
||
|
|
||
|
export default toolbarButtonsFromState;
|