You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-07-13 00:10:37 +02:00
Mobile: Add support for plugin panels and dialogs (#10121)
This commit is contained in:
22
packages/app-mobile/commands/scrollToHash.ts
Normal file
22
packages/app-mobile/commands/scrollToHash.ts
Normal file
@ -0,0 +1,22 @@
|
||||
import { CommandContext, CommandDeclaration, CommandRuntime } from '@joplin/lib/services/CommandService';
|
||||
import NavService from '@joplin/lib/services/NavService';
|
||||
|
||||
export const declaration: CommandDeclaration = {
|
||||
name: 'scrollToHash',
|
||||
};
|
||||
|
||||
export const runtime = (): CommandRuntime => {
|
||||
return {
|
||||
execute: async (context: CommandContext, hash: string) => {
|
||||
const selectedNoteIds = context.state.selectedNoteIds;
|
||||
if (selectedNoteIds.length === 0) {
|
||||
throw new Error('Unable to scroll to hash -- no note open.');
|
||||
}
|
||||
|
||||
await NavService.go('Note', {
|
||||
noteId: selectedNoteIds[0],
|
||||
noteHash: hash,
|
||||
});
|
||||
},
|
||||
};
|
||||
};
|
Reference in New Issue
Block a user