penpot/plugins/apps/e2e/src/plugins/create-comments.ts
Andrey Antukh ec1af4ad96 🎉 Import penpot-plugins repository
As commit 819a549e4928d2b1fa98e52bee82d59aec0f70d8
2025-12-30 14:56:15 +01:00

41 lines
874 B
TypeScript

export default function () {
async function createComment() {
const page = penpot.currentPage;
if (page) {
await page.addCommentThread('Hello world!', {
x: penpot.viewport.center.x,
y: penpot.viewport.center.y,
});
}
}
async function replyComment() {
const page = penpot.currentPage;
if (page) {
const comments = await page.findCommentThreads({
onlyYours: true,
showResolved: false,
});
await comments[0].reply('This is a reply.');
}
}
async function deleteComment() {
const page = penpot.currentPage;
if (page) {
const commentThreads = await page.findCommentThreads({
onlyYours: true,
showResolved: false,
});
await page.removeCommentThread(commentThreads[0]);
}
}
createComment();
replyComment();
deleteComment();
}