dragble-vue-editor 1.0.7 → 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 +18 -22
- package/dist/index.d.ts +4 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -218,21 +218,20 @@ const handleError = (error: Error) => {
|
|
|
218
218
|
|
|
219
219
|
## MCP — AI Integration
|
|
220
220
|
|
|
221
|
-
Connect AI agents (Claude Code, OpenCode, Codex, Cursor, or your own AI backend) to the editor through the [Model Context Protocol](https://modelcontextprotocol.io).
|
|
221
|
+
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.
|
|
222
222
|
|
|
223
223
|
### Enabling MCP
|
|
224
224
|
|
|
225
|
-
MCP is
|
|
225
|
+
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:
|
|
226
226
|
|
|
227
227
|
```vue
|
|
228
228
|
<DragbleEditor
|
|
229
229
|
ref="editorRef"
|
|
230
230
|
editor-key="db_pxl81cxn92wignwx"
|
|
231
|
-
:options="{ features: { mcp: true } }"
|
|
232
231
|
/>
|
|
233
232
|
```
|
|
234
233
|
|
|
235
|
-
MCP also requires a **Starter plan or higher**. Both conditions must be true — plan allows it AND SDK
|
|
234
|
+
MCP also requires a **Starter plan or higher**. Both conditions must be true — plan allows it AND SDK has not opted out.
|
|
236
235
|
|
|
237
236
|
### Quick example — your backend controls the AI
|
|
238
237
|
|
|
@@ -242,7 +241,6 @@ MCP also requires a **Starter plan or higher**. Both conditions must be true —
|
|
|
242
241
|
<DragbleEditor
|
|
243
242
|
ref="editorRef"
|
|
244
243
|
editor-key="db_pxl81cxn92wignwx"
|
|
245
|
-
:options="{ features: { mcp: true } }"
|
|
246
244
|
/>
|
|
247
245
|
</template>
|
|
248
246
|
|
|
@@ -264,8 +262,8 @@ const handleConnectAI = async () => {
|
|
|
264
262
|
const userIdFromAuth = "alice123"; // from your auth/session
|
|
265
263
|
const docIdFromRoute = "campaign-summer"; // from your URL or DB row
|
|
266
264
|
const id = `${userIdFromAuth}-${docIdFromRoute}`;
|
|
267
|
-
const { sessionId } = await editorRef.value!.editor!.
|
|
268
|
-
// Pass sessionId to your backend — it calls MCP tools with your mcp_key
|
|
265
|
+
const { sessionId } = await editorRef.value!.editor!.joinMCP({ id });
|
|
266
|
+
// Pass sessionId to your backend — it calls MCP tools with your backend mcp_key
|
|
269
267
|
};
|
|
270
268
|
</script>
|
|
271
269
|
```
|
|
@@ -278,10 +276,7 @@ const handleLetUserPair = async () => {
|
|
|
278
276
|
// Same id you'd use anywhere else for this user+document combination.
|
|
279
277
|
// 8-128 chars, only letters/digits/hyphens/underscores.
|
|
280
278
|
const id = "alice123-campaign-summer-2026";
|
|
281
|
-
await editor.
|
|
282
|
-
|
|
283
|
-
// Explicitly generate a pairing code (not auto-generated)
|
|
284
|
-
const { code, expiresAt } = await editor.getPairingCode();
|
|
279
|
+
const { code, expiresAt } = await editor.startMCPPairing({ id });
|
|
285
280
|
alert(`Paste this into Claude Code: ${code}`);
|
|
286
281
|
};
|
|
287
282
|
```
|
|
@@ -297,15 +292,15 @@ This prevents two AI controllers from conflicting on the same design.
|
|
|
297
292
|
|
|
298
293
|
### How it works
|
|
299
294
|
|
|
300
|
-
1. **
|
|
301
|
-
2. **Generate
|
|
302
|
-
3. **Call `editor.
|
|
303
|
-
4. **Choose your AI path**: either your backend calls MCP tools directly (using
|
|
295
|
+
1. **Confirm MCP is enabled**: it is on by default; set `features: { mcp: false }` only when you want to opt out.
|
|
296
|
+
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.
|
|
297
|
+
3. **Call `editor.joinMCP({ id })`** where `id` is a stable identifier you control (see below).
|
|
298
|
+
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`).
|
|
304
299
|
5. **Mutations stream live** onto the editor canvas as the AI works.
|
|
305
300
|
|
|
306
301
|
### The `id` parameter — why it matters
|
|
307
302
|
|
|
308
|
-
The `id` you pass to `
|
|
303
|
+
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.
|
|
309
304
|
|
|
310
305
|
**Rules:**
|
|
311
306
|
|
|
@@ -321,14 +316,14 @@ The `id` you pass to `connectMCP()` is a **Bring Your Own ID (BYOI)** that maps
|
|
|
321
316
|
|
|
322
317
|
```ts
|
|
323
318
|
// Recommended: derive from your domain — concrete examples
|
|
324
|
-
editor.
|
|
325
|
-
editor.
|
|
326
|
-
editor.
|
|
327
|
-
editor.
|
|
319
|
+
editor.joinMCP({ id: "alice123-campaign-summer-2026" }); // user + doc
|
|
320
|
+
editor.joinMCP({ id: "workspace_acme_template_welcome" }); // workspace + template
|
|
321
|
+
editor.joinMCP({ id: "org-uber-eats-promo-q4-2026" }); // org + campaign
|
|
322
|
+
editor.joinMCP({ id: "tenant_42_invoice_template_v3" }); // tenant + entity
|
|
328
323
|
|
|
329
324
|
// Valid but NOT recommended — random IDs break session continuity
|
|
330
325
|
// (every page refresh creates a brand new session, AI loses context)
|
|
331
|
-
editor.
|
|
326
|
+
editor.joinMCP({ id: crypto.randomUUID() });
|
|
332
327
|
```
|
|
333
328
|
|
|
334
329
|
### Disconnecting
|
|
@@ -352,7 +347,8 @@ Idle sessions are reaped after 2 hours of inactivity. Active sessions never expi
|
|
|
352
347
|
|
|
353
348
|
| Method | Returns |
|
|
354
349
|
| -------------------------------------------------- | ----------------------------------------------------------------------- |
|
|
355
|
-
| `editor.
|
|
350
|
+
| `editor.joinMCP({ id, editorMode? })` | `{ sessionId, resumed? }` for backend-managed flows |
|
|
351
|
+
| `editor.startMCPPairing({ id, editorMode? })` | `{ sessionId, resumed?, code, expiresAt }` for client pairing |
|
|
356
352
|
| `editor.disconnectMCP()` | `{ destroyed }` — permanently deletes session |
|
|
357
353
|
| `editor.getPairingCode()` | `{ code, expiresAt }` — generate a pairing code for end-user AI clients |
|
|
358
354
|
| `editor.endPairing()` | `{ revoked }` — invalidate the active pairing code |
|
package/dist/index.d.ts
CHANGED
|
@@ -655,7 +655,8 @@ declare function useDragbleEditor(config: Omit<DragbleConfig, "containerId">, sd
|
|
|
655
655
|
getStorageInfo: () => Promise<Record<string, unknown>>;
|
|
656
656
|
addEventListener: <T = unknown>(event: EditorEventName, callback: (data: T) => void) => () => void;
|
|
657
657
|
removeEventListener: <T = unknown>(event: EditorEventName, callback: (data: T) => void) => void;
|
|
658
|
-
|
|
658
|
+
joinMCP: (opts: dragble_types.JoinMCPOptions) => Promise<dragble_types.JoinMCPResult>;
|
|
659
|
+
startMCPPairing: (opts: dragble_types.StartMCPPairingOptions) => Promise<dragble_types.StartMCPPairingResult>;
|
|
659
660
|
disconnectMCP: () => Promise<dragble_types.DisconnectMCPResult>;
|
|
660
661
|
getPairingCode: () => Promise<dragble_types.GetPairingCodeResult>;
|
|
661
662
|
endPairing: () => Promise<dragble_types.EndPairingResult>;
|
|
@@ -773,7 +774,8 @@ declare function useDragbleEditor(config: Omit<DragbleConfig, "containerId">, sd
|
|
|
773
774
|
getStorageInfo: () => Promise<Record<string, unknown>>;
|
|
774
775
|
addEventListener: <T = unknown>(event: EditorEventName, callback: (data: T) => void) => () => void;
|
|
775
776
|
removeEventListener: <T = unknown>(event: EditorEventName, callback: (data: T) => void) => void;
|
|
776
|
-
|
|
777
|
+
joinMCP: (opts: dragble_types.JoinMCPOptions) => Promise<dragble_types.JoinMCPResult>;
|
|
778
|
+
startMCPPairing: (opts: dragble_types.StartMCPPairingOptions) => Promise<dragble_types.StartMCPPairingResult>;
|
|
777
779
|
disconnectMCP: () => Promise<dragble_types.DisconnectMCPResult>;
|
|
778
780
|
getPairingCode: () => Promise<dragble_types.GetPairingCodeResult>;
|
|
779
781
|
endPairing: () => Promise<dragble_types.EndPairingResult>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dragble-vue-editor",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "AI-powered Vue 3 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",
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
},
|
|
97
97
|
"homepage": "https://docs.dragble.com",
|
|
98
98
|
"dependencies": {
|
|
99
|
-
"dragble-types": "^1.0.
|
|
99
|
+
"dragble-types": "^1.0.9"
|
|
100
100
|
},
|
|
101
101
|
"peerDependencies": {
|
|
102
102
|
"vue": ">=3.0.0"
|