mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
Chore: Plugin generator: Update types (#10010)
This commit is contained in:
parent
c409160ad7
commit
fa83d48141
@ -13,7 +13,7 @@ import { Path } from './types';
|
||||
* In general you would use the methods in this class as if you were using a REST API. There are four methods that map to GET, POST, PUT and DELETE calls.
|
||||
* And each method takes these parameters:
|
||||
*
|
||||
* * `path`: This is an array that represents the path to the resource in the form `["resouceName", "resourceId", "resourceLink"]` (eg. ["tags", ":id", "notes"]). The "resources" segment is the name of the resources you want to access (eg. "notes", "folders", etc.). If not followed by anything, it will refer to all the resources in that collection. The optional "resourceId" points to a particular resources within the collection. Finally, an optional "link" can be present, which links the resource to a collection of resources. This can be used in the API for example to retrieve all the notes associated with a tag.
|
||||
* * `path`: This is an array that represents the path to the resource in the form `["resourceName", "resourceId", "resourceLink"]` (eg. ["tags", ":id", "notes"]). The "resources" segment is the name of the resources you want to access (eg. "notes", "folders", etc.). If not followed by anything, it will refer to all the resources in that collection. The optional "resourceId" points to a particular resources within the collection. Finally, an optional "link" can be present, which links the resource to a collection of resources. This can be used in the API for example to retrieve all the notes associated with a tag.
|
||||
* * `query`: (Optional) The query parameters. In a URL, this is the part after the question mark "?". In this case, it should be an object with key/value pairs.
|
||||
* * `data`: (Optional) Applies to PUT and POST calls only. The request body contains the data you want to create or modify, for example the content of a note or folder.
|
||||
* * `files`: (Optional) Used to create new resources and associate them with files.
|
||||
|
@ -36,7 +36,7 @@ export default class JoplinImaging {
|
||||
createFromResource(resourceId: string): Promise<Handle>;
|
||||
getSize(handle: Handle): Promise<any>;
|
||||
resize(handle: Handle, options?: ResizeOptions): Promise<string>;
|
||||
crop(handle: Handle, rectange: Rectangle): Promise<string>;
|
||||
crop(handle: Handle, rectangle: Rectangle): Promise<string>;
|
||||
toPngFile(handle: Handle, filePath: string): Promise<void>;
|
||||
/**
|
||||
* Quality is between 0 and 100
|
||||
|
@ -7,14 +7,29 @@ import { ListRenderer } from './noteListType';
|
||||
*
|
||||
* The app provides the required dependencies whenever a note is updated - you
|
||||
* process these dependencies, and return some props, which are then passed to
|
||||
* your template and rendered. See [[[ListRenderer]]] for a detailed description
|
||||
* your template and rendered. See [[ListRenderer]] for a detailed description
|
||||
* of each property of the renderer.
|
||||
*
|
||||
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/note_list_renderer)
|
||||
* ## Reference
|
||||
*
|
||||
* The default list renderer is implemented using the same API, so it worth checking it too:
|
||||
* * [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/note_list_renderer)
|
||||
*
|
||||
* * [Default list renderer](https://github.com/laurent22/joplin/tree/dev/packages/lib/services/noteList/defaultListRenderer.ts)
|
||||
*
|
||||
* ## Screenshots:
|
||||
*
|
||||
* ### Top to bottom with title, date and body
|
||||
*
|
||||
* <img width="250px" src="https://global.discourse-cdn.com/standard14/uploads/cozic/optimized/3X/0/9/09a40a011a805bc39736716d23b08033af420222_2_670x750.png"/>
|
||||
*
|
||||
* ### Left to right with thumbnails
|
||||
*
|
||||
* <img width="250px" src="https://global.discourse-cdn.com/standard14/uploads/cozic/optimized/3X/d/f/dff6f14f9ca3ec6a772314719622723feaedcd09_2_588x750.png"/>
|
||||
*
|
||||
* ### Top to bottom with editable title
|
||||
*
|
||||
* <img width="250px" src="https://global.discourse-cdn.com/standard14/uploads/cozic/optimized/3X/7/2/72acb1bab67d32482cb3da7bb053e54d44ad87b8_2_580x500.png"/>
|
||||
*
|
||||
* [Default list renderer](https://github.com/laurent22/joplin/tree/dev/packages/lib/services/noteList/defaultListRenderer.ts)
|
||||
*/
|
||||
export default class JoplinViewsNoteList {
|
||||
private plugin_;
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Size } from './types';
|
||||
type ListRendererDatabaseDependency = 'folder.created_time' | 'folder.encryption_applied' | 'folder.encryption_cipher_text' | 'folder.icon' | 'folder.id' | 'folder.is_shared' | 'folder.master_key_id' | 'folder.parent_id' | 'folder.share_id' | 'folder.title' | 'folder.updated_time' | 'folder.user_created_time' | 'folder.user_data' | 'folder.user_updated_time' | 'folder.type_' | 'note.altitude' | 'note.application_data' | 'note.author' | 'note.body' | 'note.conflict_original_id' | 'note.created_time' | 'note.encryption_applied' | 'note.encryption_cipher_text' | 'note.id' | 'note.is_conflict' | 'note.is_shared' | 'note.is_todo' | 'note.latitude' | 'note.longitude' | 'note.markup_language' | 'note.master_key_id' | 'note.order' | 'note.parent_id' | 'note.share_id' | 'note.source' | 'note.source_application' | 'note.source_url' | 'note.title' | 'note.todo_completed' | 'note.todo_due' | 'note.updated_time' | 'note.user_created_time' | 'note.user_data' | 'note.user_updated_time' | 'note.type_';
|
||||
type ListRendererDatabaseDependency = 'folder.created_time' | 'folder.deleted_time' | 'folder.encryption_applied' | 'folder.encryption_cipher_text' | 'folder.icon' | 'folder.id' | 'folder.is_shared' | 'folder.master_key_id' | 'folder.parent_id' | 'folder.share_id' | 'folder.title' | 'folder.updated_time' | 'folder.user_created_time' | 'folder.user_data' | 'folder.user_updated_time' | 'folder.type_' | 'note.altitude' | 'note.application_data' | 'note.author' | 'note.body' | 'note.conflict_original_id' | 'note.created_time' | 'note.deleted_time' | 'note.encryption_applied' | 'note.encryption_cipher_text' | 'note.id' | 'note.is_conflict' | 'note.is_shared' | 'note.is_todo' | 'note.latitude' | 'note.longitude' | 'note.markup_language' | 'note.master_key_id' | 'note.order' | 'note.parent_id' | 'note.share_id' | 'note.source' | 'note.source_application' | 'note.source_url' | 'note.title' | 'note.todo_completed' | 'note.todo_due' | 'note.updated_time' | 'note.user_created_time' | 'note.user_data' | 'note.user_updated_time' | 'note.type_';
|
||||
export declare enum ItemFlow {
|
||||
TopToBottom = "topToBottom",
|
||||
LeftToRight = "leftToRight"
|
||||
@ -32,7 +32,7 @@ export type OnChangeHandler = (event: OnChangeEvent) => Promise<void>;
|
||||
* `note.isWatched` tells you if the note is currently opened in an external
|
||||
* editor. In which case you would generally display some indicator.
|
||||
*/
|
||||
export type ListRendererDepependency = ListRendererDatabaseDependency | 'item.size.width' | 'item.size.height' | 'item.selected' | 'note.titleHtml' | 'note.isWatched' | 'note.tags';
|
||||
export type ListRendererDependency = ListRendererDatabaseDependency | 'item.index' | 'item.size.width' | 'item.size.height' | 'item.selected' | 'note.titleHtml' | 'note.isWatched' | 'note.tags';
|
||||
export interface ListRenderer {
|
||||
/**
|
||||
* It must be unique to your plugin.
|
||||
@ -47,7 +47,7 @@ export interface ListRenderer {
|
||||
/**
|
||||
* The size of each item must be specified in advance for performance
|
||||
* reasons, and cannot be changed afterwards. If the item flow is top to
|
||||
* bottom, you only need to specificy the item height (the width will be
|
||||
* bottom, you only need to specify the item height (the width will be
|
||||
* ignored).
|
||||
*/
|
||||
itemSize: Size;
|
||||
@ -74,7 +74,7 @@ export interface ListRenderer {
|
||||
* that you do not add more than what you need since there is a performance
|
||||
* penalty for each property.
|
||||
*/
|
||||
dependencies: ListRendererDepependency[];
|
||||
dependencies: ListRendererDependency[];
|
||||
/**
|
||||
* This is the HTML template that will be used to render the note list item.
|
||||
* This is a [Mustache template](https://github.com/janl/mustache.js) and it
|
||||
@ -128,7 +128,7 @@ export interface ListRenderer {
|
||||
*/
|
||||
onRenderNote: OnRenderNoteHandler;
|
||||
/**
|
||||
* This handler allows adding some interacivity to the note renderer -
|
||||
* This handler allows adding some interactivity to the note renderer -
|
||||
* whenever an input element within the item is changed (for example, when a
|
||||
* checkbox is clicked, or a text input is changed), this `onChange` handler
|
||||
* is going to be called.
|
||||
|
@ -3,7 +3,7 @@
|
||||
import { Size } from './types';
|
||||
|
||||
// AUTO-GENERATED by generate-database-type
|
||||
type ListRendererDatabaseDependency = 'folder.created_time' | 'folder.encryption_applied' | 'folder.encryption_cipher_text' | 'folder.icon' | 'folder.id' | 'folder.is_shared' | 'folder.master_key_id' | 'folder.parent_id' | 'folder.share_id' | 'folder.title' | 'folder.updated_time' | 'folder.user_created_time' | 'folder.user_data' | 'folder.user_updated_time' | 'folder.type_' | 'note.altitude' | 'note.application_data' | 'note.author' | 'note.body' | 'note.conflict_original_id' | 'note.created_time' | 'note.encryption_applied' | 'note.encryption_cipher_text' | 'note.id' | 'note.is_conflict' | 'note.is_shared' | 'note.is_todo' | 'note.latitude' | 'note.longitude' | 'note.markup_language' | 'note.master_key_id' | 'note.order' | 'note.parent_id' | 'note.share_id' | 'note.source' | 'note.source_application' | 'note.source_url' | 'note.title' | 'note.todo_completed' | 'note.todo_due' | 'note.updated_time' | 'note.user_created_time' | 'note.user_data' | 'note.user_updated_time' | 'note.type_';
|
||||
type ListRendererDatabaseDependency = 'folder.created_time' | 'folder.deleted_time' | 'folder.encryption_applied' | 'folder.encryption_cipher_text' | 'folder.icon' | 'folder.id' | 'folder.is_shared' | 'folder.master_key_id' | 'folder.parent_id' | 'folder.share_id' | 'folder.title' | 'folder.updated_time' | 'folder.user_created_time' | 'folder.user_data' | 'folder.user_updated_time' | 'folder.type_' | 'note.altitude' | 'note.application_data' | 'note.author' | 'note.body' | 'note.conflict_original_id' | 'note.created_time' | 'note.deleted_time' | 'note.encryption_applied' | 'note.encryption_cipher_text' | 'note.id' | 'note.is_conflict' | 'note.is_shared' | 'note.is_todo' | 'note.latitude' | 'note.longitude' | 'note.markup_language' | 'note.master_key_id' | 'note.order' | 'note.parent_id' | 'note.share_id' | 'note.source' | 'note.source_application' | 'note.source_url' | 'note.title' | 'note.todo_completed' | 'note.todo_due' | 'note.updated_time' | 'note.user_created_time' | 'note.user_data' | 'note.user_updated_time' | 'note.type_';
|
||||
// AUTO-GENERATED by generate-database-type
|
||||
|
||||
export enum ItemFlow {
|
||||
@ -42,8 +42,9 @@ export type OnChangeHandler = (event: OnChangeEvent)=> Promise<void>;
|
||||
* `note.isWatched` tells you if the note is currently opened in an external
|
||||
* editor. In which case you would generally display some indicator.
|
||||
*/
|
||||
export type ListRendererDepependency =
|
||||
export type ListRendererDependency =
|
||||
ListRendererDatabaseDependency |
|
||||
'item.index' |
|
||||
'item.size.width' |
|
||||
'item.size.height' |
|
||||
'item.selected' |
|
||||
@ -67,7 +68,7 @@ export interface ListRenderer {
|
||||
/**
|
||||
* The size of each item must be specified in advance for performance
|
||||
* reasons, and cannot be changed afterwards. If the item flow is top to
|
||||
* bottom, you only need to specificy the item height (the width will be
|
||||
* bottom, you only need to specify the item height (the width will be
|
||||
* ignored).
|
||||
*/
|
||||
itemSize: Size;
|
||||
@ -96,7 +97,7 @@ export interface ListRenderer {
|
||||
* that you do not add more than what you need since there is a performance
|
||||
* penalty for each property.
|
||||
*/
|
||||
dependencies: ListRendererDepependency[];
|
||||
dependencies: ListRendererDependency[];
|
||||
|
||||
/**
|
||||
* This is the HTML template that will be used to render the note list item.
|
||||
@ -154,7 +155,7 @@ export interface ListRenderer {
|
||||
onRenderNote: OnRenderNoteHandler;
|
||||
|
||||
/**
|
||||
* This handler allows adding some interacivity to the note renderer -
|
||||
* This handler allows adding some interactivity to the note renderer -
|
||||
* whenever an input element within the item is changed (for example, when a
|
||||
* checkbox is clicked, or a text input is changed), this `onChange` handler
|
||||
* is going to be called.
|
||||
|
@ -533,6 +533,43 @@ export interface MarkdownItContentScriptModule extends Omit<ContentScriptModule,
|
||||
plugin: (markdownIt: any, options: any)=> any;
|
||||
}
|
||||
|
||||
type EditorCommandCallback = (...args: any[])=> any;
|
||||
|
||||
export interface CodeMirrorControl {
|
||||
/** Points to a CodeMirror 6 EditorView instance. */
|
||||
editor: any;
|
||||
cm6: any;
|
||||
|
||||
/** `extension` should be a [CodeMirror 6 extension](https://codemirror.net/docs/ref/#state.Extension). */
|
||||
addExtension(extension: any|any[]): void;
|
||||
|
||||
supportsCommand(name: string): boolean;
|
||||
execCommand(name: string, ...args: any[]): any;
|
||||
registerCommand(name: string, callback: EditorCommandCallback): void;
|
||||
|
||||
joplinExtensions: {
|
||||
/**
|
||||
* Returns a [CodeMirror 6 extension](https://codemirror.net/docs/ref/#state.Extension) that
|
||||
* registers the given [CompletionSource](https://codemirror.net/docs/ref/#autocomplete.CompletionSource).
|
||||
*
|
||||
* Use this extension rather than the built-in CodeMirror [`autocompletion`](https://codemirror.net/docs/ref/#autocomplete.autocompletion)
|
||||
* if you don't want to use [languageData-based autocompletion](https://codemirror.net/docs/ref/#autocomplete.autocompletion^config.override).
|
||||
*
|
||||
* Using `autocompletion({ override: [ ... ]})` causes errors when done by multiple plugins.
|
||||
*/
|
||||
completionSource(completionSource: any): any;
|
||||
|
||||
/**
|
||||
* Creates an extension that enables or disables [`languageData`-based autocompletion](https://codemirror.net/docs/ref/#autocomplete.autocompletion^config.override).
|
||||
*/
|
||||
enableLanguageDataAutocomplete: { of: (enabled: boolean)=> any };
|
||||
};
|
||||
}
|
||||
|
||||
export interface CodeMirrorContentScriptModule extends Omit<ContentScriptModule, 'plugin'> {
|
||||
plugin: (codeMirrorControl: CodeMirrorControl)=> void;
|
||||
}
|
||||
|
||||
export enum ContentScriptType {
|
||||
/**
|
||||
* Registers a new Markdown-It plugin, which should follow the template
|
||||
|
@ -5,7 +5,7 @@ import shim from './shim';
|
||||
import ResourceService from './services/ResourceService';
|
||||
import ShareService from './services/share/ShareService';
|
||||
|
||||
interface CheckConfigResult {
|
||||
export interface CheckConfigResult {
|
||||
ok: boolean;
|
||||
errorMessage: string;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user