mirror of
https://github.com/penpot/penpot-mcp.git
synced 2026-04-25 11:18:37 +00:00
Improve comments
This commit is contained in:
parent
a27f2d5122
commit
4c6b7844b1
@ -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<string | { id: string; task: string; params: any }>((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",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user