1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-29 22:48:10 +02:00

Chore: Refactor note list on desktop using React Hooks (#6410)

This commit is contained in:
Laurent
2022-04-14 16:50:42 +01:00
committed by GitHub
parent 7e1ee40333
commit 1b043d856d
6 changed files with 252 additions and 206 deletions

View File

@@ -1,6 +1,7 @@
import { CommandRuntime, CommandDeclaration, CommandContext } from '@joplin/lib/services/CommandService';
import { _ } from '@joplin/lib/locale';
import { stateUtils } from '@joplin/lib/reducer';
import { itemAnchorRef } from '../NoteList';
export const declaration: CommandDeclaration = {
name: 'focusElementNoteList',
@@ -8,13 +9,13 @@ export const declaration: CommandDeclaration = {
parentLabel: () => _('Focus'),
};
export const runtime = (comp: any): CommandRuntime => {
export const runtime = (): CommandRuntime => {
return {
execute: async (context: CommandContext, noteId: string = null) => {
noteId = noteId || stateUtils.selectedNoteId(context.state);
if (noteId) {
const ref = comp.itemAnchorRef(noteId);
const ref = itemAnchorRef(noteId);
if (ref) ref.focus();
}
},