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

17 lines
753 B
TypeScript
Raw Normal View History

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;