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