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

31 lines
799 B
TypeScript
Raw Normal View History

import CommandService, { CommandRuntime, CommandDeclaration } from '../../../lib/services/CommandService';
import { _ } from 'lib/locale';
export const declaration:CommandDeclaration = {
name: 'showNoteProperties',
label: () => _('Note properties'),
2020-09-15 15:01:07 +02:00
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 };
},
};
};