From 4c6b7844b1a0415ed26386940a7342ba338538e9 Mon Sep 17 00:00:00 2001 From: Dominik Jain Date: Tue, 16 Dec 2025 20:00:48 +0100 Subject: [PATCH] Improve comments --- penpot-plugin/src/plugin.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/penpot-plugin/src/plugin.ts b/penpot-plugin/src/plugin.ts index 9cdeaa5..6016ef3 100644 --- a/penpot-plugin/src/plugin.ts +++ b/penpot-plugin/src/plugin.ts @@ -6,10 +6,12 @@ import { Task, TaskHandler } from "./TaskHandler"; */ const taskHandlers: TaskHandler[] = [new ExecuteCodeTaskHandler()]; +// Open the plugin UI penpot.ui.open("Penpot MCP Plugin", `?theme=${penpot.theme}`, { width: 158, height: 200 }); -// Handle both legacy string messages and new request-based messages +// Handle messages penpot.ui.onMessage((message) => { + // Handle plugin task requests if (typeof message === "object" && message.task && message.id) { handlePluginTaskRequest(message).catch((error) => { console.error("Error in handlePluginTaskRequest:", error); @@ -53,7 +55,7 @@ async function handlePluginTaskRequest(request: { id: string; task: string; para } } -// Update the theme in the iframe +// Handle theme change in the iframe penpot.on("themechange", (theme) => { penpot.ui.sendMessage({ source: "penpot",