mirror of
https://github.com/penpot/penpot-mcp.git
synced 2026-04-25 11:18:37 +00:00
Remove demo 'add text' button
This commit is contained in:
parent
11d67037e7
commit
e5b5722ce6
@ -8,8 +8,6 @@
|
|||||||
<body>
|
<body>
|
||||||
<p>Penpot MCP Plugin</p>
|
<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>
|
<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>
|
<div id="connection-status" style="margin-top: 10px; font-size: 12px; color: #666">Not connected</div>
|
||||||
|
|||||||
@ -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", () => {
|
document.querySelector("[data-handler='connect-mcp']")?.addEventListener("click", () => {
|
||||||
connectToMcpServer();
|
connectToMcpServer();
|
||||||
});
|
});
|
||||||
|
|||||||
@ -11,22 +11,6 @@ penpot.ui.open("Penpot MCP Plugin", `?theme=${penpot.theme}`);
|
|||||||
|
|
||||||
// Handle both legacy string messages and new request-based messages
|
// Handle both legacy string messages and new request-based messages
|
||||||
penpot.ui.onMessage<string | { id: string; task: string; params: any }>((message) => {
|
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) {
|
if (typeof message === "object" && message.task && message.id) {
|
||||||
handlePluginTaskRequest(message).catch((error) => {
|
handlePluginTaskRequest(message).catch((error) => {
|
||||||
console.error("Error in handlePluginTaskRequest:", error);
|
console.error("Error in handlePluginTaskRequest:", error);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user