mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
Plugins: Add support for "keywords" manifest field
This commit is contained in:
parent
4413e6a1ee
commit
5aa5089ae0
@ -452,9 +452,9 @@ packages/app-desktop/gui/MainScreen/commands/toggleLayoutMoveMode.js.map
|
||||
packages/app-desktop/gui/MainScreen/commands/toggleNoteList.d.ts
|
||||
packages/app-desktop/gui/MainScreen/commands/toggleNoteList.js
|
||||
packages/app-desktop/gui/MainScreen/commands/toggleNoteList.js.map
|
||||
packages/app-desktop/gui/MainScreen/commands/toggleSidebar.d.ts
|
||||
packages/app-desktop/gui/MainScreen/commands/toggleSidebar.js
|
||||
packages/app-desktop/gui/MainScreen/commands/toggleSidebar.js.map
|
||||
packages/app-desktop/gui/MainScreen/commands/toggleSideBar.d.ts
|
||||
packages/app-desktop/gui/MainScreen/commands/toggleSideBar.js
|
||||
packages/app-desktop/gui/MainScreen/commands/toggleSideBar.js.map
|
||||
packages/app-desktop/gui/MainScreen/commands/toggleVisiblePanes.d.ts
|
||||
packages/app-desktop/gui/MainScreen/commands/toggleVisiblePanes.js
|
||||
packages/app-desktop/gui/MainScreen/commands/toggleVisiblePanes.js.map
|
||||
|
6
.gitignore
vendored
6
.gitignore
vendored
@ -441,9 +441,9 @@ packages/app-desktop/gui/MainScreen/commands/toggleLayoutMoveMode.js.map
|
||||
packages/app-desktop/gui/MainScreen/commands/toggleNoteList.d.ts
|
||||
packages/app-desktop/gui/MainScreen/commands/toggleNoteList.js
|
||||
packages/app-desktop/gui/MainScreen/commands/toggleNoteList.js.map
|
||||
packages/app-desktop/gui/MainScreen/commands/toggleSidebar.d.ts
|
||||
packages/app-desktop/gui/MainScreen/commands/toggleSidebar.js
|
||||
packages/app-desktop/gui/MainScreen/commands/toggleSidebar.js.map
|
||||
packages/app-desktop/gui/MainScreen/commands/toggleSideBar.d.ts
|
||||
packages/app-desktop/gui/MainScreen/commands/toggleSideBar.js
|
||||
packages/app-desktop/gui/MainScreen/commands/toggleSideBar.js.map
|
||||
packages/app-desktop/gui/MainScreen/commands/toggleVisiblePanes.d.ts
|
||||
packages/app-desktop/gui/MainScreen/commands/toggleVisiblePanes.js
|
||||
packages/app-desktop/gui/MainScreen/commands/toggleVisiblePanes.js.map
|
||||
|
@ -27,4 +27,4 @@
|
||||
"dependencies": {
|
||||
"uslug": "^1.0.4"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,5 @@
|
||||
"name": "Webview test",
|
||||
"version": "1.0.0",
|
||||
"homepage_url": "https://joplinapp.org",
|
||||
"permissions": [
|
||||
"model"
|
||||
]
|
||||
"keywords": ["table of content", "toc"]
|
||||
}
|
@ -7,5 +7,6 @@
|
||||
"description": "<%= pluginDescription %>",
|
||||
"author": "<%= pluginAuthor %>",
|
||||
"homepage_url": "<%= pluginHomepageUrl %>",
|
||||
"repository_url": "<%= pluginRepositoryUrl %>"
|
||||
"repository_url": "<%= pluginRepositoryUrl %>",
|
||||
"keywords": []
|
||||
}
|
@ -17,6 +17,13 @@ export default function manifestFromObject(o: any): PluginManifest {
|
||||
return o[name];
|
||||
};
|
||||
|
||||
const getStrings = (name: string, required: boolean = true, defaultValue: string[] = []): string[] => {
|
||||
if (required && !o[name]) throw new Error(`Missing required field: ${name}`);
|
||||
if (!o[name]) return defaultValue;
|
||||
if (!Array.isArray(o[name])) throw new Error(`Field must be an array: ${name}`);
|
||||
return o[name];
|
||||
};
|
||||
|
||||
const permissions: PluginPermission[] = [];
|
||||
|
||||
const manifest: PluginManifest = {
|
||||
@ -30,6 +37,7 @@ export default function manifestFromObject(o: any): PluginManifest {
|
||||
description: getString('description', false),
|
||||
homepage_url: getString('homepage_url', false),
|
||||
repository_url: getString('repository_url', false),
|
||||
keywords: getStrings('keywords', false),
|
||||
permissions: permissions,
|
||||
};
|
||||
|
||||
|
@ -12,6 +12,7 @@ export interface PluginManifest {
|
||||
description?: string;
|
||||
homepage_url?: string;
|
||||
repository_url?: string;
|
||||
keywords?: string[];
|
||||
permissions?: PluginPermission[];
|
||||
|
||||
// Private keys
|
||||
|
@ -10,7 +10,9 @@ Name | Type | Required? | Description
|
||||
`app_min_version` | string | **Yes** | Minimum version of Joplin that the plugin is compatible with. In general it should be whatever version you are using to develop the plugin.
|
||||
`description` | string | No | Detailed description of the plugin.
|
||||
`author` | string | No | Plugin author name.
|
||||
`keywords` | string[] | No | Keywords associated with the plugins. They are used in search in particular.
|
||||
`homepage_url` | string | No | Homepage URL of the plugin. It can also be, for example, a link to a GitHub repository.
|
||||
`repository_url` | string | No | Repository URL where the plugin source code is hosted.
|
||||
|
||||
## Manifest example
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user