dragble-angular-editor 1.0.4 → 1.0.6
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 +42 -56
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -167,25 +167,27 @@ import {
|
|
|
167
167
|
selector: "app-advanced-email-builder",
|
|
168
168
|
standalone: true,
|
|
169
169
|
imports: [DragbleEditorComponent],
|
|
170
|
-
styles: [
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
170
|
+
styles: [
|
|
171
|
+
`
|
|
172
|
+
.advanced-email-builder {
|
|
173
|
+
height: 100vh;
|
|
174
|
+
display: flex;
|
|
175
|
+
flex-direction: column;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.toolbar {
|
|
179
|
+
padding: 12px;
|
|
180
|
+
border-bottom: 1px solid #ddd;
|
|
181
|
+
display: flex;
|
|
182
|
+
gap: 8px;
|
|
183
|
+
align-items: center;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.dirty-indicator {
|
|
187
|
+
color: orange;
|
|
188
|
+
}
|
|
189
|
+
`,
|
|
190
|
+
],
|
|
189
191
|
template: `
|
|
190
192
|
<div class="advanced-email-builder">
|
|
191
193
|
<div class="toolbar">
|
|
@@ -195,7 +197,9 @@ import {
|
|
|
195
197
|
Preview
|
|
196
198
|
</button>
|
|
197
199
|
<button type="button" (click)="handleExportHtml()">Export HTML</button>
|
|
198
|
-
<button type="button" (click)="handleExportImage()">
|
|
200
|
+
<button type="button" (click)="handleExportImage()">
|
|
201
|
+
Export Image
|
|
202
|
+
</button>
|
|
199
203
|
<span *ngIf="isDirty" class="dirty-indicator">Unsaved changes</span>
|
|
200
204
|
</div>
|
|
201
205
|
|
|
@@ -326,11 +330,10 @@ export class EditorComponent {
|
|
|
326
330
|
// const id = "alice123-campaign-summer-2026";
|
|
327
331
|
//
|
|
328
332
|
// Format rules: 8-128 chars, only letters/digits/hyphens/underscores.
|
|
329
|
-
const userIdFromAuth = "alice123";
|
|
333
|
+
const userIdFromAuth = "alice123"; // from your auth/session
|
|
330
334
|
const docIdFromRoute = "campaign-summer"; // from your URL or DB row
|
|
331
335
|
const id = `${userIdFromAuth}-${docIdFromRoute}`;
|
|
332
|
-
const { sessionId } =
|
|
333
|
-
await this.editor.editor!.connectMCP({ id });
|
|
336
|
+
const { sessionId } = await this.editor.editor!.connectMCP({ id });
|
|
334
337
|
// Pass sessionId to your backend — it calls MCP tools with your mcp_key
|
|
335
338
|
}
|
|
336
339
|
}
|
|
@@ -374,49 +377,32 @@ This prevents two AI controllers from conflicting on the same design.
|
|
|
374
377
|
The `id` you pass to `connectMCP()` 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.
|
|
375
378
|
|
|
376
379
|
**Rules:**
|
|
380
|
+
|
|
377
381
|
- 8–128 characters long
|
|
378
382
|
- Only letters, numbers, hyphens, and underscores (`a-z A-Z 0-9 - _`)
|
|
379
383
|
- Must be deterministic — the same user editing the same document should always produce the same `id`
|
|
380
384
|
|
|
381
385
|
**Why these rules?**
|
|
382
|
-
|
|
386
|
+
|
|
387
|
+
- The `id` is used in database lookups and URL paths — special characters or extreme lengths would break routing
|
|
383
388
|
- Same `id` = resume the same session. Random UUIDs mean every page refresh creates a new session and loses AI context
|
|
384
389
|
- Short IDs (< 8 chars) are too easy to guess, long IDs (> 128 chars) waste storage
|
|
385
390
|
|
|
386
391
|
```typescript
|
|
387
392
|
// Recommended: derive from your domain — concrete examples
|
|
388
|
-
editor.connectMCP({ id: "alice123-campaign-summer-2026" });
|
|
393
|
+
editor.connectMCP({ id: "alice123-campaign-summer-2026" }); // user + doc
|
|
389
394
|
editor.connectMCP({ id: "workspace_acme_template_welcome" }); // workspace + template
|
|
390
|
-
editor.connectMCP({ id: "org-uber-eats-promo-q4-2026" });
|
|
391
|
-
editor.connectMCP({ id: "tenant_42_invoice_template_v3" });
|
|
395
|
+
editor.connectMCP({ id: "org-uber-eats-promo-q4-2026" }); // org + campaign
|
|
396
|
+
editor.connectMCP({ id: "tenant_42_invoice_template_v3" }); // tenant + entity
|
|
392
397
|
|
|
393
398
|
// Valid but NOT recommended — random IDs break session continuity
|
|
394
399
|
// (every page refresh creates a brand new session, AI loses context)
|
|
395
400
|
editor.connectMCP({ id: crypto.randomUUID() });
|
|
396
401
|
```
|
|
397
402
|
|
|
398
|
-
### Storage modes (compliance)
|
|
399
|
-
|
|
400
|
-
Choose how much of the session lives on Dragble's servers:
|
|
401
|
-
|
|
402
|
-
| Mode | Persistence | Use case |
|
|
403
|
-
|---|---|---|
|
|
404
|
-
| `full` (default) | Metadata + design content | Standard SaaS; survives refresh, restart, device switch |
|
|
405
|
-
| `metadata-only` | Metadata only | Audit logs without storing customer content |
|
|
406
|
-
| `memory-only` | None — RAM only | HIPAA / SOC2 / strict data residency |
|
|
407
|
-
|
|
408
|
-
```typescript
|
|
409
|
-
editor.connectMCP({
|
|
410
|
-
id: "user-42-doc-99",
|
|
411
|
-
storage: "full", // default — best UX, refresh + cross-device resume
|
|
412
|
-
// "metadata-only" // audit metadata only, no design content persisted
|
|
413
|
-
// "memory-only" // nothing persisted (HIPAA / SOC2 / data residency)
|
|
414
|
-
});
|
|
415
|
-
```
|
|
416
|
-
|
|
417
403
|
### Disconnecting
|
|
418
404
|
|
|
419
|
-
`disconnectMCP()` permanently destroys the session — the
|
|
405
|
+
`disconnectMCP()` permanently destroys the session — the session cannot be reopened:
|
|
420
406
|
|
|
421
407
|
```typescript
|
|
422
408
|
const { destroyed } = await editor.disconnectMCP();
|
|
@@ -425,7 +411,7 @@ const { destroyed } = await editor.disconnectMCP();
|
|
|
425
411
|
Your backend can also force-destroy a session server-side (e.g., when a user's subscription ends):
|
|
426
412
|
|
|
427
413
|
```bash
|
|
428
|
-
curl -X DELETE https://mcp.dragble.
|
|
414
|
+
curl -X DELETE https://mcp.dragble.com/sessions/user-42-doc-99 \
|
|
429
415
|
-H "X-API-Key: db_mcp_your_key_here"
|
|
430
416
|
```
|
|
431
417
|
|
|
@@ -433,14 +419,14 @@ Idle sessions are reaped after 2 hours of inactivity. Active sessions never expi
|
|
|
433
419
|
|
|
434
420
|
### MCP method reference
|
|
435
421
|
|
|
436
|
-
| Method
|
|
437
|
-
|
|
438
|
-
| `editor.connectMCP({ id,
|
|
439
|
-
| `editor.disconnectMCP()`
|
|
440
|
-
| `editor.getPairingCode()`
|
|
441
|
-
| `editor.endPairing()`
|
|
442
|
-
| `editor.getMCPStatus()`
|
|
443
|
-
| `editor.onAIToolFired(cb)`
|
|
422
|
+
| Method | Returns |
|
|
423
|
+
| -------------------------------------------------- | ----------------------------------------------------------------------- |
|
|
424
|
+
| `editor.connectMCP({ id, editorMode? })` | `{ sessionId, resumed? }` |
|
|
425
|
+
| `editor.disconnectMCP()` | `{ destroyed }` — permanently deletes session |
|
|
426
|
+
| `editor.getPairingCode()` | `{ code, expiresAt }` — generate a pairing code for end-user AI clients |
|
|
427
|
+
| `editor.endPairing()` | `{ revoked }` — invalidate the active pairing code |
|
|
428
|
+
| `editor.getMCPStatus()` | `{ paired: true, sessionId } \| { paired: false, reason? }` |
|
|
429
|
+
| `editor.onAIToolFired(cb)` | unsubscribe fn — fires when AI calls any tool |
|
|
444
430
|
|
|
445
431
|
### Full documentation
|
|
446
432
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dragble-angular-editor",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
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",
|