Skip to content

Commit

Permalink
Update to latest API version + fixed vulnerabilities
Browse files Browse the repository at this point in the history
  • Loading branch information
benji300 committed May 17, 2021
1 parent 2135d13 commit a250917
Show file tree
Hide file tree
Showing 9 changed files with 325 additions and 244 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Escape html characters from note titles before using them as tab titles

### Removed

- Bundled font packages (FontAwesome, Roboto). Use built-in versions now

## [1.3.0] - 2021-03-09

### Added
Expand Down
6 changes: 3 additions & 3 deletions api/Global.d.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import Plugin from '../Plugin';
import Joplin from './Joplin';
/**
* @ignore
*/
/**
* @ignore
*/
export default class Global {
private joplin_;
private requireWhiteList_;
constructor(implementation: any, plugin: Plugin, store: any);
get joplin(): Joplin;
private requireWhiteList;
require(filePath: string): any;
get process(): any;
}
13 changes: 13 additions & 0 deletions api/Joplin.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,17 @@ export default class Joplin {
get views(): JoplinViews;
get interop(): JoplinInterop;
get settings(): JoplinSettings;
/**
* It is not possible to bundle native packages with a plugin, because they
* need to work cross-platforms. Instead access to certain useful native
* packages is provided using this function.
*
* Currently these packages are available:
*
* - [sqlite3](https://www.npmjs.com/package/sqlite3)
* - [fs-extra](https://www.npmjs.com/package/fs-extra)
*
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/nativeModule)
*/
require(_path: string): any;
}
17 changes: 17 additions & 0 deletions api/JoplinPlugins.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,21 @@ export default class JoplinPlugins {
* @deprecated Use joplin.contentScripts.register()
*/
registerContentScript(type: ContentScriptType, id: string, scriptPath: string): Promise<void>;
/**
* Gets the plugin own data directory path. Use this to store any
* plugin-related data. Unlike [[installationDir]], any data stored here
* will be persisted.
*/
dataDir(): Promise<string>;
/**
* Gets the plugin installation directory. This can be used to access any
* asset that was packaged with the plugin. This directory should be
* considered read-only because any data you store here might be deleted or
* re-created at any time. To store new persistent data, use [[dataDir]].
*/
installationDir(): Promise<string>;
/**
* @deprecated Use joplin.require()
*/
require(_path: string): any;
}
9 changes: 8 additions & 1 deletion api/JoplinSettings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,18 @@ export default class JoplinSettings {
private get keyPrefix();
private namespacedKey;
/**
* Registers a new setting. Note that registering a setting item is dynamic and will be gone next time Joplin starts.
* Registers new settings.
* Note that registering a setting item is dynamic and will be gone next time Joplin starts.
* What it means is that you need to register the setting every time the plugin starts (for example in the onStart event).
* The setting value however will be preserved from one launch to the next so there is no risk that it will be lost even if for some
* reason the plugin fails to start at some point.
*/
registerSettings(settings: Record<string, SettingItem>): Promise<void>;
/**
* @deprecated Use joplin.settings.registerSettings()
*
* Registers a new setting.
*/
registerSetting(key: string, settingItem: SettingItem): Promise<void>;
/**
* Registers a new setting section. Like for registerSetting, it is dynamic and needs to be done every time the plugin starts.
Expand Down
2 changes: 1 addition & 1 deletion api/JoplinWorkspace.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default class JoplinWorkspace {
*/
onNoteContentChange(callback: Function): Promise<void>;
/**
* Called when the content of a note changes.
* Called when the content of the current note changes.
*/
onNoteChange(handler: ItemChangeHandler): Promise<Disposable>;
/**
Expand Down
49 changes: 45 additions & 4 deletions api/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,16 +330,57 @@ export enum SettingItemType {
export interface SettingItem {
value: any;
type: SettingItemType;
public: boolean;
label: string;

label: string;
description?: string;
isEnum?: boolean;

/**
* A public setting will appear in the Configuration screen and will be
* modifiable by the user. A private setting however will not appear there,
* and can only be changed programmatically. You may use this to store some
* values that you do not want to directly expose.
*/
public: boolean;

/**
* You would usually set this to a section you would have created
* specifically for the plugin.
*/
section?: string;
options?: any;

/**
* To create a setting with multiple options, set this property to `true`.
* That setting will render as a dropdown list in the configuration screen.
*/
isEnum?: boolean;

/**
* This property is required when `isEnum` is `true`. In which case, it
* should contain a map of value => label.
*/
options?: Record<any, any>;

/**
* Reserved property. Not used at the moment.
*/
appTypes?: string[];

/**
* Set this to `true` to store secure data, such as passwords. Any such
* setting will be stored in the system keychain if one is available.
*/
secure?: boolean;

/**
* An advanced setting will be moved under the "Advanced" button in the
* config screen.
*/
advanced?: boolean;

/**
* Set the min, max and step values if you want to restrict an int setting
* to a particular range.
*/
minimum?: number;
maximum?: number;
step?: number;
Expand Down
13 changes: 6 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a250917

Please sign in to comment.