1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-27 10:32:58 +02:00
joplin/ReactNativeClient/lib/commands/historyForward.ts

30 lines
714 B
TypeScript
Raw Normal View History

import { utils, CommandRuntime, CommandDeclaration } from '../services/CommandService';
const { _ } = require('lib/locale');
export const declaration:CommandDeclaration = {
name: 'historyForward',
label: () => _('Forward'),
iconName: 'fa-arrow-right',
};
interface Props {
forwardHistoryNotes: any[],
}
export const runtime = ():CommandRuntime => {
return {
execute: async (props:Props) => {
if (!props.forwardHistoryNotes.length) return;
utils.store.dispatch({
type: 'HISTORY_FORWARD',
});
},
isEnabled: (props:Props) => {
return props.forwardHistoryNotes.length > 0;
},
mapStateToProps: (state:any) => {
return { forwardHistoryNotes: state.forwardHistoryNotes };
},
};
};