1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-08-24 20:19:10 +02:00

Compare commits

...

9 Commits

Author SHA1 Message Date
Hubert
c88e147343 Merge remote-tracking branch 'origin/dev' into issue-8408 2023-07-25 11:38:36 -03:00
Hubert
078425c047 Undo changes in .ignore files 2023-07-25 11:35:57 -03:00
Hubert
0b928a3883 Fixes from review. 2023-07-24 10:08:01 -03:00
Hubert
90b95cd888 Update the icon's documentation to only allow PNG icons. 2023-07-22 19:45:43 -03:00
Hubert
849b124040 Merge remote-tracking branch 'origin/dev' into issue-8408 2023-07-22 19:37:19 -03:00
Hubert
bbfc7295f6 Updates from review. 2023-07-22 17:52:20 -03:00
Hubert
03d487e0c1 Fixes from review. 2023-07-18 08:30:32 -03:00
Hubert
5d40937200 Merge remote-tracking branch 'origin/dev' into issue-8408 2023-07-17 21:08:08 -03:00
Hubert
ad2945df15 Adding support for icons in the manifest.json. 2023-07-17 21:06:21 -03:00
4 changed files with 37 additions and 4 deletions

View File

@@ -10,5 +10,6 @@
"repository_url": "<%= pluginRepositoryUrl %>",
"keywords": [],
"categories": [],
"screenshots": []
}
"screenshots": [],
"icons": {}
}

View File

@@ -1,4 +1,4 @@
import { PluginManifest, PluginPermission, Screenshot } from './types';
import { PluginManifest, PluginPermission, Screenshot, Icons } from './types';
import validatePluginId from './validatePluginId';
export default function manifestFromObject(o: any): PluginManifest {
@@ -36,6 +36,13 @@ export default function manifestFromObject(o: any): PluginManifest {
return o.screenshots;
};
const getIcons = (): Icons => {
for (const size of [16, 32, 48, 128]) {
if (o.icons[size as keyof Icons]) return o.icons;
}
return null;
};
const permissions: PluginPermission[] = [];
const manifest: PluginManifest = {
@@ -53,6 +60,7 @@ export default function manifestFromObject(o: any): PluginManifest {
categories: getStrings('categories', false),
screenshots: getScreenshots(),
permissions: permissions,
icons: getIcons(),
_recommended: getBoolean('_recommended', false, false),
_built_in: getBoolean('_built_in', false, false),

View File

@@ -7,6 +7,13 @@ export interface Screenshot {
label: string;
}
export interface Icons {
16?: string;
32?: string;
48?: string;
128?: string;
}
export interface PluginManifest {
manifest_version: number;
id: string;
@@ -21,6 +28,7 @@ export interface PluginManifest {
categories?: string[];
screenshots?: Screenshot[];
permissions?: PluginPermission[];
icons?: Icons;
// Private keys
_package_hash?: string;

View File

@@ -15,6 +15,7 @@ Name | Type | Required? | Description
`repository_url` | string | No | Repository URL where the plugin source code is hosted.
`categories` | string[] | No | [Categories](#categories) that describes the functionality of the plugin.
`screenshots` | Screenshot[] | No | [Screenshots](#Screenshot) are used for listing on Joplin Plugin website.
`icons` | Icons | No | If [Icons](#Icons) is not supplied, a standard extension icon will be used by default. You should supply at least a main icon, ideally 48x48 px in size. This is the icon that will be used in various plugin pages. You may, however, supply icons of any size and Joplin will attempt to find the best icon to display in different components. Only PNG icons are allowed.
## Categories
@@ -39,6 +40,15 @@ Name | Type | Required? | Description
| src | a relative path to src dir. |
| label | description of the image. |
## Icons
| Properties | Description |
| --- | --- |
| 16 | a relative path to a PNG icon. |
| 32 | a relative path to a PNG icon. |
| 48 | a relative path to a PNG icon. |
| 128 | a relative path to a PNG icon. |
## Manifest example
```json
@@ -53,6 +63,12 @@ Name | Type | Required? | Description
"screenshots": [{
"src": "path/to/image.png",
"label": "image description"
}]
}],
"icons": {
"16": "path/to/icon16.png",
"32": "path/to/icon32.png",
"48": "path/to/icon48.png",
"128": "path/to/icon128.png"
}
}
```