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

30 lines
712 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'),
2020-09-15 15:01:07 +02:00
iconName: 'icon-forward',
};
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 };
},
};
};