dragble-angular-editor 1.0.6 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -23
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -285,21 +285,20 @@ export class AdvancedEmailBuilderComponent {
|
|
|
285
285
|
|
|
286
286
|
## MCP — AI Integration
|
|
287
287
|
|
|
288
|
-
Connect AI agents (Claude Code, OpenCode, Codex, Cursor, or your own AI backend) to the editor through the [Model Context Protocol](https://modelcontextprotocol.io).
|
|
288
|
+
Connect AI agents (Claude Code, OpenCode, Codex, Cursor, or your own AI backend) to the editor through the [Model Context Protocol](https://modelcontextprotocol.io). Your backend uses `mcp_key`; third-party AI clients use `mcp_client_key` plus a pairing code. Tool calls mutate design state live on the canvas. No prompt engineering, no JSON hallucination, no broken output.
|
|
289
289
|
|
|
290
290
|
### Enabling MCP
|
|
291
291
|
|
|
292
|
-
MCP is
|
|
292
|
+
MCP is on by default when your plan includes it. You can still set `features: { mcp: true }` explicitly, or set `features: { mcp: false }` to turn it off for an embed:
|
|
293
293
|
|
|
294
294
|
```html
|
|
295
295
|
<dragble-editor
|
|
296
296
|
#editor
|
|
297
297
|
[editorKey]="'db_pxl81cxn92wignwx'"
|
|
298
|
-
[options]="{ features: { mcp: true } }"
|
|
299
298
|
></dragble-editor>
|
|
300
299
|
```
|
|
301
300
|
|
|
302
|
-
MCP also requires a **Starter plan or higher**. Both conditions must be true — plan allows it AND SDK
|
|
301
|
+
MCP also requires a **Starter plan or higher**. Both conditions must be true — plan allows it AND SDK has not opted out.
|
|
303
302
|
|
|
304
303
|
### Quick example — your backend controls the AI
|
|
305
304
|
|
|
@@ -314,7 +313,6 @@ import { DragbleEditorComponent } from "dragble-angular-editor";
|
|
|
314
313
|
<dragble-editor
|
|
315
314
|
#editor
|
|
316
315
|
[editorKey]="'db_pxl81cxn92wignwx'"
|
|
317
|
-
[options]="{ features: { mcp: true } }"
|
|
318
316
|
></dragble-editor>
|
|
319
317
|
`,
|
|
320
318
|
})
|
|
@@ -333,8 +331,8 @@ export class EditorComponent {
|
|
|
333
331
|
const userIdFromAuth = "alice123"; // from your auth/session
|
|
334
332
|
const docIdFromRoute = "campaign-summer"; // from your URL or DB row
|
|
335
333
|
const id = `${userIdFromAuth}-${docIdFromRoute}`;
|
|
336
|
-
const { sessionId } = await this.editor.
|
|
337
|
-
// Pass sessionId to your backend — it calls MCP tools with your mcp_key
|
|
334
|
+
const { sessionId } = await this.editor.getEditor()!.joinMCP({ id });
|
|
335
|
+
// Pass sessionId to your backend — it calls MCP tools with your backend mcp_key
|
|
338
336
|
}
|
|
339
337
|
}
|
|
340
338
|
```
|
|
@@ -343,14 +341,11 @@ export class EditorComponent {
|
|
|
343
341
|
|
|
344
342
|
```typescript
|
|
345
343
|
const handleLetUserPair = async () => {
|
|
346
|
-
const editor = this.editor.
|
|
344
|
+
const editor = this.editor.getEditor()!;
|
|
347
345
|
// Same id you'd use anywhere else for this user+document combination.
|
|
348
346
|
// 8-128 chars, only letters/digits/hyphens/underscores.
|
|
349
347
|
const id = "alice123-campaign-summer-2026";
|
|
350
|
-
await editor.
|
|
351
|
-
|
|
352
|
-
// Explicitly generate a pairing code (not auto-generated)
|
|
353
|
-
const { code, expiresAt } = await editor.getPairingCode();
|
|
348
|
+
const { code, expiresAt } = await editor.startMCPPairing({ id });
|
|
354
349
|
alert(`Paste this into Claude Code: ${code}`);
|
|
355
350
|
};
|
|
356
351
|
```
|
|
@@ -366,15 +361,15 @@ This prevents two AI controllers from conflicting on the same design.
|
|
|
366
361
|
|
|
367
362
|
### How it works
|
|
368
363
|
|
|
369
|
-
1. **
|
|
370
|
-
2. **Generate
|
|
371
|
-
3. **Call `editor.
|
|
372
|
-
4. **Choose your AI path**: either your backend calls MCP tools directly (using
|
|
364
|
+
1. **Confirm MCP is enabled**: it is on by default; set `features: { mcp: false }` only when you want to opt out.
|
|
365
|
+
2. **Generate MCP keys** in the Dragble dashboard: use backend `mcp_key` for your server, and `mcp_client_key` for Claude/OpenCode/Cursor/Codex-style clients.
|
|
366
|
+
3. **Call `editor.joinMCP({ id })`** where `id` is a stable identifier you control (see below).
|
|
367
|
+
4. **Choose your AI path**: either your backend calls MCP tools directly (using `mcp_key`), or you generate a pairing code for the end-user to connect their own AI client (using `mcp_client_key`).
|
|
373
368
|
5. **Mutations stream live** onto the editor canvas as the AI works.
|
|
374
369
|
|
|
375
370
|
### The `id` parameter — why it matters
|
|
376
371
|
|
|
377
|
-
The `id` you pass to `
|
|
372
|
+
The `id` you pass to `joinMCP()` is a **Bring Your Own ID (BYOI)** that maps to your domain entities. It is NOT a random token — it is how Dragble identifies the session across browser refreshes, server restarts, and device switches.
|
|
378
373
|
|
|
379
374
|
**Rules:**
|
|
380
375
|
|
|
@@ -390,14 +385,14 @@ The `id` you pass to `connectMCP()` is a **Bring Your Own ID (BYOI)** that maps
|
|
|
390
385
|
|
|
391
386
|
```typescript
|
|
392
387
|
// Recommended: derive from your domain — concrete examples
|
|
393
|
-
editor.
|
|
394
|
-
editor.
|
|
395
|
-
editor.
|
|
396
|
-
editor.
|
|
388
|
+
editor.joinMCP({ id: "alice123-campaign-summer-2026" }); // user + doc
|
|
389
|
+
editor.joinMCP({ id: "workspace_acme_template_welcome" }); // workspace + template
|
|
390
|
+
editor.joinMCP({ id: "org-uber-eats-promo-q4-2026" }); // org + campaign
|
|
391
|
+
editor.joinMCP({ id: "tenant_42_invoice_template_v3" }); // tenant + entity
|
|
397
392
|
|
|
398
393
|
// Valid but NOT recommended — random IDs break session continuity
|
|
399
394
|
// (every page refresh creates a brand new session, AI loses context)
|
|
400
|
-
editor.
|
|
395
|
+
editor.joinMCP({ id: crypto.randomUUID() });
|
|
401
396
|
```
|
|
402
397
|
|
|
403
398
|
### Disconnecting
|
|
@@ -421,7 +416,8 @@ Idle sessions are reaped after 2 hours of inactivity. Active sessions never expi
|
|
|
421
416
|
|
|
422
417
|
| Method | Returns |
|
|
423
418
|
| -------------------------------------------------- | ----------------------------------------------------------------------- |
|
|
424
|
-
| `editor.
|
|
419
|
+
| `editor.joinMCP({ id, editorMode? })` | `{ sessionId, resumed? }` for backend-managed flows |
|
|
420
|
+
| `editor.startMCPPairing({ id, editorMode? })` | `{ sessionId, resumed?, code, expiresAt }` for client pairing |
|
|
425
421
|
| `editor.disconnectMCP()` | `{ destroyed }` — permanently deletes session |
|
|
426
422
|
| `editor.getPairingCode()` | `{ code, expiresAt }` — generate a pairing code for end-user AI clients |
|
|
427
423
|
| `editor.endPairing()` | `{ revoked }` — invalidate the active pairing code |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dragble-angular-editor",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "AI-powered Angular email editor component. Drag-and-drop email builder for creating responsive email templates and newsletters. Build HTML emails visually with Dragble.",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
},
|
|
96
96
|
"homepage": "https://docs.dragble.com",
|
|
97
97
|
"dependencies": {
|
|
98
|
-
"dragble-types": "
|
|
98
|
+
"dragble-types": "^1.0.9"
|
|
99
99
|
},
|
|
100
100
|
"peerDependencies": {
|
|
101
101
|
"@angular/common": ">=17.0.0",
|