mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-27 10:32:58 +02:00
30 lines
717 B
TypeScript
30 lines
717 B
TypeScript
|
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 };
|
||
|
},
|
||
|
};
|
||
|
};
|