1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-21 09:38:01 +02:00
joplin/ReactNativeClient/lib/commands/historyBackward.ts

30 lines
717 B
TypeScript
Raw Normal View History

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