diff --git a/packages/generator-joplin/generators/app/templates/api/JoplinCommands.d.ts b/packages/generator-joplin/generators/app/templates/api/JoplinCommands.d.ts index e4487cf33..031cc9234 100644 --- a/packages/generator-joplin/generators/app/templates/api/JoplinCommands.d.ts +++ b/packages/generator-joplin/generators/app/templates/api/JoplinCommands.d.ts @@ -15,7 +15,7 @@ import { Command } from './types'; * * * [Main screen commands](https://github.com/laurent22/joplin/tree/dev/packages/app-desktop/gui/MainScreen/commands) * * [Global commands](https://github.com/laurent22/joplin/tree/dev/packages/app-desktop/commands) - * * [Editor commands](https://github.com/laurent22/joplin/tree/dev/packages/app-desktop/gui/NoteEditor/commands/editorCommandDeclarations.ts) + * * [Editor commands](https://github.com/laurent22/joplin/tree/dev/packages/app-desktop/gui/NoteEditor/editorCommandDeclarations.ts) * * To view what arguments are supported, you can open any of these files * and look at the `execute()` command. diff --git a/packages/generator-joplin/generators/app/templates/api/JoplinWorkspace.d.ts b/packages/generator-joplin/generators/app/templates/api/JoplinWorkspace.d.ts index b24153ba1..5fdd284eb 100644 --- a/packages/generator-joplin/generators/app/templates/api/JoplinWorkspace.d.ts +++ b/packages/generator-joplin/generators/app/templates/api/JoplinWorkspace.d.ts @@ -16,8 +16,12 @@ interface ItemChangeEvent { interface SyncStartEvent { withErrors: boolean; } +interface ResourceChangeEvent { + id: string; +} declare type ItemChangeHandler = (event: ItemChangeEvent)=> void; declare type SyncStartHandler = (event: SyncStartEvent)=> void; +declare type ResourceChangeHandler = (event: ResourceChangeEvent)=> void; /** * The workspace service provides access to all the parts of Joplin that * are being worked on - i.e. the currently selected notes or notebooks as @@ -42,6 +46,11 @@ export default class JoplinWorkspace { * Called when the content of the current note changes. */ onNoteChange(handler: ItemChangeHandler): Promise; + /** + * Called when a resource is changed. Currently this handled will not be + * called when a resource is added or deleted. + */ + onResourceChange(handler: ResourceChangeHandler): Promise; /** * Called when an alarm associated with a to-do is triggered. */ diff --git a/packages/generator-joplin/generators/app/templates/api/types.ts b/packages/generator-joplin/generators/app/templates/api/types.ts index 9effa4ec1..640d08399 100644 --- a/packages/generator-joplin/generators/app/templates/api/types.ts +++ b/packages/generator-joplin/generators/app/templates/api/types.ts @@ -297,7 +297,7 @@ export interface MenuItem { /** * Set to "separator" to create a divider line */ - type?: string; + type?: ('normal' | 'separator' | 'submenu' | 'checkbox' | 'radio'); /** * Accelerator associated with the menu item @@ -364,6 +364,12 @@ export enum SettingItemType { Button = 6, } +export enum SettingItemSubType { + FilePathAndArgs = 'file_path_and_args', + FilePath = 'file_path', // Not supported on mobile! + DirectoryPath = 'directory_path', // Not supported on mobile! +} + export enum AppType { Desktop = 'desktop', Mobile = 'mobile', @@ -381,6 +387,12 @@ export interface SettingItem { value: any; type: SettingItemType; + /** + * Currently only used to display a file or directory selector. Always set + * `type` to `SettingItemType.String` when using this property. + */ + subType?: SettingItemSubType; + label: string; description?: string; diff --git a/packages/generator-joplin/updateTypes.sh b/packages/generator-joplin/updateTypes.sh index 7c7699830..d9690d415 100755 --- a/packages/generator-joplin/updateTypes.sh +++ b/packages/generator-joplin/updateTypes.sh @@ -8,7 +8,7 @@ cd "$LIB_DIR" yarn run generatePluginTypes cd "$SCRIPT_DIR" -rsync -a --delete "$LIB_DIR/plugin_types/services/plugins/api/" "$SCRIPT_DIR/generators/app/templates/api/" +rsync -a --delete "$LIB_DIR/plugin_types/lib/services/plugins/api/" "$SCRIPT_DIR/generators/app/templates/api/" cp "$LIB_DIR/services/plugins/api/types.ts" "$SCRIPT_DIR/generators/app/templates/api/" cp "$SCRIPT_DIR/generators/app/templates/api_index.ts" "$SCRIPT_DIR/generators/app/templates/api/index.ts" rm -f "$SCRIPT_DIR/generators/app/templates/api/types.d.ts"