1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-15 09:04:04 +02:00
joplin/ElectronClient/gui/MainScreen/commands/showNoteProperties.ts
2020-09-15 14:01:07 +01:00

31 lines
804 B
TypeScript

import CommandService, { CommandRuntime, CommandDeclaration } from '../../../lib/services/CommandService';
const { _ } = require('lib/locale');
export const declaration:CommandDeclaration = {
name: 'showNoteProperties',
label: () => _('Note properties'),
iconName: 'icon-info',
};
export const runtime = (comp:any):CommandRuntime => {
return {
execute: async ({ noteId }:any) => {
comp.setState({
notePropertiesDialogOptions: {
noteId: noteId,
visible: true,
onRevisionLinkClick: () => {
CommandService.instance().execute('showRevisions');
},
},
});
},
isEnabled: (props:any) => {
return !!props.noteId;
},
mapStateToProps: (state:any) => {
return { noteId: state.selectedNoteIds.length === 1 ? state.selectedNoteIds[0] : null };
},
};
};