You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-07-13 00:10:37 +02:00
Chore: Update plugin types
This commit is contained in:
@ -1,12 +1,33 @@
|
||||
import { Rectangle } from './types';
|
||||
export interface Implementation {
|
||||
nativeImage: any;
|
||||
}
|
||||
export interface CreateFromBufferOptions {
|
||||
width?: number;
|
||||
height?: number;
|
||||
scaleFactor?: number;
|
||||
}
|
||||
export interface CreateFromPdfOptions {
|
||||
/**
|
||||
* The first page to export. Defaults to `1`, the first page in
|
||||
* the document.
|
||||
*/
|
||||
minPage?: number;
|
||||
/**
|
||||
* The number of the last page to convert. Defaults to the last page
|
||||
* if not given.
|
||||
*
|
||||
* If `maxPage` is greater than the number of pages in the PDF, all pages
|
||||
* in the PDF will be converted to images.
|
||||
*/
|
||||
maxPage?: number;
|
||||
scaleFactor?: number;
|
||||
}
|
||||
export interface PdfInfo {
|
||||
pageCount: number;
|
||||
}
|
||||
export interface Implementation {
|
||||
createFromPath: (path: string) => Promise<unknown>;
|
||||
createFromPdf: (path: string, options: CreateFromPdfOptions) => Promise<unknown[]>;
|
||||
getPdfInfo: (path: string) => Promise<PdfInfo>;
|
||||
}
|
||||
export interface ResizeOptions {
|
||||
width?: number;
|
||||
height?: number;
|
||||
@ -24,6 +45,7 @@ export type Handle = string;
|
||||
* [View the
|
||||
* example](https://github.com/laurent22/joplin/blob/dev/packages/app-cli/tests/support/plugins/imaging/src/index.ts)
|
||||
*
|
||||
* <span class="platform-desktop">desktop</span>
|
||||
*/
|
||||
export default class JoplinImaging {
|
||||
private implementation_;
|
||||
@ -32,11 +54,20 @@ export default class JoplinImaging {
|
||||
private createImageHandle;
|
||||
private imageByHandle;
|
||||
private cacheImage;
|
||||
/**
|
||||
* Creates an image from the provided path. Note that images and PDFs are supported. If you
|
||||
* provide a URL instead of a local path, the file will be downloaded first then converted to an
|
||||
* image.
|
||||
*/
|
||||
createFromPath(filePath: string): Promise<Handle>;
|
||||
createFromResource(resourceId: string): Promise<Handle>;
|
||||
createFromPdfPath(path: string, options?: CreateFromPdfOptions): Promise<Handle[]>;
|
||||
createFromPdfResource(resourceId: string, options?: CreateFromPdfOptions): Promise<Handle[]>;
|
||||
getPdfInfoFromPath(path: string): Promise<PdfInfo>;
|
||||
getPdfInfoFromResource(resourceId: string): Promise<PdfInfo>;
|
||||
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
|
||||
@ -57,5 +88,5 @@ export default class JoplinImaging {
|
||||
* Image data is not automatically deleted by Joplin so make sure you call
|
||||
* this method on the handle once you are done.
|
||||
*/
|
||||
free(handle: Handle): Promise<void>;
|
||||
free(handles: Handle[] | Handle): Promise<void>;
|
||||
}
|
||||
|
Reference in New Issue
Block a user