0
Fork 0
mirror of https://github.com/penpot/penpot-plugins.git synced 2025-01-06 14:50:21 -05:00

feat(docs): add examples for new permissions

This commit is contained in:
alonso.torres 2024-09-24 14:43:59 +02:00 committed by Alonso Torres
parent 5adbee2b23
commit 2f0f7a601c
3 changed files with 14 additions and 7 deletions

View file

@ -27,11 +27,11 @@ Next, create a `manifest.json` file inside the `/src/assets` directory. This fil
"code": "/assets/plugin.js", "code": "/assets/plugin.js",
"icon": "/assets/icon.png", "icon": "/assets/icon.png",
"permissions": [ "permissions": [
"content:read",
"content:write", "content:write",
"library:read",
"library:write", "library:write",
"user:read" "user:read",
"comment:read",
"allow:downloads"
] ]
} }
``` ```

View file

@ -31,11 +31,11 @@ Next, create a `manifest.json` file inside the `/public` directory. This file is
"code": "/plugin.js", "code": "/plugin.js",
"icon": "/icon.png", "icon": "/icon.png",
"permissions": [ "permissions": [
"content:read",
"content:write", "content:write",
"library:read",
"library:write", "library:write",
"user:read" "user:read",
"comment:read",
"allow:downloads"
] ]
} }
``` ```

View file

@ -497,6 +497,7 @@ export interface Comment {
/** /**
* Remove the current comment from its comment thread. Only the owner can remove their comments. * Remove the current comment from its comment thread. Only the owner can remove their comments.
* Requires the `comment:write` permission.
*/ */
remove(): void; remove(): void;
} }
@ -535,18 +536,21 @@ export interface CommentThread {
/** /**
* List of `comments` ordered by creation date. * List of `comments` ordered by creation date.
* Requires the `comment:read` o `comment:write` permission.
*/ */
findComments(): Promise<Comment[]>; findComments(): Promise<Comment[]>;
/** /**
* Creates a new comment after the last one in the thread. The current user will * Creates a new comment after the last one in the thread. The current user will
* be used as the creation user. * be used as the creation user.
* Requires the `comment:write` permission.
*/ */
reply(content: string): Promise<Comment>; reply(content: string): Promise<Comment>;
/** /**
* Removes the current comment thread. Only the user that created the thread can * Removes the current comment thread. Only the user that created the thread can
* remove it. * remove it.
* Requires the `comment:write` permission.
*/ */
remove(): void; remove(): void;
} }
@ -2840,11 +2844,13 @@ export interface Page extends PluginData {
* Creates a new comment thread in the `position`. Optionaly adds * Creates a new comment thread in the `position`. Optionaly adds
* it into the `board`. * it into the `board`.
* Returns the thread created. * Returns the thread created.
* Requires the `comment:write` permission.
*/ */
addCommentThread(content: string, position: Point): Promise<CommentThread>; addCommentThread(content: string, position: Point): Promise<CommentThread>;
/** /**
* Removes the comment thread. * Removes the comment thread.
* Requires the `comment:read` or `comment:write` permission.
*/ */
removeCommentThread(commentThread: CommentThread): Promise<void>; removeCommentThread(commentThread: CommentThread): Promise<void>;
@ -2854,8 +2860,9 @@ export interface Page extends PluginData {
* user has engaged. * user has engaged.
* - `showResolved`: by default resolved comments will be hidden. If `true` * - `showResolved`: by default resolved comments will be hidden. If `true`
* the resolved will be returned. * the resolved will be returned.
* Requires the `comment:read` or `comment:write` permission.
*/ */
findCommentThreads(criteria: { findCommentThreads(criteria?: {
onlyYours: boolean; onlyYours: boolean;
showResolved: boolean; showResolved: boolean;
}): Promise<CommentThread[]>; }): Promise<CommentThread[]>;