Remove demo 'add text' button

This commit is contained in:
Dominik Jain 2025-10-02 15:14:46 +02:00 committed by Dominik Jain
parent 11d67037e7
commit e5b5722ce6
3 changed files with 0 additions and 24 deletions

View File

@ -8,8 +8,6 @@
<body>
<p>Penpot MCP Plugin</p>
<button type="button" data-appearance="primary" data-handler="create-text">Create text</button>
<button type="button" data-appearance="secondary" data-handler="connect-mcp">Connect to MCP server</button>
<div id="connection-status" style="margin-top: 10px; font-size: 12px; color: #666">Not connected</div>

View File

@ -77,12 +77,6 @@ function connectToMcpServer(): void {
}
}
// Event handlers
document.querySelector("[data-handler='create-text']")?.addEventListener("click", () => {
// send message to plugin.ts
parent.postMessage("create-text", "*");
});
document.querySelector("[data-handler='connect-mcp']")?.addEventListener("click", () => {
connectToMcpServer();
});

View File

@ -11,22 +11,6 @@ penpot.ui.open("Penpot MCP Plugin", `?theme=${penpot.theme}`);
// Handle both legacy string messages and new request-based messages
penpot.ui.onMessage<string | { id: string; task: string; params: any }>((message) => {
// Legacy string-based message handling
if (typeof message === "string") {
if (message === "create-text") {
const text = penpot.createText("Hello world!");
if (text) {
text.x = penpot.viewport.center.x;
text.y = penpot.viewport.center.y;
penpot.selection = [text];
}
}
return;
}
// New request-based message handling
if (typeof message === "object" && message.task && message.id) {
handlePluginTaskRequest(message).catch((error) => {
console.error("Error in handlePluginTaskRequest:", error);