1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00
joplin/packages/app-mobile/components/EditorToolbar/utils/toolbarButtonsFromState.ts

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;