mirror of
https://github.com/penpot/penpot-plugins.git
synced 2025-01-23 07:08:47 -05:00
feat(plugins-runtime): add method for pages
This commit is contained in:
parent
a5547755b5
commit
9a9b33a8fe
2 changed files with 16 additions and 1 deletions
2
libs/plugin-types/index.d.ts
vendored
2
libs/plugin-types/index.d.ts
vendored
|
@ -207,7 +207,7 @@ export interface PenpotFile extends PenpotPluginData {
|
||||||
* - `'penpot'` will create a *.penpot file with a binary representation of the file
|
* - `'penpot'` will create a *.penpot file with a binary representation of the file
|
||||||
* - `'zip'` will create a *.zip with the file exported in several SVG files with some JSON metadata
|
* - `'zip'` will create a *.zip with the file exported in several SVG files with some JSON metadata
|
||||||
*/
|
*/
|
||||||
export(exportType: 'penpot' | 'zip'): Uint8Array;
|
export(exportType: 'penpot' | 'zip'): Promise<Uint8Array>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -368,6 +368,21 @@ export function createApi(context: PenpotContext, manifest: Manifest): Penpot {
|
||||||
checkPermission('content:read');
|
checkPermission('content:read');
|
||||||
return context.generateStyle(shapes, options);
|
return context.generateStyle(shapes, options);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
openViewer(): void {
|
||||||
|
checkPermission('content:read');
|
||||||
|
context.openViewer();
|
||||||
|
},
|
||||||
|
|
||||||
|
createPage(): PenpotPage {
|
||||||
|
checkPermission('content:write');
|
||||||
|
return context.createPage();
|
||||||
|
},
|
||||||
|
|
||||||
|
openPage(page: PenpotPage): void {
|
||||||
|
checkPermission('content:read');
|
||||||
|
context.openPage(page);
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
return penpot;
|
return penpot;
|
||||||
|
|
Loading…
Add table
Reference in a new issue