mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-12 08:54:00 +02:00
27 lines
678 B
TypeScript
27 lines
678 B
TypeScript
|
import { CommandRuntime, CommandDeclaration } from '../../../lib/services/CommandService';
|
||
|
const { _ } = require('lib/locale');
|
||
|
|
||
|
export const declaration:CommandDeclaration = {
|
||
|
name: 'focusElementNoteList',
|
||
|
label: () => _('Note list'),
|
||
|
};
|
||
|
|
||
|
export const runtime = (comp:any):CommandRuntime => {
|
||
|
return {
|
||
|
execute: async ({ selectedNoteIds }:any) => {
|
||
|
if (selectedNoteIds.length) {
|
||
|
const ref = comp.itemAnchorRef(selectedNoteIds[0]);
|
||
|
if (ref) ref.focus();
|
||
|
}
|
||
|
},
|
||
|
isEnabled: (props:any):boolean => {
|
||
|
return !!props.selectedNoteIds.length;
|
||
|
},
|
||
|
mapStateToProps: (state:any):any => {
|
||
|
return {
|
||
|
selectedNoteIds: state.selectedNoteIds,
|
||
|
};
|
||
|
},
|
||
|
};
|
||
|
};
|